Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Are we missing some easy optimizations (LDFLAGS)?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Ateo
Advocate
Advocate


Joined: 02 Jun 2003
Posts: 2019
Location: Earth

PostPosted: Sat Oct 02, 2004 4:47 am    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
b-o-s-s
n00b
n00b


Joined: 14 Jul 2003
Posts: 36

PostPosted: Thu Oct 07, 2004 9:44 pm    Post subject: Reply with quote

To the ones getting this very noticeable effect on application startup-times with the linker flags: Do you only set your CFLAGS accordingly, or do you also set the LDFLAGS in /etc/make.conf?

Because, if only setting the CFLAGS with the -Wl,... stuff, then how should the linker know about the intended flags? Sure, if compilation and linkage are performed in one run, it works. But what if these actions are seperated, which is the common case? "gcc -c ..." gets called with the CFLAGS, then ld gets called with LDFLAGS (which are unset). Isn't this the way it works?

Thanks!
Back to top
View user's profile Send private message
aethyr
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1085
Location: NYC

PostPosted: Fri Oct 08, 2004 3:43 am    Post subject: Reply with quote

b-o-s-s wrote:
To the ones getting this very noticeable effect on application startup-times with the linker flags: Do you only set your CFLAGS accordingly, or do you also set the LDFLAGS in /etc/make.conf?


As stated in the first post, add a line to your make.conf which says:
Code:
LDFLAGS="-Wl,-O1"


Last edited by aethyr on Sat Oct 09, 2004 7:13 am; edited 1 time in total
Back to top
View user's profile Send private message
MACSRULETHEWORLD
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2004
Posts: 131

PostPosted: Fri Oct 08, 2004 4:01 am    Post subject: Reply with quote

does anybody know whether this works on PPC?
Back to top
View user's profile Send private message
Fitzsimmons
Guru
Guru


Joined: 01 Jan 2003
Posts: 415
Location: Waterloo, Ontario, Canada

PostPosted: Sat Oct 09, 2004 2:58 am    Post subject: Reply with quote

Wait, I'm confused now.

Is it

Code:

LDFLAGS="-Wl,-O1"


or

Code:

LDFLAGS="Wl,01"


?
Back to top
View user's profile Send private message
>Octoploid<
n00b
n00b


Joined: 27 Jun 2004
Posts: 57

PostPosted: Sat Oct 09, 2004 3:36 am    Post subject: Reply with quote

Fitzsimmons wrote:
Wait, I'm confused now.

Is it

Code:

LDFLAGS="-Wl,-O1"


or

Code:

LDFLAGS="Wl,01"


?


$info ld
(Invocation->Options)

`-O LEVEL'
If LEVEL is a numeric values greater than zero `ld' optimizes the
output. This might take significantly longer and therefore
probably should only be enabled for the final binary.
Back to top
View user's profile Send private message
aethyr
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1085
Location: NYC

PostPosted: Sat Oct 09, 2004 5:50 am    Post subject: Reply with quote

Fitzsimmons wrote:
Wait, I'm confused now.

Is it

Code:

LDFLAGS="-Wl,-O1"


or

Code:

LDFLAGS="Wl,01"


?


Sorry, I was being terribly forgetful.

Again, please refer to my first post for instructions. For those that skipped over them to the last page, here again:
Code:
LDFLAGS="-Wl,-O1"

Please do read the beginning of the thread for info on how this actually works, or why you might care.
Back to top
View user's profile Send private message
gungholady
Guru
Guru


Joined: 19 Oct 2003
Posts: 392

PostPosted: Tue Oct 12, 2004 12:56 am    Post subject: Reply with quote

I have the following in my /etc/make.conf:

CFLAGS="-march=pentium3 -mtune=i686 -O2 -funroll-loops -pipe -fno-unit-at-a-time"
LDFLAGS="-Wl,-O1,-z,now"

But I still got the following notice when compiling xorg:

QA Notice: Security risk /usr/X11R6/bin/Xorg. Please consider relinking with 'append-ldflags -Wl,-z,now' to fix.

What have I got wrong?
Back to top
View user's profile Send private message
aethyr
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1085
Location: NYC

PostPosted: Tue Oct 12, 2004 1:28 am    Post subject: Reply with quote

gungholady wrote:
But I still got the following notice when compiling xorg:

QA Notice: Security risk /usr/X11R6/bin/Xorg. Please consider relinking with 'append-ldflags -Wl,-z,now' to fix.

What have I got wrong?


http://forums.gentoo.org/viewtopic.php?p=1572210#1572210
Back to top
View user's profile Send private message
gungholady
Guru
Guru


Joined: 19 Oct 2003
Posts: 392

PostPosted: Tue Oct 12, 2004 2:19 am    Post subject: Reply with quote

aethyr wrote:
gungholady wrote:
But I still got the following notice when compiling xorg:

QA Notice: Security risk /usr/X11R6/bin/Xorg. Please consider relinking with 'append-ldflags -Wl,-z,now' to fix.

What have I got wrong?


http://forums.gentoo.org/viewtopic.php?p=1572210#1572210


