Gentoo Archives: gentoo-hardened

From: Alexander Tsoy <alexander@××××.me>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] What does the pic USE flag do these days?
Date: Thu, 27 Sep 2018 14:42:35
Message-Id: 1538059349.3758.9.camel@tsoy.me
In Reply to: Re: [gentoo-hardened] What does the pic USE flag do these days? by "Hanno Böck"
1 В Чт, 27/09/2018 в 15:45 +0200, Hanno Böck пишет:
2 > On Fri, 21 Sep 2018 00:16:48 +0100
3 > Luis Ressel <aranea@×××××.de> wrote:
4 >
5 > > On Wed, 19 Sep 2018 09:24:27 +0200
6 > > Hanno Böck <hanno@××××××.de> wrote:
7 > >
8 > > > If the flag just disables assembly optimizations then I wonder if
9 > > > it
10 > > > should be renamed (or if we need it at all - in case these
11 > > > assembly
12 > > > optimizations have no downsides).
13 > >
14 > > Many (all?) of the ebuilds with this flag do indeed only disable
15 > > assembly snippets, and most of them only do this on 32-bit x86
16 > > (gzip
17 > > being the prominent exception).
18 >
19 > And ffmpeg and mesa.
20 >
21 > In ffmpeg the flag description says:
22 > "Force shared libraries to be built as PIC (this is slower)"
23 >
24 > Which confuses me - I thought shared libraries are always PIC.
25 >
26 > It looks to me these are all historic leftovers, but I'd like to
27 > understand it better before I open bugs asking for removal of these
28 > flags.
29
30 IIRC the main issue was a limited general purpose register set on x86
31 architecture.
32 https://wiki.gentoo.org/wiki/Hardened/Toolchain#Issues_with_PIEs
33
34 "Occasionally application code will fail to compile with -fPIE. If this
35 happens it is usually down to non-position-independent assembler code,
36 and is most prevelant on X86 which has a limited general purpose
37 register set."
38
39 I guess a lot of programs was fixed since then. For example currently I
40 don't see any problems when building mesa with USE=-pic on x86_32.