Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
New CFLAG optimization: -Wl,--as-needed?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
wilburpan
l33t
l33t


Joined: 21 Jan 2003
Posts: 977

PostPosted: Wed Mar 30, 2005 8:59 pm    Post subject: New CFLAG optimization: -Wl,--as-needed? Reply with quote

I just read an interesting article in OSNews.com about a potential way to speed up Gnome (and probably other programs).

Basically, add this to your CFLAGS:
Code:
CFLAGS = "-Wl,--as-needed"


That's captial W, lowercase L, in case anyone has a hard time with their fonts. Apparently this checks to see that all libraries that are linked are actually required and not just because pkgconfig says they are. For the author, gnome-terminal used to link against 52 libraries. After recompiling with the above CFLAG, it was linked against 21 libraries.

Disclaimer: I'm not really a programmer, but this makes sense to me, although I fully realize I could be talking out of my ass.

[EDIT] Stupid me. Forgot to put in the link.
_________________
I'm only hanging out in OTW until I get rid of this stupid l33t ranking.....Crap. That didn't work.


Last edited by wilburpan on Wed Mar 30, 2005 9:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
gren
n00b
n00b


Joined: 20 Apr 2002
Posts: 48
Location: Fargo, ND, USA

PostPosted: Wed Mar 30, 2005 9:09 pm    Post subject: Reply with quote

http://www.osnews.com/story.php?news_id=10152
Back to top
View user's profile Send private message
fuoco
Guru
Guru


Joined: 23 May 2004
Posts: 386
Location: Israel

PostPosted: Wed Mar 30, 2005 9:49 pm    Post subject: Reply with quote

This is not CFLAGS but LDFLAGS, and I think it might be better to place it in LDFLAGS, though not 100% sure (just 95%).

I have not yet experienced with it - it would be nice to hear what people have to say about it.

One thing is sure - I found that article about a hour or a bit more ago, and there was nothing in the forums about that - now I see that after just a tiny bit of time there's already a post in gentoo forums... :) What a community!
Back to top
View user's profile Send private message
gren
n00b
n00b


Joined: 20 Apr 2002
Posts: 48
Location: Fargo, ND, USA

PostPosted: Wed Mar 30, 2005 10:36 pm    Post subject: Reply with quote

I think -Wl tells the compiler to pass the option through to the linker, so
Code:
CFLAGS=-Wl,--as-needed
would be equivalent to
Code:
LDFLAGS=--as-needed
Back to top
View user's profile Send private message
martin.k
Guru
Guru


Joined: 28 Nov 2004
Posts: 493
Location: Wylatowo, Polska

PostPosted: Thu Mar 31, 2005 6:11 am    Post subject: Reply with quote

I think that this feature is avaliable in binutils >= 2.15
So make sure to upgrade to binutils >= 2.15
_________________
linux-2.6.17 +ck +R4 +lockless +genetic-as +... więcej nie pamiętam :)
LRU #299256
Back to top
View user's profile Send private message
lanius
Retired Dev
Retired Dev


Joined: 08 Dec 2002
Posts: 160

PostPosted: Thu Mar 31, 2005 11:27 am    Post subject: Reply with quote

The correct way to add this is:

LDFLAGS="Wl,--as-needed"
Back to top
View user's profile Send private message
wilburpan
l33t
l33t


Joined: 21 Jan 2003
Posts: 977

PostPosted: Thu Mar 31, 2005 11:38 am    Post subject: Re: New CFLAG optimization: -Wl,--as-needed? Reply with quote

I see. As I said above:

wilburpan wrote:
Disclaimer: I'm not really a programmer, but this makes sense to me, although I fully realize I could be talking out of my ass.

:D
So, has anyone had any experience with using this feature?
_________________
I'm only hanging out in OTW until I get rid of this stupid l33t ranking.....Crap. That didn't work.
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Thu Mar 31, 2005 12:34 pm    Post subject: Reply with quote

Please follow up to https://forums.gentoo.org/viewtopic-t-316445.html

Moved from Other Things Gentoo.
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads 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