Why should a package respect LDFLAGS anyway

August 13, 2010 · Posted in Gentoo, Linux 

Following my last post about Gentoo QA and Diego’s one , I will try to explain why this QA issue is that important.  As you already know, the Gentoo Council decided to add -Wl,–as-needed to default LDFLAGS. If you don’t know what does this mean, you may want to read this article from the QA documentation. However looking at this traker, I see more than 90 bugs not respecting LDFLAGS at all. Can you see any *doh* here? Yeah thats right. While the move towards -Wl,–as-needed  addition to LDFLAGS is a big step forward, the tree is not ready for this just yet. Thanks to Diego’s tinderbox for filling all those bugs, we are now able to fix these packages once and for all.

Recently, a discussion took place on gentoo-dev ML about this issue and as it turned out, few developers didn’t actually know how to track packages that don’t respect LDFLAGS. One way is to read the build system or just observe the output during build time. Another decent way is to add –Wl,–hash-style=gnu to default LDFLAGS.  This is how it works: The hash-style ( in our case GNU ) ends up in the final binary. If portage can’t find it there, it simply means that the ldflags where just ignored ( Thanks to Samuli for the explanation ). More info about –hash-style can be found on ld man page.

For our fellow Arch Testers, amd64/x86 pages[1][2] have just been updated to include this piece of information, so unless you want to use my QA powerzz against you, simply adjust your LDFLAGS before you perform any kind of testing.

Update (24/8/2010):

-Wl,–hash-style=gnu is now default on linux/amd64/10.0/developer profile. Lets see if this help us spot more broken packages




One Response to “Why should a package respect LDFLAGS anyway”

  1. Mart RaudseppNo Gravatar on August 16th, 2010 2:13 pm

    Actually I believe the check is on whether sysv hash style is still there with that LDFLAGS. As the default is probably –hash-style=both with modern binutils, so if .hash section is still present in the ELF files, then it hasn’t been honored, as otherwise only .gnu.hash section would be there – no .hash section (sysv hash).

Leave a Reply

Gentoo Users
Patras Wireless Metropolitan Network
Planet Hellug
forum hellug

Yet another open source blog ;) is using WP-Gravatar