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  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Arainach
l33t
l33t


Joined: 08 Jul 2004
Posts: 609

PostPosted: Sat May 07, 2005 5:40 pm    Post subject: Reply with quote

It quite possibly would be, but I'm waiting for 3.4.4 until I spend the time to rebuild my toolkit (and thus my system) because I just don't have 72 hours to dedicate to it.
_________________
Gentoo: Stage3 w/ NPTL & udev, gcc 3.4.4 full rebuild
Kernel: 2.6.15-gentoo-r1 w/ 1G-Lowmem Patch
System: Athlon XP 2.2Ghz/1GB Corsair Value/160GB, 250GB WD IDE/128MB GeForce 6800/Sony 17" Trinitron G200 @ 1280x1024x75Hz
Back to top
View user's profile Send private message
cynric
Guru
Guru


Joined: 08 Oct 2004
Posts: 439

PostPosted: Mon Jun 06, 2005 9:33 pm    Post subject: Reply with quote

Interesting. For the sake of playing around, I tried the ldflags mentioned in taviso's post (-Wl,-O1 -Wl,--sort-common -s) and recompiled firefox. There was a slight improvement, but no appreciable difference; poor testing method with 'time'. I assume that those arguments were part of his update, but since nothing here ever mentioned --sort-common or -s, maybe they just aren't as tested as -Wl and -O1; I'll recompile firefox with just those in a bit. One area I'm still unclear about is the security notice that is mentioned a few times. I didn't see any recent, 2005, posts regarding this. Has this issue been resovled, and if not, what exactly is meant by "fixing the ebuild"?

I was somewhat dissappointed by the increase, although every little bit of "stable" performance increase is welcome. Thanks for the info.

[edit:]
Recompiled with just "-Wl,-O1" (lack of space is important ;) and basically the same results; which, for reference, is about .2 seconds faster startup time with ldflags than without. I forgot to check about multiple instances, but with ldflags it loads in about .45 seconds. Firefox needs to be tweaked for previous window checking ... but that's another issue all together.
_________________
"This Snow Crash thing -- is it a virus, a drug, or a religion?" "What's the difference?"
-- Neal Stephenson - Snow Crash
Back to top
View user's profile Send private message
superstoned
Guru
Guru


Joined: 17 Dec 2004
Posts: 432

PostPosted: Tue Jun 07, 2005 8:03 am    Post subject: Reply with quote

cynric wrote:
Interesting. For the sake of playing around, I tried the ldflags mentioned in taviso's post (-Wl,-O1 -Wl,--sort-common -s) and recompiled firefox. There was a slight improvement, but no appreciable difference; poor testing method with 'time'. I assume that those arguments were part of his update, but since nothing here ever mentioned --sort-common or -s, maybe they just aren't as tested as -Wl and -O1; I'll recompile firefox with just those in a bit. One area I'm still unclear about is the security notice that is mentioned a few times. I didn't see any recent, 2005, posts regarding this. Has this issue been resovled, and if not, what exactly is meant by "fixing the ebuild"?

I was somewhat dissappointed by the increase, although every little bit of "stable" performance increase is welcome. Thanks for the info.

[edit:]
Recompiled with just "-Wl,-O1" (lack of space is important ;) and basically the same results; which, for reference, is about .2 seconds faster startup time with ldflags than without. I forgot to check about multiple instances, but with ldflags it loads in about .45 seconds. Firefox needs to be tweaked for previous window checking ... but that's another issue all together.

so, normally firefox starts in 0.65 seconds, with ldflags in 0.45? that's an decrease of 30%! very nice...
Back to top
View user's profile Send private message
cynric
Guru
Guru


Joined: 08 Oct 2004
Posts: 439

PostPosted: Tue Jun 07, 2005 12:03 pm    Post subject: Reply with quote

Yeah, the numbers are nice. At the time though, I didn't really notice the numbers correlating at all with "end-user feel" (*boggle*). However, after recompiling without ldflags and going back, it does seem a bit more snappy.
_________________
"This Snow Crash thing -- is it a virus, a drug, or a religion?" "What's the difference?"
-- Neal Stephenson - Snow Crash
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Thu Jun 09, 2005 9:26 am    Post subject: Reply with quote

