1 |
On Tue, May 26, 2020 at 2:13 PM Mike Gilbert <floppym@g.o> wrote: |
2 |
> |
3 |
> On Tue, May 26, 2020 at 2:03 PM Alexis Ballier <aballier@g.o> wrote: |
4 |
> > |
5 |
> > On Tue, 26 May 2020 10:45:39 -0400 |
6 |
> > Mike Gilbert <floppym@g.o> wrote: |
7 |
> > > > Note that having the 'pic' useflag should be considered something |
8 |
> > > > to be fixed: rewrite the asm in a PIC way. But these days nobody |
9 |
> > > > has the will to do it since this is mostly an issue on x86+pax, |
10 |
> > > > both being slowly decreasing. |
11 |
> > > |
12 |
> > > Given that PaX has been stripped out of official Gentoo kernels due to |
13 |
> > > the grsecurity licensing issue, I wonder if there is any other good |
14 |
> > > reason to keep the "pic" USE flag today. Surely this affects a very |
15 |
> > > small population of users. |
16 |
> > |
17 |
> > |
18 |
> > I couldn't find any recent reference, but PIC shared libs used to be a |
19 |
> > QA policy. There's mainly two reasons to it: First is W^X enforcement; |
20 |
> > non PIC shared libs are refused by the x86_64 linker so a non-issue |
21 |
> > there, on x86 you need pax to emulate it because the mmu doesn't support |
22 |
> > the X part; I don't know about other arches. |
23 |
> > Then there is the small memory waste done because those libs will be |
24 |
> > loaded COW and thus their "code" is not shared anymore between |
25 |
> > processes. And the small startup performance hit to |
26 |
> > perform the relocations. |
27 |
> > |
28 |
> > The latter part affects everyone, and the rule of thumb for having a |
29 |
> > pic useflag (instead of always pic) is that the gain for non-pic asm is |
30 |
> > better than the loss of non-pic shared libs. This is subjective but |
31 |
> > usually a no-brainer for multimedia packages. |
32 |
> |
33 |
> Assuming that the pic performance penalty is really only relevant on |
34 |
> legacy arches (like x86), here are a couple of options: |
35 |
> |
36 |
> 1. Disable pic on arches where tie performance penalty is small. |
37 |
> 2. Force pic everywhere, performance be damned. |
38 |
|
39 |
Option 1 should say "Disable pic on arches where the performance |
40 |
penalty is large." |