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: Mon, 25 May 2020 23:36:54
Message-Id: 46f11bbb3c6dca7c5a0a48e64bea93cb0427753e.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 17:04 -0400, Mike Gilbert wrote:
2 > On Mon, May 25, 2020 at 3:18 PM Michał Górny <mgorny@g.o>
3 > wrote:
4 > > On Mon, 2020-05-25 at 19:49 +0200, Alexis Ballier wrote:
5 > > > On Mon, 25 May 2020 11:26:26 -0400
6 > > > Mike Gilbert <floppym@g.o> wrote:
7 > > >
8 > > > > On Mon, May 25, 2020 at 9:13 AM Alexis Ballier <
9 > > > > aballier@g.o>
10 > > > > wrote:
11 > > > > > On Sun, 24 May 2020 20:25:11 +0000 (UTC)
12 > > > > > "Thomas Deutschmann" <whissi@g.o> wrote:
13 > > > > >
14 > > > > > > commit: 6e149596cc76f1bbcee6720828c8c8c92420f2a3
15 > > > > > > Author: Thomas Deutschmann <whissi <AT> gentoo <DOT>
16 > > > > > > org>
17 > > > > > > AuthorDate: Sun May 24 19:47:08 2020 +0000
18 > > > > > > Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT>
19 > > > > > > org>
20 > > > > > > CommitDate: Sun May 24 20:23:53 2020 +0000
21 > > > > > > URL:
22 > > > > > > https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e149596
23 > > > > > >
24 > > > > > > media-libs/x265: drop USE=pic
25 > > > > > >
26 > > > > > > Gentoo's toolchain uses PIC by default. Since USE=asm was
27 > > > > > > added,
28 > > > > > > we no longer need a USE flag to control that behavior.
29 > > > > >
30 > > > > > You got it wrong here it seems: USE=pic does not control
31 > > > > > whether
32 > > > > > the toolchain produces PIC or not. Shared libs always are,
33 > > > > > and have
34 > > > > > always been, built that way on Gentoo.
35 > > > > > In this case, USE=pic means "no matter what it costs, I do
36 > > > > > not want
37 > > > > > textrels", for the cases of hand written assembly that has to
38 > > > > > be
39 > > > > > rewritten to support PIC. And, still in this case, this costs
40 > > > > > a lot
41 > > > > > of performance, so it is enabled by default on hardened
42 > > > > > profiles
43 > > > > > and not others.
44 > > > > > Textrels work fine (on some architectures), they disallow W^X
45 > > > > > and
46 > > > > > force each process using the shared lib to make a "copy" at
47 > > > > > runtime
48 > > > > > in order to resolve relocations, so are not desirable but
49 > > > > > sometimes
50 > > > > > the cost outweights the gain.
51 > > > > >
52 > > > > > Plus, profiles/features/hardened enables pic by default but
53 > > > > > knows
54 > > > > > nothing about USE=asm so this is a regression for them.
55 > > > >
56 > > > > The USE flag toggles use of assembly, not use of PIC. The
57 > > > > default USE
58 > > > > value in the hardened profile should not drive decisions on
59 > > > > what we
60 > > > > name USE flags.
61 > > >
62 > > > ... but using a global well documented useflag instead of a local
63 > > > invention should drive such decisions.
64 > >
65 > > What 'global well documented useflag'?
66 >
67 > It's neither global, nor well-documented, but several packages do
68 > define it locally.
69 >
70
71 https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/profiles/use.desc?id=103236c295aa30e5e42cfc8a7429e4eea5f0d680
72
73 https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/profiles/use.desc?id=784deb7134b9d430546557a8f8a0877bf35c02ba
74
75 I guess this hasn't been really discussed back then.
76
77 It is also used in a global way in profiles (make.defaults).
78
79 > Personally, I think it should be renamed to "asm" or something
80 > similar
81 > in the majority of cases where it actually disables all use of
82 > assembly code.
83
84 Thankfully these days there's usually no need to disable asm to have
85 pic. hardened has no mention of that flag, and I think that e.g. for
86 openssl they would have noticed long ago.
87 And again, 'asm' as a useflag makes no sense: if it works and simply
88 replaces a C function by a faster one then it shouldn't even be an
89 useflag. 'pic' on the other hand conveys the tradeoff idea.

Replies