Russel-Athletic wrote:
I read in a bug report that the proper LDFlags are -O1 rather -Wl, -O1.
So which ist it?

And somebody Problems with -z now?


Yeah, "proper" use is

Code:
LDFLAGS="-O1"


but the "minor" problem is that virtually none ebuild (except for emacs) will use the LDFLAGS then. All other packages I know of require LDFLAGS to be passed to the linker via a compiler and you need

Code:
LDFLAGS="-Wl,-O1"


to achieve this, or you could also put them into CFLAGS like this (another form of a "proper" invocation):

Code:

CFLAGS="${CFLAGS} -Wl,-O1"


See
Code:

$ info ld

   Note--if the linker is being invoked indirectly, via a compiler
driver (e.g. `gcc') then all the linker command line options should be
prefixed by `-Wl,' (or whatever is appropriate for the particular
compiler driver) like this:

       gcc -Wl,--startgroup foo.o bar.o -Wl,--endgroup

   This is important, because otherwise the compiler driver program may
silently drop the linker options, resulting in a bad link.



HTH.
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3519
Location: Alsace (France)

PostPosted: Thu Jun 09, 2005 10:07 am    Post subject: Reply with quote

so adding them to CFLAGS would be the only way to have emacs AND the rest building properly?
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Thu Jun 09, 2005 12:36 pm    Post subject: Reply with quote

Enlight wrote:
so adding them to CFLAGS would be the only way to have emacs AND the rest building properly?


Give it a try - I´m a vim guy... :P :lol:
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3519
Location: Alsace (France)

PostPosted: Thu Jun 09, 2005 3:23 pm    Post subject: Reply with quote

j-m wrote:
Enlight wrote:
so adding them to CFLAGS would be the only way to have emacs AND the rest building properly?


Give it a try - I´m a vim guy... :P :lol:


my cpu is currently waiting to be replaced... (currently launchiong emerge = rebbot in the next 5 minutes :cry: ) I've been a bad guy and promise I won't o/c the next one considering the time I spent compiling ton's of stuffs...
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Fri Jun 10, 2005 3:16 pm    Post subject: Reply with quote

Enlight wrote:

my cpu is currently waiting to be replaced... (currently launchiong emerge = rebbot in the next 5 minutes :cry: ) I've been a bad guy and promise I won't o/c the next one considering the time I spent compiling ton's of stuffs...


Actually, you won´t miss anything as emacs-21.4{-r1} ebuilds unset LDFLAGS... :wink:
Back to top
View user's profile Send private message
rhill
Retired Dev
Retired Dev


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Sat Jun 11, 2005 1:48 am    Post subject: Reply with quote

j-m wrote:
Russel-Athletic wrote:
I read in a bug report that the proper LDFlags are -O1 rather -Wl, -O1.
So which ist it?

And somebody Problems with -z now?


Yeah, "proper" use is

Code:
LDFLAGS="-O1"


but the "minor" problem is that virtually none ebuild (except for emacs) will use the LDFLAGS then. All other packages I know of require LDFLAGS to be passed to the linker via a compiler and you need

Code:
LDFLAGS="-Wl,-O1"


to achieve this, or you could also put them into CFLAGS like this (another form of a "proper" invocation):

Code:

CFLAGS="${CFLAGS} -Wl,-O1"


See
Code:

$ info ld

   Note--if the linker is being invoked indirectly, via a compiler
driver (e.g. `gcc') then all the linker command line options should be
prefixed by `-Wl,' (or whatever is appropriate for the particular
compiler driver) like this:

       gcc -Wl,--startgroup foo.o bar.o -Wl,--endgroup

   This is important, because otherwise the compiler driver program may
silently drop the linker options, resulting in a bad link.



HTH.


