Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
current state of ldflags
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
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Mon Oct 27, 2008 7:01 pm    Post subject: current state of ldflags Reply with quote

I'm just curious with the most recent version of binutils, what are safe ldflags to be used with gentoo? The only ldflags threads on the forums seem to be quite old, especially in relation to newer binutils / gcc etc. The wiki had a little bit of info on ldflags (but now it's down) but I'm just wondering what's safe / useful and which (if any) are now included by default...

Thanks
Back to top
View user's profile Send private message
button
n00b
n00b


Joined: 24 Dec 2007
Posts: 65
Location: Croatia

PostPosted: Mon Oct 27, 2008 7:41 pm    Post subject: Reply with quote

My LDFLAGS are "-Wl,-O1". I recall getting them from some thread at these forums some time ago. I am sure they are safe because I have never had a single problem with them, however I am not sure if they are useful at all.
Back to top
View user's profile Send private message
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Mon Oct 27, 2008 8:30 pm    Post subject: Reply with quote

Right, I've seen that too. It's not that they aren't useful, but I am curious as to whether they are default now or not (I thought I saw something on an email list about that once) I am fairly confident that the gnu hashstyle is default now...
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Mon Oct 27, 2008 9:09 pm    Post subject: Reply with quote

Code:
grep LDFLAGS /usr/portage/profiles/default/linux/make.defaults
# Adding LDFLAGS="-Wl,-O1 for all Linux profiles by default
# direction with how LDFLAGS will be set by default, this entry
LDFLAGS="-Wl,-O1"


:P
Back to top
View user's profile Send private message
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Mon Oct 27, 2008 9:25 pm    Post subject: Reply with quote

Thanks for the response! Now, is this file always used, independent of your profile selected, i.e. the output of

Code:

eselect profile list


and the make.defaults file it points to? In my case, I have default/linux/x86/2008.0/desktop which points to

Code:

# cat /usr/portage/profiles/default/linux/x86/2008.0/desktop/parent
../../../../../targets/desktop

which is
Code:

/usr/portage/profiles/targets/desktop/make.defaults


it seems these are additive not exclusive, but I'm just making sure. Also, is there a way, perhaps using readelf, to check which binaries were compiled with these LDFLAGS? I know to check for gnustyle you can grep the output of readelf -a, but what about for these guys?
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Mon Oct 27, 2008 9:53 pm    Post subject: Reply with quote

Ya, that seems complicated. Well, I commented out my LDFLAGS in /etc/make.conf then
Code:
emerge --info | grep LDFLAGS
LDFLAGS="-Wl,-O1"


This is a default/linux/x86/2008.0/desktop profile.
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Fri Oct 31, 2008 5:59 pm    Post subject: Reply with quote

weaksauce wrote:
I know to check for gnustyle you can grep the output of readelf -a, but what about for these guys?


I think that the gnustyle ldflag is not supported.
Back to top
View user's profile Send private message
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Fri Oct 31, 2008 7:07 pm    Post subject: Reply with quote

so, actually, it seems like --hash-style=gnu the devs would like to include as a default, but they don't because MIPS doesn't support it.
http://www.nabble.com/LDFLAGS%3D-Wl,--hash-style%3Dgnu-td18473155.html

so, can we add this LDFLAG? Is it already there?

[EDIT] or actually, the question should be, is adding
Code:
-Wl,--hash-style=both
helpful/safe?
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Fri Oct 31, 2008 7:36 pm    Post subject: Reply with quote

weaksauce wrote:
is adding
Code:
-Wl,--hash-style=both
helpful/safe?


My understanding is that this is not supported. My experience is that it is not necessarily unsafe, but I never emerged and tested every single ebuild. Is it helpful? If it's not supported then probably not. At any rate when I discovered that it's not supported I took mine out.

Besides there are several nice supported ldflags, so why bother with unsupported ones anyway!

