Currently, with LDFLAGS='-Xlinker --as-needed' raw-ldflags() does not change a thing. It should strip the -Xlinker option, just as it strips -Wl, from -Wl,--as-needed. $ emerge --info Portage 2.1.1_pre5 (default-linux/x86/2006.0, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.17.7 i686) ================================================================= System uname: 2.6.17.7 i686 AMD Duron(tm) Processor Gentoo Base System version 1.12.4 Last Sync: Unknown app-admin/eselect-compiler: 2.0.0_rc2-r1 dev-lang/python: 2.4.3-r1 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: [Not Present] dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.18.1 sys-devel/autoconf: 2.13, 2.60 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.17 sys-devel/gcc-config: [Not Present] sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.17 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=athlon-tbird -O3 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config" CONFIG_PROTECT_MASK="/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c" CXXFLAGS="-march=athlon-tbird -O3 -pipe -fomit-frame-pointer" DISTDIR="/var/dist" FEATURES="assume-digests autoconfig autopatch collision-protect cvs distlocks metadata-transfer notitles parallel-fetch sandbox sfperms sign strict test userpriv usersandbox" GENTOO_MIRRORS="http://ftp.easynet.nl/mirror/gentoo" LANG="en_GB.UTF-8" LDFLAGS="-Xlinker --as-needed" LINGUAS="en_GB en" PKGDIR="/var/pkg" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/var/cvs/gentoo-x86" PORTDIR_OVERLAY="/etc/portage/overlay /etc/portage/overlay/enlightenment" SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage" USE="x86 3dnow 3dnowext X alsa bindist cairo cdparanoia cjk cups debugger dri elibc_glibc ftp gcc-libffi gif gpgme graphviz gtk iconv idn immqt input_devices_keyboard input_devices_mouse ipv6 ithreads jpeg kdeenablefinal kdehiddenvisibility kernel_linux linguas_en linguas_en_GB lynxkeymap mbox mmx mmxext mozdevelop mudflap ncurses nethack nls no-old-linux nocxx nptl nptlonly offensive ogg opengl pango paste64 pcre pdf perl png ppds qt3 readline rtc ssl svg tcl test theora truetype unicode userland_GNU video_cards_radeon vim-pager vorbis win32codecs xim xine xorg" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS
what's wrong with using -Wl,--as-needed i'd say this is a wontfix as it forces people to use the same syntax as expected everywhere
> what's wrong with using -Wl,--as-needed It doesn't catch bugs like this one. (Yes, that's really why I started using it, and I have been using it without problems for quite a while now.) > i'd say this is a wontfix as it forces people to use the same syntax as > expected everywhere To gcc, -Xlinker --as-needed and -Wl,--as-needed are equivalent. Do you have a good reason to treat them differently?
One possible way: Index: flag-o-matic.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v retrieving revision 1.110 diff -u -u -r1.110 flag-o-matic.eclass --- flag-o-matic.eclass 1 Aug 2006 00:49:16 -0000 1.110 +++ flag-o-matic.eclass 13 Aug 2006 10:18:05 -0000 @@ -567,8 +567,15 @@ [[ -z ${input} ]] && input=${LDFLAGS} set -- for x in ${input} ; do - x=${x#-Wl,} - set -- "$@" ${x//,/ } + case "${x}" in + -Wl,*) + x=${x#-Wl,} + set -- "$@" ${x//,/ } ;; + -Xlinker) + ;; + *) + set -- "$@" "${x}" ;; + esac done echo "$@" }
my point is for ebuilds/whatever that needs to manipulate linker flags ... assuming the -Wl, form makes working with linker flags sane ... having to support a bunch of different forms is just a pita
> my point is for ebuilds/whatever that needs to manipulate linker flags ... > assuming the -Wl, form makes working with linker flags sane ... Sane is supporting whatever gcc supports. I think you mean easy, not sane, and in that case, it would be a reasonable point, except I don't mind doing it myself (and have given one suggestion already)
no, i mean what i said if ebuilds need to filter out a flag, they'd have to make sure every form is taken care of which is certainly not sane
> no, i mean what i said > > if ebuilds need to filter out a flag, they'd have to make sure every form is > taken care of which is certainly not sane Ebuilds shouldn't filter out flags. It breaks with a lot more than just -Xlinker: it also breaks with -Wl,--option1,--option2. Ebuilds should append-ldflags -Wl,--no-option1. That's a completely different problem, by the way, and should not affect raw-ldflags().
not all flags have a negative version to invert meaning. by forcing everyone to use the same form, there is hope for having the filter actually work. yes, the real solution is to not filter, but short term to keep systems flowing smoothly, that is the reality. along those lines, packages shouldnt even require raw-ldflags ... so if you want to talk about proper solutions, fix any package that executes raw-ldflags
raw-ldflags was added (by you, apparently) specifically so that LDFLAGS could be used when calling ld directly. If LDFLAGS are not supposed to be used when calling ld directly, just drop the function or make it do nothing. If ld is not supposed to be called directly anymore, make that official. Either way, there's still something that needs to be done. Currently, if I start opening bugs for packages just for using raw-ldflags, I expect them to be closed without any action, and I would wholeheartedly agree with that.
still no plans to support -X and not a problem in practice