Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [gentoo-commits] repo/gentoo:master commit in: media-libs/x265/
Date: Tue, 26 May 2020 09:31:42
Message-Id: d80048f3f1ebed75fb6bba1fc0e4df46bde12eec.camel@gentoo.org
In Reply to: Re: [gentoo-dev] Re: [gentoo-commits] repo/gentoo:master commit in: media-libs/x265/ by Mike Gilbert
1 On Mon, 2020-05-25 at 21:09 -0400, Mike Gilbert wrote:
2 > On Mon, May 25, 2020 at 7:35 PM Alexis Ballier <aballier@g.o>
3 > wrote:
4 > > On Mon, 2020-05-25 at 17:04 -0400, Mike Gilbert wrote:
5 > > > On Mon, May 25, 2020 at 3:18 PM Michał Górny <mgorny@g.o>
6 > > > wrote:
7 > > > > On Mon, 2020-05-25 at 19:49 +0200, Alexis Ballier wrote:
8 > > > > > On Mon, 25 May 2020 11:26:26 -0400
9 > > > > > Mike Gilbert <floppym@g.o> wrote:
10 > > > > >
11 > > > > > > On Mon, May 25, 2020 at 9:13 AM Alexis Ballier <
12 > > > > > > aballier@g.o>
13 > > > > > > wrote:
14 > > > > > > > On Sun, 24 May 2020 20:25:11 +0000 (UTC)
15 > > > > > > > "Thomas Deutschmann" <whissi@g.o> wrote:
16 > > > > > > >
17 > > > > > > > > commit: 6e149596cc76f1bbcee6720828c8c8c92420f2a3
18 > > > > > > > > Author: Thomas Deutschmann <whissi <AT> gentoo
19 > > > > > > > > <DOT>
20 > > > > > > > > org>
21 > > > > > > > > AuthorDate: Sun May 24 19:47:08 2020 +0000
22 > > > > > > > > Commit: Thomas Deutschmann <whissi <AT> gentoo
23 > > > > > > > > <DOT>
24 > > > > > > > > org>
25 > > > > > > > > CommitDate: Sun May 24 20:23:53 2020 +0000
26 > > > > > > > > URL:
27 > > > > > > > > https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e149596
28 > > > > > > > >
29 > > > > > > > > media-libs/x265: drop USE=pic
30 > > > > > > > >
31 > > > > > > > > Gentoo's toolchain uses PIC by default. Since USE=asm
32 > > > > > > > > was
33 > > > > > > > > added,
34 > > > > > > > > we no longer need a USE flag to control that behavior.
35 > > > > > > >
36 > > > > > > > You got it wrong here it seems: USE=pic does not control
37 > > > > > > > whether
38 > > > > > > > the toolchain produces PIC or not. Shared libs always
39 > > > > > > > are,
40 > > > > > > > and have
41 > > > > > > > always been, built that way on Gentoo.
42 > > > > > > > In this case, USE=pic means "no matter what it costs, I
43 > > > > > > > do
44 > > > > > > > not want
45 > > > > > > > textrels", for the cases of hand written assembly that
46 > > > > > > > has to
47 > > > > > > > be
48 > > > > > > > rewritten to support PIC. And, still in this case, this
49 > > > > > > > costs
50 > > > > > > > a lot
51 > > > > > > > of performance, so it is enabled by default on hardened
52 > > > > > > > profiles
53 > > > > > > > and not others.
54 > > > > > > > Textrels work fine (on some architectures), they disallow
55 > > > > > > > W^X
56 > > > > > > > and
57 > > > > > > > force each process using the shared lib to make a "copy"
58 > > > > > > > at
59 > > > > > > > runtime
60 > > > > > > > in order to resolve relocations, so are not desirable but
61 > > > > > > > sometimes
62 > > > > > > > the cost outweights the gain.
63 > > > > > > >
64 > > > > > > > Plus, profiles/features/hardened enables pic by default
65 > > > > > > > but
66 > > > > > > > knows
67 > > > > > > > nothing about USE=asm so this is a regression for them.
68 > > > > > >
69 > > > > > > The USE flag toggles use of assembly, not use of PIC. The
70 > > > > > > default USE
71 > > > > > > value in the hardened profile should not drive decisions on
72 > > > > > > what we
73 > > > > > > name USE flags.
74 > > > > >
75 > > > > > ... but using a global well documented useflag instead of a
76 > > > > > local
77 > > > > > invention should drive such decisions.
78 > > > >
79 > > > > What 'global well documented useflag'?
80 > > >
81 > > > It's neither global, nor well-documented, but several packages do
82 > > > define it locally.
83 > > >
84 > >
85 > > https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/profiles/use.desc?id=103236c295aa30e5e42cfc8a7429e4eea5f0d680
86 > >
87 > > https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/profiles/use.desc?id=784deb7134b9d430546557a8f8a0877bf35c02ba
88 > >
89 > > I guess this hasn't been really discussed back then.
90 > >
91 > > It is also used in a global way in profiles (make.defaults).
92 > >
93 > > > Personally, I think it should be renamed to "asm" or something
94 > > > similar
95 > > > in the majority of cases where it actually disables all use of
96 > > > assembly code.
97 > >
98 > > Thankfully these days there's usually no need to disable asm to
99 > > have
100 > > pic. hardened has no mention of that flag, and I think that e.g.
101 > > for
102 > > openssl they would have noticed long ago.
103 > > And again, 'asm' as a useflag makes no sense: if it works and
104 > > simply
105 > > replaces a C function by a faster one then it shouldn't even be an
106 > > useflag. 'pic' on the other hand conveys the tradeoff idea.
107 >
108 > If I understand you correctly, we should just drop the USE="pic"
109 > logic
110 > from the remaining packages that have it? Or are you trying to say
111 > something else?
112
113
114 Drop USE=asm unless there's a real reason to it: Such a useflag is,
115 IMHO, at the same level of a useflag on dev-lang/python that would
116 toggle dict's underlying implementations but not the semantics of the
117 language.
118 Have USE=pic for its historical meaning, aka, sacrificing everything to
119 have PIC shared libs because your system enforces this (pax).
120
121 Note that having the 'pic' useflag should be considered something to be
122 fixed: rewrite the asm in a PIC way. But these days nobody has the will
123 to do it since this is mostly an issue on x86+pax, both being slowly
124 decreasing.

Replies