putting -Wl,-O1 in CFLAGS will kill more than a couple packages. set it as -W1,-O1 in LDFLAGS and both the packages that incorrectly pass LDFLAGS to the compiler and the packages that correctly pass it to ld will work.
_________________
by design, by neglect
for a fact or just for effect
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Sat Jun 11, 2005 5:18 pm    Post subject: Reply with quote

dirtyepic wrote:

putting -Wl,-O1 in CFLAGS will kill more than a couple packages. set it as -W1,-O1 in LDFLAGS and both the packages that incorrectly pass LDFLAGS to the compiler and the packages that correctly pass it to ld will work.


Yes, it will - but it´s the "proper" way to do it... :lol:
Back to top
View user's profile Send private message
blueSceaDa
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jan 2005
Posts: 90

PostPosted: Sat Oct 22, 2005 1:10 pm    Post subject: Reply with quote

hm i've had it as

LDFLAGS="-Wl,-O1"

all the time now.. seems to work, but dunno which packages use it or not :?
_________________
Athlon XP 2500+ @ ~2100MHz; GeForce FX 5600 256MB; 3x256MB RAM; ASUS A7N8X-X
echo 'LDFLAGS="-Wl,-O1"' >> /etc/make.conf - no problems here
Back to top
View user's profile Send private message
red-wolf76
l33t
l33t


Joined: 13 Apr 2005
Posts: 714
Location: Rhein-Main Area

PostPosted: Wed Mar 01, 2006 8:14 am    Post subject: Reply with quote

From what I've garnered from the thread so far, it's reasonably "safe" to put
Code:
LDFLAGS="-Wl,-O1"
in your make.conf to set it globally for all packages. Yes, I'll expect b0rkage. :twisted:

Is there a way to set LDFLAGS for certain packages only, as some apparently request
Code:
LDFLAGS="-Wl,-O1,-z,-now"
. So, is there a sort of package.use where we can put these?

It would give you the option of using --omg-optimized-setting not necessarily for your whole system, but only those packages that benefit. 8)
_________________
0mFg, G3nt00 r0X0r$ T3h B1g!1111 ;)

Use sane CFLAGS! If for no other reason, do it for the lulz!
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Wed Mar 15, 2006 6:40 pm    Post subject: Reply with quote

You guys can drool over this a while.
Portage 2.1_pre6-r2 (default-linux/x86/2006.0, gcc-4.1.0, glibc-2.4-r0, 2.6.15-gentoo-r7 i686)
=================================================================
System uname: 2.6.15-gentoo-r7 i686 Pentium III (Coppermine)
Gentoo Base System version 1.12.0_pre16
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-lang/python: 2.4.2-r1
sys-apps/sandbox: 1.2.17
sys-devel/autoconf: 2.13, 2.59-r7
sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils: 2.16.1-r2, 2.16.91.0.4, 2.16.91.0.5, 2.16.91.0.6
sys-devel/libtool: 1.5.22
virtual/os-headers: 2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -O2 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig candy ccache confcache distlocks metadata-transfer sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://mirror.datapipe.net/gentoo http://gentoo.mirrors.tds.net/gentoo http://gentoo.seren.com/gentoo"
LANG="en_CA.UTF-8"
LC_ALL="en_CA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,-Bdirect -Wl,-hashvals -Wl,-zdynsort -Wl,--as-needed -Wl,--sort-common -s"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.ca.gentoo.org/gentoo-portage"
USE="x86 X X509 aac acl acpi alsa apache2 apm authdaemond avi bash-completion berkdb bitmap-fonts browserplugin bzip2 bzlib ccache chroot cjk cluster crypt ctype curlwrappers dba dio dlloader dri dts dvd dvdr dvdread eds emboss encode esd extensions extrafilters fbcon ffmpeg flac font-server foomaticdb fortran ftp gdbm gif glut gmp gpm gstreamer gtk gtk2 imagemagick imap imlib innodb ipv6 java javamail jpeg kerberos libg++ libwww lirc mad maildir matroska memlimit mikmod mmx mng motif mp3 mpeg mpi nagios-dns nagios-ntp nagios-ping nagios-ssh ncurses network neural nis nls nptl nptlonly nsplugin nvidia objc ogg opengl oss pam pcntl pcre pdflib perl pg-hier pg-intdatetime pg-vacuumdelay pic png posix procmail python qt quicktime random readline rtc samba sasl sdl sendfile session sftplogging shaper shared sharedext sharedmem simplexml sockets softquota spell sse ssl sysvipc szip tcpd tiff truetype truetype-fonts type1-fonts udev unicode usb userlocales vda vhosts virtual-users virus-scan vorbis wddx win32codecs xml xmlrpc xmms xsl xv xvid zlib elibc_glibc input_devices_evdev input_devices_keyboard input_devices_mouse kernel_linux userland_GNU video_cards_nvidia"
Unset: ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LINGUAS
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Sun Aug 06, 2006 11:57 am    Post subject: Reply with quote

