View previous topic :: View next topic |
Author |
Message |
KrissN n00b
Joined: 25 Sep 2004 Posts: 54 Location: Kedzierzyn-Kozle@Poland
|
Posted: Sun Apr 12, 2015 6:33 pm Post subject: GCC 4.9 LTO with static libraries - problem with strip |
|
|
I've been experimenting with LTO since it appeared initially in GCC. Since I've switched to GCC 4.9 I have noticed that some ebuilds fail to compile due to missing symbols. Such behaviour is nothing new when playing with LTO, however while investigating these failures I noticed that in some cases the reason is lack of proper symbol tables in static libraries.
With GCC 4.9 the default is to create slim LTO objects, which only contain GIMPLE data and don't contain the usual symbols. Since standard binutils programs do not know how to parse GIMPLE the symbol tables of static libraries will be unusable. To mitigate this I have created wrappers for ar, nm and ranlib utilities which pass the --plugin option to allow these utilities to understand GIMPLE data. This fixes the problem of creating and parsing static libraries during build time.
However I have noticed that despite this static libraries installed on the system still don't have proper symbol tables. I investigated further and found out that the problem lies in the stripping step done during the install step. It seems that strip rewrites static libraries, but since it doesn't know how to handle GIMPLE it doesn't write a proper symbol table. Unfortunately strip doesn't support the --plugin argument so there is no way to tell it how to read GIMPLE.
Did anyone encounter this problem? Is there any method to fix this other than trying to hack binutils? _________________ We try making things idiot-proof and someone will just go and build a better idiot. |
|
Back to top |
|
|
gienah Developer
Joined: 24 Nov 2010 Posts: 212 Location: AU
|
|
Back to top |
|
|
s_j_newbury n00b
Joined: 05 Apr 2007 Posts: 56 Location: UK
|
Posted: Fri Oct 19, 2018 7:09 am Post subject: |
|
|
I know this is rather late, but why does Portage strip static archives anyway? Surely you would want anything linking to static libraries to have the unstripped version (particularly for LTO) and to then strip any binaries resulting? This also cures the issue that happens sometimes when "unused" symbols get stripped from static libraries resulting in ABI breakage. |
|
Back to top |
|
|
|