Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 230169 - flag-o-matic.eclass: filter-ldflags does not filter flag when part of comma-separated list
Summary: flag-o-matic.eclass: filter-ldflags does not filter flag when part of comma-s...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-30 11:30 UTC by Joshua Rich
Modified: 2008-07-02 10:29 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
test ebuild (test-flagomatic-0.1.ebuild,402 bytes, text/plain)
2008-06-30 11:32 UTC, Joshua Rich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Rich 2008-06-30 11:30:46 UTC
Hi There,

I've recently switched my LDFLAGS, which previously was
"-Wl,--as-needed" but is now
LDFLAGS=-Wl,-O1,--hash-style=gnu,--sort-common,--as-needed".  Some
packages which use the filter-ldflags function from the flag-o-matic
eclass to filter "--as-needed" now break, because this flag is not
filtered when combined with other linker flags in a comma-separated
list. When LDFLAGS is set to a single -Wl value, or when each linker
flag is space-separated (i.e. LDFLAGS="-Wl,--as-needed -Wl,-O1"), the
function works as expected.  I have attached a 
test ebuild which demonstrates the problem.  To use, simply set
LDFLAGS to a list of flags, such as:

LDFLAGS=-Wl,-O1,--as-needed" # simple case with one extra flag

The test ebuild will not filter "--as-needed" when LDFLAGS is set as
above.  As far as I can tell from the manpage of gcc, this appears to
be a valid way of setting multiple linker flags, as gcc will split the
flags at the commas when passing them to the linker.

Steps to re-produce:

1. Download the test ebuild
2. Set some funky LDFLAGS which contain --as-needed in addition to others.
3. Run the src_compile function of the test ebuild: 
   ebuild test-flagomatic.ebuild digest compile

Results:

>>> Creating Manifest for /usr/local/overlays/misc/dev-libs/test-flagomatic
 * checking ebuild checksums ;-) ...                                                                         [ ok ]
 * checking auxfile checksums ;-) ...                                                                        [ ok ]
 * checking miscfile checksums ;-) ...                                                                       [ ok ]
>>> Unpacking source...
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/dev-libs/test-flagomatic-0.1/work ...
 * LDFLAGS before: -Wl,-O1,--hash-style=gnu,--sort-common,--as-needed
 * LDFLAGS after: -Wl,-O1,--hash-style=gnu,--sort-common,--as-needed
>>> Source compiled.


Expected results:

The --as-needed flag should be filtered, the "LDFLAGS after..." line
should not display this flag.

Please let me know if this is incorrect usage of the filter-ldflags
function and what the correct usage should be in this case.  I will
then file bugs against the packages which I have encountered that break
with a list of LDFLAGS set as above.

Thanks and regards,

Joshua Rich
Comment 1 Joshua Rich 2008-06-30 11:32:37 UTC
Created attachment 158951 [details]
test ebuild

Run the src_compile function of this ebuild with a comma-separated list of linker flags as LDFLAGS to see the issue:

1. export LDFLAGS=-Wl,-O1,--as-needed"
2. ebuild test-flagomatic-0.1.ebuild digest compile
Comment 2 SpanKY gentoo-dev 2008-06-30 19:25:12 UTC
this just gets to be too messy

just use clear flags and keep them as units:
-Wl,-O1 -Wl,--as-needed -Wl,------
Comment 3 Joshua Rich 2008-07-02 10:29:47 UTC
(In reply to comment #2)
> this just gets to be too messy
> 
> just use clear flags and keep them as units:
> -Wl,-O1 -Wl,--as-needed -Wl,------
> 

Ok, no worries, thanks for the reply.

Regards,

Joshua Rich