Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LDFLAGS Central
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Hasw
n00b
n00b


Joined: 31 Dec 2004
Posts: 68
Location: Germany

PostPosted: Tue May 31, 2005 11:25 pm    Post subject: Reply with quote

Hm, I'm getting a Segmentation fault:

Code:

hasw@hasw hasw $ LD_DEBUG=statistics sh -c true
     26096:     
     26096:     runtime linker statistics:
     26096:       total startup time in dynamic loader: 595306 clock cycles
     26096:                 time needed for relocation: 289777 clock cycles (48.6%)
Segmentation fault
hasw@hasw hasw $


sys-devel/binutils 2.15.92.0.2-r7
sys-libs/glibc 2.3.4.20041102-r1
Back to top
View user's profile Send private message
Bitspyer
Apprentice
Apprentice


Joined: 17 Dec 2002
Posts: 211
Location: Mainz, Germany

PostPosted: Wed Jun 01, 2005 9:33 am    Post subject: Reply with quote

Hmmm I'm asking me, what is the better solution:

LDFLAG or prelink? Or both together???
_________________
Der Weg zur Dunklen Seite... Schneller er ist, verführerischer, leichter.
Back to top
View user's profile Send private message
Dark_Cloud
n00b
n00b


Joined: 29 Jun 2003
Posts: 27

PostPosted: Wed Jun 01, 2005 4:45 pm    Post subject: Reply with quote

Bitspyer wrote:
Hmmm I'm asking me, what is the better solution:

LDFLAG or prelink? Or both together???


you can use both.:D
Back to top
View user's profile Send private message
yardbird
l33t
l33t


Joined: 20 Apr 2002
Posts: 689
Location: nl.leiden

PostPosted: Fri Jun 03, 2005 1:40 am    Post subject: Reply with quote

Hasw wrote:
Hm, I'm getting a Segmentation fault:

Code:

hasw@hasw hasw $ LD_DEBUG=statistics sh -c true
     26096:     
     26096:     runtime linker statistics:
     26096:       total startup time in dynamic loader: 595306 clock cycles
     26096:                 time needed for relocation: 289777 clock cycles (48.6%)
Segmentation fault
hasw@hasw hasw $

Same here... do you have custom LDFLAGS set in make.conf?
_________________
Albert Einstein wrote:
I consider it [...] urgently necessary for [...] workers to get together, both to protect their own economic status and [...] to secure their influence in the political field.


http://www.bluescarni.info
Back to top
View user's profile Send private message
teutzz
Guru
Guru


Joined: 22 Apr 2004
Posts: 333
Location: .ro

PostPosted: Fri Jun 03, 2005 7:11 am    Post subject: Reply with quote

Code:
Teutzz teutzz # LD_DEBUG=statistics sh -c true
     17293:
     17293:     runtime linker statistics:
     17293:       total startup time in dynamic loader: 411310 clock cycles
     17293:                 time needed for relocation: 14399 clock cycles (3.5%)
     17293:                      number of relocations: 0
     17293:           number of relocations from cache: 21
     17293:             number of relative relocations: 0
     17293:                time needed to load objects: 236055 clock cycles (57.3%)
     17293:
     17293:     runtime linker statistics:
     17293:                final number of relocations: 65
     17293:     final number of relocations from cache: 21
and in my make.conf:
Code:
Teutzz teutzz # cat /etc/make.conf | grep LDFLAGS
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -s -Wl,--as-needed"
and the whole system is prelinked
_________________
Cand nu stii ce sa raspunzi sau ce sa spui un simplu BLA ajunge... lolz
Back to top
View user's profile Send private message
yardbird
l33t
l33t


Joined: 20 Apr 2002
Posts: 689
Location: nl.leiden

PostPosted: Fri Jun 03, 2005 11:19 am    Post subject: Reply with quote

Hmm, I tried upgrading to binutils 2.16 but still the segfault... It's strange since I never had problems with binutils, I'd probably would have never discovered the issue if I had not seen this thread.

