Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GCC 4.9 LTO with static libraries - problem with strip
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
KrissN
n00b
n00b


Joined: 25 Sep 2004
Posts: 54
Location: Kedzierzyn-Kozle@Poland

PostPosted: Sun Apr 12, 2015 6:33 pm    Post subject: GCC 4.9 LTO with static libraries - problem with strip Reply with quote

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
View user's profile Send private message
gienah
Developer
Developer


Joined: 24 Nov 2010
Posts: 212
Location: AU

PostPosted: Sun Apr 12, 2015 11:24 pm    Post subject: Reply with quote

There is some documentation on avoiding stripping binaries here:
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces#Stripping
Back to top
View user's profile Send private message
s_j_newbury
n00b
n00b


Joined: 05 Apr 2007
Posts: 56
Location: UK

PostPosted: Fri Oct 19, 2018 7:09 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum