From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1L9j3s-0004WD-TB for garchives@archives.gentoo.org; Mon, 08 Dec 2008 16:34:21 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8DB7FE050D; Mon, 8 Dec 2008 16:33:08 +0000 (UTC) Received: from rv-out-0708.google.com (rv-out-0708.google.com [209.85.198.241]) by pigeon.gentoo.org (Postfix) with ESMTP id 4807CE050D for ; Mon, 8 Dec 2008 16:33:08 +0000 (UTC) Received: by rv-out-0708.google.com with SMTP id b17so1329648rvf.46 for ; Mon, 08 Dec 2008 08:33:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=c6K2d80gNN9I4dcqdMz2AsjJt8YtGqL9y6W+UdnQwIA=; b=AoKNdEoJw45zMgXgrFCWrDbKdHRSRms3V67RIua3ZrgXpApYMRXE/IJer2WeXa0tG3 Ft68FfP1PtR+J6Hb/S5ivPfGmfq0eWl2NufNOEJbE4Nmn3PFPn0YQgvYrr9m74bQknbA gRUfZiO/U9vr3gH4He5Gto/u6H0khxZkN83k0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=aSyv4fE5fEODcELkshn2zqz14gv4lwkVBqd0oJnabKvEdVPDlTPCXKFyraS5LMbqiQ p5IMssgiCEHounSS9zDsFVvxwhltamv2KmwilCuekL9Mei0Ifj9zPNO2sysOHqtYkzsg wW0Q/Qmy/h4uHMu1LdASXw8Wo4ooVcdnF5tHw= Received: by 10.141.194.6 with SMTP id w6mr965551rvp.257.1228753987847; Mon, 08 Dec 2008 08:33:07 -0800 (PST) Received: by 10.140.188.21 with HTTP; Mon, 8 Dec 2008 08:33:07 -0800 (PST) Message-ID: <90b936c0812080833q1079ea5bsaf48a8b7b703ad64@mail.gmail.com> Date: Mon, 8 Dec 2008 10:33:07 -0600 From: "Jeremy Olexa" Sender: jer.gentoo@gmail.com To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] Proposal for flag-o-matic.eclass (append-ldflags) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 97614900c8dd4d52 X-Archives-Salt: e0e102f4-71c7-40b3-857b-d30b3b3cddc4 X-Archives-Hash: 85f15e1eea15ffcaabdcfc4f15c3a716 Hello, I am seeking a positive code review on the following change to flag-o-matic.eclass, diff is below (reasons are below that): %% cvs diff Index: flag-o-matic.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v retrieving revision 1.126 diff -u -r1.126 flag-o-matic.eclass --- flag-o-matic.eclass 3 Nov 2008 05:52:39 -0000 1.126 +++ flag-o-matic.eclass 25 Nov 2008 18:36:04 -0000 @@ -417,7 +417,8 @@ x="" for x in "$@" ; do - test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}" + test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}" || \ + ewarn "removing ${x} because ${comp} rejected it" done echo "${flags}" @@ -656,7 +657,7 @@ ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS" done - export LDFLAGS="${LDFLAGS} $*" + export LDFLAGS="${LDFLAGS} $(test-flags "$@")" return 0 } Reason: We hit this little gem in Gentoo Prefix when some ebuilds started using flags that non-GNU linkers didn't accept and actually aborted on. For example, the darwin ld does not accept --no-as-needed. So, the initial work-around was to check to see if we had a GNU ld, and only apply if so. (aside, further investigation revealed that GNU and darwin ld are actually pretty non-clever in this regard. For example, the hp-ux linker will just ignore non-valid flags) But this is not very friendly to the lack of Gentoo Prefix developer availability. ;) A convienient side effect of the above patch is that it protects Gentoo users from typos in ebuilds. For example, "append-ldflags --foo" will cause compilation to abort, but with the above patch, a ewarn will be issued instead and compilation will continue. Besides typos, if the GNU ld ever changes in some non-compatible way, there will be less breakage. There will be claims that additional checking to the flags should not be added to Gentoo Linux because it is redundant (Gentoo only uses GNU ld). However, time test-flags "$@" only takes 0m0.017s on my host. I guess this number could be larger on less modern hosts..I don't know. Comments? Good, bad, or otherwise? The Gentoo Prefix team always aims to have as minimal diffs as possible from the gentoo-x86 tree, hence the motivation for this request to review and inclusion into the gentoo-x86 tree. Thanks, Jeremy