I guess I missed it when I was trying to read all these pages.
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1302
Location: Mississippi USA

PostPosted: Tue Nov 09, 2004 1:33 pm    Post subject: Reply with quote

Well, I got a error while emerging pam. Found this during my search. I put this in make.conf:

Code:
LDFLAGS='-Wl,-z,now'


I have AMD rigs. Is that OK? Are these CPU specific?

It did get rid of the error though, for pam. Can I ad something else to make it faster?

What you think?

:D :D :D :D
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
aethyr
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1085
Location: NYC

PostPosted: Tue Nov 09, 2004 5:55 pm    Post subject: Reply with quote

dalek wrote:
Well, I got a error while emerging pam. Found this during my search. I put this in make.conf:

Code:
LDFLAGS='-Wl,-z,now'


I have AMD rigs. Is that OK? Are these CPU specific?

It did get rid of the error though, for pam. Can I ad something else to make it faster?

What you think?


I'm not a developer, but I'm pretty sure you can ignore that error message (see the reference I posted [1]). And if you read my first post, you'll see that adding "-Wl,-O1" to your LDFLAGS might speed things up.

[1] http://forums.gentoo.org/viewtopic.php?p=1572210#1572210
or http://bugs.gentoo.org/show_bug.cgi?id=67205 (for more info)
Back to top
View user's profile Send private message
seank
l33t
l33t


Joined: 08 Jul 2004
Posts: 686

PostPosted: Fri Nov 12, 2004 4:34 am    Post subject: Reply with quote

curtis119 wrote:
aethyr,
it seems to me that you could very easily just put a line under the CFLAGS option and it should be passed to gcc. Try it out and let us know if it works. If it does then also let us know if it actually does improve startup times. I have steered clear of prelinking because of all the horror stories I hear on the forum.

What horror stories?
Back to top
View user's profile Send private message
bruda
Guru
Guru


Joined: 06 May 2004
Posts: 375
Location: Sherbrooke, QC, Canada

PostPosted: Tue Nov 16, 2004 4:05 am    Post subject: Reply with quote

aethyr wrote:
I'm not a developer, but I'm pretty sure you can ignore that error message (see the reference I posted [1]). And if you read my first post, you'll see that adding "-Wl,-O1" to your LDFLAGS might speed things up.

[1] http://forums.gentoo.org/viewtopic.php?p=1572210#1572210
or http://bugs.gentoo.org/show_bug.cgi?id=67205 (for more info)

Anybody cares to comment on what SpanKY says in bug 70367 (which does make some sense even if the language is on the rude side--although I believe that his changes should not have a significant effect)?

FWIW the LDFLAGS are not architecture specific as far as I understand things (plus that I am using them on PPC with expected results).
_________________
Quid latine dictum sit altum videtur
Back to top
View user's profile Send private message
aethyr
Veteran
Veteran


Joined: 06 Apr 2003
Posts: 1085
Location: NYC

PostPosted: Tue Nov 16, 2004 4:33 am    Post subject: Reply with quote

bruda wrote:
Anybody cares to comment on what SpanKY says in bug 70367


Spider and Solar both say "-Wl,-O1" here:
http://bugs.gentoo.org/show_bug.cgi?id=65002

Taviso says it here:
http://forums.gentoo.org/viewtopic.php?t=67777

Scott Remnant (Ubuntu developer) says it here:
http://mail.gnome.org/archives/desktop-devel-list/2004-September/msg00377.html

[edit] Just a precusory search through bugs.gentoo.org shows another dev saying it here:
http://bugs.gentoo.org/show_bug.cgi?id=69748

But it's quite possible vapier may be right. I can only go on what I found other places, and that's the first time I've seen that. Out of curiosity, did it help anything when you changed the flags?


Last edited by aethyr on Tue Nov 16, 2004 4:41 am; edited 1 time in total
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1302
Location: Mississippi USA

PostPosted: Tue Nov 16, 2004 4:44 am    Post subject: Reply with quote

LATINO GENTOO THUG BOI wrote:
Instalé las banderas del ld en mi máquina de la computadora pero ahora es banderas americanas y desea la sangre para el aceite que fue supuesto ser más rápido pero ahora está asumiendo el control Iraq.


Huh? I did manage to make out Iraq. 8O 8O

Later

:D :D :D :D :D
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
Stormy Eyes
Veteran
Veteran


Joined: 09 Apr 2003
Posts: 1064
Location: Watching God spit-shine my boots.

PostPosted: Tue Nov 16, 2004 4:44 am    Post subject: Reply with quote

LATINO GENTOO THUG BOI wrote:
Instalé las banderas del ld en mi máquina de la computadora pero ahora es banderas americanas y desea la sangre para el aceite que fue supuesto ser más rápido pero ahora está asumiendo el control Iraq.


Speak English or die, worthless fool.
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1302
Location: Mississippi USA

PostPosted: Tue Nov 16, 2004 4:47 am    Post subject: Reply with quote

Stormy Eyes wrote:
LATINO GENTOO THUG BOI wrote:
Instalé las banderas del ld en mi máquina de la computadora pero ahora es banderas americanas y desea la sangre para el aceite que fue supuesto ser más rápido pero ahora está asumiendo el control Iraq.