:)
Back to top
View user's profile Send private message
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Fri Oct 31, 2008 8:03 pm    Post subject: Reply with quote

So, to which list / set of LDFLAGS are you referring to when you say supported? Supported by whom? I'm not afraid to have a bit of an 'unstable' system (I've always run ~ and I use some stuff from sunrise and kde-testing) but I don't want stuff not to work. I'm just trying to sift through mailing lists like the one posted above, the gist of which seemed to me, 'we would include --hash-style=both if a) it was supported on MIPS and b) it didn't require a specific version of binutils'

In a case like that, I know I don't have MIPS and have the latest binutils, and would want to use it. Are there other LDFLAGS in a similar situation? If so, I'd like to be using them! :lol:
Back to top
View user's profile Send private message
zyko
l33t
l33t


Joined: 01 Jun 2008
Posts: 620
Location: Munich, Germany

PostPosted: Sat Nov 01, 2008 11:13 am    Post subject: Reply with quote

Quote:
I'm just curious with the most recent version of binutils, what are safe ldflags to be used with gentoo?


By now, -O1, --sort-common and --as-needed are more or less accepted to be safe in general.
If you listen in to the discussions, some people believe --as-needed to be deeply flawed in principle. It still seems to do some (very minor) good in practice.

Quote:
So, to which list / set of LDFLAGS are you referring to when you say supported? Supported by whom?


Exactly :)

"Officially supported" seems to be an empty phrase in general, even on distributions that actually offer official support. I've no idea why people still fall for this.
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Sat Nov 01, 2008 3:55 pm    Post subject: Reply with quote

Here is the output of ps awx | grep 'make -j' during a gcc build
Code:
 17688 tty1     S+     0:00 make -j1 -j1 LDFLAGS=-Wl,-O1 -Bdirect -Wl,-z,now -Wl,-z,relro -Wl,--sort-common -Wl,--as-needed STAGE1_CFLAGS=-O LIBPATH=/usr/lib/gcc/i686-pc-linux-gnu/4.3.2 BOOT_CFLAGS= -march=native -O2 -pipe profiledbootstrap


BTW: The easiest way to know if an ldflag is unsupported is when emerge complains. :P
Back to top
View user's profile Send private message
Arfrever
Bodhisattva
Bodhisattva


Joined: 29 Apr 2006
Posts: 2460
Location: 異世界

PostPosted: Sat Nov 01, 2008 8:27 pm    Post subject: Reply with quote

notHerbert wrote:
weaksauce wrote:
is adding
Code:
-Wl,--hash-style=both
helpful/safe?


My understanding is that this is not supported. My experience is that it is not necessarily unsafe, but I never emerged and tested every single ebuild. Is it helpful? If it's not supported then probably not. At any rate when I discovered that it's not supported I took mine out.


-Wl,--hash-style=both is enabled by default by a patch for sys-devel/binutils when USE="-vanilla".

Explicitly specifying -Wl,--hash-style=gnu in LDFLAGS would override default -Wl,--hash-style=both and enable the QA check in Portage for respecting LDFLAGS.
Back to top
View user's profile Send private message
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Sat Nov 01, 2008 9:58 pm    Post subject: Reply with quote

So, I'm not particularly sure of the inner workings of LDFLAGS. If that flag gets applied to binutils, does that automatically mean everything gets the optimizations? Also, are there any LDFLAGS that are usefull that aren't default that are useful that are only not included because of arch/binutils version or other easily recognizable/fixable problems?

Thanks everyone for your help. It's not that I'm really itching for another 1.1% of performance, I'm just trying to figure out exactly what's going on with them, since on the CFLAGS front the -march=native was such a cool little creation, just looking for other gems.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Sat Nov 01, 2008 10:30 pm    Post subject: Reply with quote

In fact, it's pretty awesome :P

Also, if you want to add some speed on your box, there a bunch of people that are testing ramdisk for tmpfs.

It seems to boost a lot of stuff.
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