@Teutzz: I'm using your same LDFLAGS (apart from -as-needed), so I guess the problem is not there. Does anyone know what commands are executed when executing the LD_DEBUG="..." command?

:?
_________________
Albert Einstein wrote:
I consider it [...] urgently necessary for [...] workers to get together, both to protect their own economic status and [...] to secure their influence in the political field.


http://www.bluescarni.info
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:03 am    Post subject: Reply with quote

Kyrra wrote:
I had the same problem with using LDFLAGS to compile Emacs as listed in a post higher in this thread. But everything else I've compiled on my system hasn't had a problem with the LDFLAGS yet.


For emacs, you need only:

Code:

LDFLAGS="-O1"


Probably the only package that does not interpret -Wl as an option passed to the linker.
Back to top
View user's profile Send private message
wel
Apprentice
Apprentice


Joined: 03 Sep 2003
Posts: 207

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

Anyone has tried something bigger than -O1? I mean, -O2 or -Os...
Back to top
View user's profile Send private message
taipan67
l33t
l33t


Joined: 04 Dec 2004
Posts: 866
Location: England (i'm told...)

PostPosted: Sat Jun 11, 2005 7:09 pm    Post subject: Reply with quote

wel wrote:
Anyone has tried something bigger than -O1? I mean, -O2 or -Os...

As i understand other people's posts on the subject, & the 'ld' man-page, the -O optimisation-flag has only two states: zero or not-zero. So setting it to 1, 2, 3, or whatever won't make a blind bit of difference, as long as it's a number greater than zero. It's not the same principle as CFLAGS, so there won't be a size-option, either.
_________________
"Anyone who goes to see a psychiatrist should have their head examined!"
Back to top
View user's profile Send private message
Zentoo
Apprentice
Apprentice


Joined: 18 Nov 2002
Posts: 195
Location: /dev/console

PostPosted: Wed Jun 15, 2005 12:52 pm    Post subject: Notice if u use specific LDFLAGS Reply with quote

I've read this thread and i give you back my experience to have play a lot with my LDFLAGS this last year:

I've recompiled a whole system with this: LDFLAGS="-Wl,-O1"
At the first glaze no problem at all... But on the next reboot, system didn't finish to boot up.
It was looking for some libs on some partition that weren't yet mounted at boot.
It seems where is some problem with some library that are on /usr/*/lib and not on /lib that are required at boot.
It was enough a long time ago but i remember to have copy some library on /usr/*/lib without have mounted /usr
so no problem at boot time to look for them but i think it's a dirty hack...

So just be warned if you have a full separated partition scheme as i have about the use of LDFLAGS on a whole system.


Think about gpm libraries for reiserfs binaries was one of theses problems. ( i never understood the need of gpm for reiserfs !)
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Wed Jun 15, 2005 2:23 pm    Post subject: Re: Notice if u use specific LDFLAGS Reply with quote

Tuttle wrote:

At the first glaze no problem at all... But on the next reboot, system didn't finish to boot up.
It was looking for some libs on some partition that weren't yet mounted at boot.
It seems where is some problem with some library that are on /usr/*/lib and not on /lib that are required at boot.


WTF?! How does the location where libraries are installed in the system depend on LDFLAGS :?: :roll:
Back to top
View user's profile Send private message
MaratIK
n00b
n00b


Joined: 02 Apr 2003
Posts: 20
Location: Moscow, Russia

PostPosted: Fri Feb 24, 2006 3:45 am    Post subject: --relax will not work on some packages Reply with quote

ld flag --relax conficts with -r, so they cannot use both.
Package where it occured is glibc-2.3.5.
It is strongly not recommended include -Wl,--relax into LDFLAGS
Back to top
View user's profile Send private message
MaratIK
n00b
n00b


Joined: 02 Apr 2003
Posts: 20
Location: Moscow, Russia

PostPosted: Fri Feb 24, 2006 3:59 am    Post subject: Reply with quote

schrepfler wrote:
Are there any new tips for the use of LDFLAGS, what are some good configs for the 3.4, 3.4 and 4.0 compilers?

ld is not the part of gcc, but binutils. Tips the same as is for previous versions of gcc.
Back to top
View user's profile Send private message
MaratIK
n00b
n00b


Joined: 02 Apr 2003
Posts: 20
Location: Moscow, Russia

PostPosted: Mon Aug 28, 2006 4:02 pm    Post subject: Reply with quote

My settings for LDFLAGS:

Code:
LDFLAGS="-Wl,-O1,--sort-common,--enable-new-dtags,-zdynsort,-Bdirect,-hashvals"


Some explanation of last 3 settings can be found here
Back to top
View user's profile Send private message
vipernicus
Veteran
Veteran


Joined: 17 Jan 2005
Posts: 1462
Location: Your College IT Dept.

PostPosted: Mon Sep 25, 2006 9:27 pm    Post subject: Re: LDFLAGS Central Reply with quote

taviso wrote:
[*]--sort-common
This is to prevent gaps between symbols due to alignment constraints, presumably increasing efficiency layout.


Actually, it seems that it is the other way around.

-sort-common
Normally, when ld places the global common symbols
in the appropriate output sections, it sorts them
by size. First come all the one byte symbols, then
all the two bytes, then all the four bytes, and
then everything else. This is to prevent gaps be-
tween symbols due to alignment constraints. This
option disables that sorting.
_________________
Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog
Back to top
View user's profile Send private message
luminoso
n00b
n00b


Joined: 13 Oct 2005
Posts: 60
Location: Portugal, Aveiro

PostPosted: Thu Oct 05, 2006 12:08 pm    Post subject: Reply with quote

Code:

$ LD_DEBUG=statistics sh -c true
     28385:
     28385:     runtime linker statistics:
     28385:       total startup time in dynamic loader: 1578708 clock cycles
     28385:                 time needed for relocation: 29708 clock cycles (1.8%)
     28385:                      number of relocations: 0
     28385:           number of relocations from cache: 29
     28385:             number of relative relocations: 0
     28385:                time needed to load objects: 1107048 clock cycles (70.1%)
     28385:
     28385:     runtime linker statistics:
     28385:                final number of relocations: 0
     28385:     final number of relocations from cache: 29


Code:

grep LDFL /etc/make.conf
LDFLAGS="-Wl,-O1"


And no problems at all.
What should i care? time needed to load or time needed for relocation?
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


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

PostPosted: Sun Nov 26, 2006 3:24 am    Post subject: Re: LDFLAGS Central Reply with quote

vipernicus wrote:
taviso wrote:
[*]--sort-common
This is to prevent gaps between symbols due to alignment constraints, presumably increasing efficiency layout.


Actually, it seems that it is the other way around.

-sort-common
Normally, when ld places the global common symbols
in the appropriate output sections, it sorts them
by size. First come all the one byte symbols, then
all the two bytes, then all the four bytes, and
then everything else. This is to prevent gaps be-
tween symbols due to alignment constraints. This
option disables that sorting.


erm... no!

man binutils-2.17.50.0.6 wrote:
--sort-common
This option tells ld to sort the common symbols by size when it
places them in the appropriate output sections


other than this, /me still wonders why --enable-new-dtags has been removed from the original post.

edit : @zentoo, definitly not, you probably were using a statical prog and forgot about this.
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Sat Mar 03, 2007 8:04 pm    Post subject: Reply with quote

Has anyone else messed with LDFLAGS in awhile? I'm going through and sorting out what might be nice and what might not be, and just want to know if there is any new news.



Edit: Um, have LDFLAGS been removed for some odd reason?
_________________
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
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3432
Location: Gainesville, Florida

PostPosted: Sat Mar 03, 2007 11:10 pm    Post subject: Reply with quote

Mine are currently
Code:
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=both -Wl,-znow"
on several boxes.

I've been using these with the advanced Gentoo install method and overlay by nesl247 (previously know as Evolution Mission). Works great for me, and the the few packages that have problems with --as-needed or -znow can be taken care of by entries in an /etc/portage/bashrc.nesl247 file, as shown below.
---------------------------------------------------------------------------------------------------
# Packages in this array remove --as-needed.
as_needed_packages=(
${as_needed_packages[*]}
media-video/mjpegtools
kde-base/kdemultimedia
kde-base/kdemultimedia-kioslaves
net-mail/courier-imap
media-sound/cdparanoia
mail-client/evolution
media-libs/imlib
)

LDFLAGS="${LDFLAGS:-$( grep ^LDFLAGS /etc/make.conf | sed 's/LDFLAGS="//' | sed 's/"//')}"

for i in ${as_needed_packages[*]}
do
case ${CATEGORY}/${PN} in
${i})
LDFLAGS="$( echo ${LDFLAGS} | sed 's/-Wl,--as-needed//')"
break
;;
esac
done

# Packages in this array remove -znow.
znow_packages=(
${znow_packages[*]}
dev-python/gst-python
x11-base/xorg-server
x11-drivers/ati-drivers
)

for i in ${znow_packages[*]}
do
case ${CATEGORY}/${PN} in
${i})
LDFLAGS="$( echo ${LDFLAGS} | sed 's/-Wl,-znow//')"
break
;;
esac
done

export LDFLAGS=$( echo ${LDFLAGS} )
_________________
Main box- AsRock x370 Gaming K4
Ryzen 7 3700x, 3.6GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
OpenRC Gentoo ~amd64 plasma, glibc-2.36-r7, gcc-13.2.1_p20230304
kernel-6.7.2 USE=experimental python3_11
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Sun Mar 04, 2007 12:37 am    Post subject: Reply with quote

Ran into a problem. its -W, not 1, but a lower case L.
_________________
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
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3432
Location: Gainesville, Florida

PostPosted: Sun Mar 04, 2007 2:38 am    Post subject: Reply with quote

Correct. When you copy it from /etc/make.conf and paste it into the forum and add the code tags, the numeral one (1) and a lower case L really look almost identical. You have to look really close to see the numeral one has its top part at a slight downward angle, whereas the lower case L is horizontal.
_________________
Main box- AsRock x370 Gaming K4
Ryzen 7 3700x, 3.6GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
OpenRC Gentoo ~amd64 plasma, glibc-2.36-r7, gcc-13.2.1_p20230304
kernel-6.7.2 USE=experimental python3_11
Back to top
View user's profile Send private message
webdawg
n00b
n00b


Joined: 26 Jul 2006
Posts: 34

PostPosted: Tue Jun 12, 2007 3:58 am    Post subject: I had some ldflags that broke gst plugins. had to comment t Reply with quote

I had some ldflags that broke gst plugins. had to comment them out.
Back to top
View user's profile Send private message
ConiKost
Developer
Developer


Joined: 11 Jan 2005
Posts: 1365

PostPosted: Thu Jun 21, 2007 8:52 pm    Post subject: Reply with quote

I am using atm this:

Code:
LDFLAGS="-Wl,-O1 -Wl,-z,now -Wl,--as-needed -Wl,--enable-new-dtags -Wl,--sort-common -s"


works fine for me.
Back to top
View user's profile Send private message
enderandrew
l33t
l33t


Joined: 25 Oct 2005
Posts: 731

PostPosted: Thu Jun 28, 2007 4:05 am    Post subject: Reply with quote

ConiKost wrote:
I am using atm this:

Code:
LDFLAGS="-Wl,-O1 -Wl,-z,now -Wl,--as-needed -Wl,--enable-new-dtags -Wl,--sort-common -s"


works fine for me.


Don't forget --hash-style=both

And I'm working on a toolchain overlay that will add back in support for -Bdirect among many other things!
_________________
Nihilism makes me smile.
Back to top
View user's profile Send private message
gimpel
Advocate
Advocate


Joined: 15 Oct 2004
Posts: 2720
Location: Munich, Bavaria

PostPosted: Thu Jun 28, 2007 7:40 am    Post subject: Reply with quote

Code:
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common"

on binutils-2.17.50.0.10 here.

No problems.
_________________
http://proaudio.tuxfamily.org/wiki - pro-audio software overlay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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