Speak English or die, worthless fool.


Stormy Eyes, Not so harsh man. I assume we don't know what he said yet. I know I don't. Do you? :? :?

Later

:D :D :D :D
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Tue Nov 16, 2004 5:11 am    Post subject: Reply with quote

Stormy Eyes wrote:
LATINO GENTOO THUG BOI wrote:
Instalé las banderas del ld en mi máquina de la computadora pero ahora es banderas americanas y desea la sangre para el aceite que fue supuesto ser más rápido pero ahora está asumiendo el control Iraq.


Speak English or die, worthless fool.
It means (if I understand it correctly) "I installed LDFLAGS (flags of LD) on my computer (computing machine) buit now it is american flags and it wants blood for that, and is of course, much faster but now is taking control of Iraq."

Um, stop trolling, idiot.
_________________
~~ Peter: Brony, GNU/Linux geek, caffeine addict, and Free Software advocate.
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
dalek
Veteran
Veteran


Joined: 19 Sep 2003
Posts: 1302
Location: Mississippi USA

PostPosted: Tue Nov 16, 2004 5:20 am    Post subject: Reply with quote

I did get the Iraq part right then. 8O 8O

Right for once. :D

Later

:D :D :D :D
_________________
My rig: Gigabyte GA-770T-USB3 mobo AMD Phenom II X4 955 3.2GHz ZALMAN CNPS10X Performa CPU cooler
G.SKILL 16GB DDR3 PC3 12800 Memory Nvidia GT-220 video card LG W2253 Monitor
WD1600AAJS & WD2502ABYS hard drives
Cooler Master HAF-932 Case
Back to top
View user's profile Send private message
bruda
Guru
Guru


Joined: 06 May 2004
Posts: 375
Location: Sherbrooke, QC, Canada

PostPosted: Tue Nov 16, 2004 2:27 pm    Post subject: Reply with quote

aethyr wrote:
But it's quite possible vapier may be right. I can only go on what I found other places, and that's the first time I've seen that. Out of curiosity, did it help anything when you changed the flags?

Yes, and now that I think about it it does make sense (-Wl is a switch introducing linker flags, no?). The howtos should probably be updated.
_________________
Quid latine dictum sit altum videtur
Back to top
View user's profile Send private message
chance2105
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jun 2004
Posts: 112
Location: Norman, OK USA

PostPosted: Sat Nov 27, 2004 12:33 am    Post subject: Reply with quote

Just another 'works for me' post -- recompiling individual apps didn't do much, but re-emerging system (emerge -e system && emerge -e system) made a rather remarkable difference.

I recompiled firefox. Initial run of it was a bit faster, but the real juice came when I ran it a second time when the firefox binary was cached -- the startup time was reduced by at least 60%.

I set my ldflags as to the original poster's suggestion ...


chance
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Wed Dec 15, 2004 6:08 pm    Post subject: Reply with quote

Added it to my make.conf and did re-emerged firefox, thunderbird, and the new RC2 of Xfce 4.2 and no problems yet :D I'll do an emerge -e system|world over winter break and see how it goes.Thanks, aethyr
_________________
~~ Peter: Brony, GNU/Linux geek, caffeine addict, and Free Software advocate.
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Mon Dec 27, 2004 3:39 am    Post subject: Reply with quote

For what it's worth, I'm doing a stage 1 chrooted install on another hard drive I have, using ~x86 and these LDFLAGS in my make.conf since before bootstrapping. Not a single problem yet, so far as I can tell. And everything at least *seems* to be snappier. The relevant parts of my make.conf:
Quote:
ACCEPT_KEYWORDS="~x86"
CFLAGS="-O2 -march=athlon-tbird -mtune=athlon-tbird -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1"
I'm on package of 84 of 115 of an `emerge -e world` (glibc) right now. I'll let you know how it goes.

:)
_________________
~~ Peter: Brony, GNU/Linux geek, caffeine addict, and Free Software advocate.
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
Lokheed
Veteran
Veteran


Joined: 12 Jul 2004
Posts: 1295
Location: /usr/src/linux

PostPosted: Mon Dec 27, 2004 5:24 am    Post subject: Reply with quote

codergeek42 wrote:
For what it's worth, I'm doing a stage 1 chrooted install on another hard drive I have, using ~x86 and these LDFLAGS in my make.conf since before bootstrapping. Not a single problem yet, so far as I can tell. And everything at least *seems* to be snappier. The relevant parts of my make.conf:
Quote:
ACCEPT_KEYWORDS="~x86"
CFLAGS="-O2 -march=athlon-tbird -mtune=athlon-tbird -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1"
I'm on package of 84 of 115 of an `emerge -e world` (glibc) right now. I'll let you know how it goes.

:)


I have been reading that it doesnt benefit small packages so that makes me not want to take the time and do an emerge -e world, but I am for sure going to emerge some of the bigger programs and see how they go. BTW, it was due to your sig that I moved to NPTL and havent looked back. One of the best upgrades I have done, maybe even over moving to GCC 3.4, so thanks ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 4 of 8

 
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