I built xorg-server 1.1.1 just now and it said
Quote:
QA Notice: the following files are setXid, dyn linked, and using lazy bindings
This combination is generally discouraged. Try re-emerging the package:
LDFLAGS='-Wl,-z,now' emerge xorg-server


Interesting, eh? :)

-c
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Sat Aug 19, 2006 7:04 pm    Post subject: Reply with quote

using LDFLAGS="-Wl,-O1", Opera seems to start quite a bit faster then before. I'm gonna be brave, and recompile the system with these flags, so wish me luck!
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
ZeuZ_NG
Guru
Guru


Joined: 10 Sep 2008
Posts: 453
Location: Near /dev/urandom | /dev/null

PostPosted: Wed Jan 28, 2009 6:39 am    Post subject: Reply with quote

So, basically this thread is old, and I went through it all a Wednesday night at 2AM argentinian time, but from what I've reached out:
If prelinking DOES modify the binary, then the security risk is present wheter the parameter is passed through the linker or through prelink.
Also: What does using prelink after LDflags have been set? AS far as I´ve reached to know, ldflags are more efficient, and as I speak, I don't really know if they are set or not by default in portage-2.1X and if it's worth a shot with GCC-4.3X
I hope this doesn't come in a bad time nor a bad place, also I'm considering about forcing everything with lazy bindings (wich, isn't the default? Because I beleave it should...)
Some errors, like the last one reported with X, have seemingless and transparently been fixed as of yesterdays test in a spare machine (just base system installed, plus X and openbox)
appart from some applications loading a bit snappier without me having to deal with some other stuff, I'm still looking at migrating to baselayout-2 (wich I know, commenting is offtopic, but as the last response I see is kind of old too, I thought to name it here)

As for the security risk: I don't know wheter this would in some twisted way allow to move data from some stack or reveal I don't know what, but, it would be a sort of utterly specific case, and, I beleave there won't be something in the wild taking advantaje of it, it's more possible to expect something to collide inside your own system and bring some stability issues, than to think it as a security risk, I beleave.
Please, someone correct me, and illustrate me if I'm wrong in something, and, if possible, take the time to read it..

EDIT: So basically I went over some other threads and I'm still confused about some things, unluckily, like 30minutes later, my brain is starting to fart, so I'll just point out that I don't know wheter prelink modifing binaries and ld behing doing the same since it's technically not even close...
As of the security point of view, I beleave I retain my affirmation that as for a desktop, it wouldn't be troublesome.. It would be extreamely difficulty to find something in the wild to take advantaje on that..

EDIT2: Looks like it should work with gcc-4.X because it haven't got any realtion with it, but with binutils, in any case, someone with the avatar "It's not lupus" noted that some wiki says it shouldn't be used with 4.X, either way I couldn't locate that wiki...
_________________
| Intel Core i7 920. | Intel DX58SO Extreme. |
| 8gb DDR3 1666mHz | 1TB 7200 RPM WD HDD.|
Unix´s guru view of sex:
unzip ; strip ; touch ; grep ; finger ; \
mount ; fsck ; more ; yes ; umount ; sleep.
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
Page 8 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