Patchwork [RFC] binutils: allow distro to select gold as default cross-linker

login
register
mail settings
Submitter Phil Blundell
Date June 14, 2011, 3:30 p.m.
Message ID <1308065443.25285.268.camel@phil-desktop>
Download mbox | patch
Permalink /patch/5929/
State New, archived
Headers show

Comments

Phil Blundell - June 14, 2011, 3:30 p.m.
This is not particularly pretty but I couldn't think of any obviously
better way of doing it.  Any suggestions?

Signed-off-by: Phil Blundell <philb@gnu.org>
---
 meta/recipes-devtools/binutils/binutils-cross.inc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Koen Kooi - June 14, 2011, 3:38 p.m.
Op 14 jun 2011, om 17:30 heeft Phil Blundell het volgende geschreven:

> This is not particularly pretty but I couldn't think of any obviously
> better way of doing it.  Any suggestions?
> 
> Signed-off-by: Phil Blundell <philb@gnu.org>
> ---
> meta/recipes-devtools/binutils/binutils-cross.inc |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc
> index 4b90972..5a41970 100644
> --- a/meta/recipes-devtools/binutils/binutils-cross.inc
> +++ b/meta/recipes-devtools/binutils/binutils-cross.inc
> @@ -5,7 +5,8 @@ EXTRA_OECONF = "--with-sysroot=${STAGING_DIR_TARGET} \
>                 --program-prefix=${TARGET_PREFIX} \
>                 --disable-install-libbfd \
>                 --disable-werror \
> -                --enable-poison-system-directories"
> +                --enable-poison-system-directories \
> +		${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default', '', d)}"

Out of curiousity, how well does gold work nowadays? Last I remember hearing of it was in its x86-only days.

regards,

Koen
Khem Raj - June 15, 2011, 2:42 a.m.
On 06/14/2011 08:30 AM, Phil Blundell wrote:
> This is not particularly pretty but I couldn't think of any obviously
> better way of doing it.  Any suggestions?
>
> Signed-off-by: Phil Blundell<philb@gnu.org>
> ---
>   meta/recipes-devtools/binutils/binutils-cross.inc |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc
> index 4b90972..5a41970 100644
> --- a/meta/recipes-devtools/binutils/binutils-cross.inc
> +++ b/meta/recipes-devtools/binutils/binutils-cross.inc
> @@ -5,7 +5,8 @@ EXTRA_OECONF = "--with-sysroot=${STAGING_DIR_TARGET} \
>                   --program-prefix=${TARGET_PREFIX} \
>                   --disable-install-libbfd \
>                   --disable-werror \
> -                --enable-poison-system-directories"
> +                --enable-poison-system-directories \
> +		${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default', '', d)}"
>
>   do_install () {
>   	oe_runmake 'DESTDIR=${D}' install

I think we need to document this distro feature somewhere as well. We 
need the same for target binutils too.
Khem Raj - June 15, 2011, 2:44 a.m.
On 06/14/2011 08:38 AM, Koen Kooi wrote:
>
> Op 14 jun 2011, om 17:30 heeft Phil Blundell het volgende geschreven:
>
>> This is not particularly pretty but I couldn't think of any obviously
>> better way of doing it.  Any suggestions?
>>
>> Signed-off-by: Phil Blundell<philb@gnu.org>
>> ---
>> meta/recipes-devtools/binutils/binutils-cross.inc |    3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc
>> index 4b90972..5a41970 100644
>> --- a/meta/recipes-devtools/binutils/binutils-cross.inc
>> +++ b/meta/recipes-devtools/binutils/binutils-cross.inc
>> @@ -5,7 +5,8 @@ EXTRA_OECONF = "--with-sysroot=${STAGING_DIR_TARGET} \
>>                  --program-prefix=${TARGET_PREFIX} \
>>                  --disable-install-libbfd \
>>                  --disable-werror \
>> -                --enable-poison-system-directories"
>> +                --enable-poison-system-directories \
>> +		${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default', '', d)}"
>
> Out of curiousity, how well does gold work nowadays? Last I remember hearing of it was in its x86-only days.
>

it works well on arm in fact link times are way better on some 
(especially C++) applications using gold. We can try to use gold for 
x86, x86_64 and arm to start with.

> regards,
>
> Koen
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Phil Blundell - June 15, 2011, 8:04 a.m.
On Tue, 2011-06-14 at 17:38 +0200, Koen Kooi wrote:
> Out of curiousity, how well does gold work nowadays? Last I remember hearing of it was in its x86-only days.

It works for arm, x86 and amd64 which are the only targets that I've
tried for myself.  I suspect it doesn't support some of the more obscure
architectures.  Obviously it doesn't (and isn't intended to) support non
ELF targets, though I can't think of any such in OE.

One slightly annoying thing is that (e)glibc isn't buildable with gold
because the linker scripts don't work.  So a little bit of patching is
going to be needed to have it use ld.bfd there.  There might be some
other packages with similar issues but I haven't come across any yet.

p.
Phil Blundell - June 15, 2011, 11:30 a.m.
On Tue, 2011-06-14 at 19:42 -0700, Khem Raj wrote:
> I think we need to document this distro feature somewhere as well.

Yeah, agreed.  Any suggestions for "somewhere"?  Traditionally this kind
of thing has been sort-of-documented in local.conf.sample{.extended} but
that doesn't seem like a terribly good model for the future.  

If the wiki were ever to become editable then I guess a page there might
be a good place, perhaps.

>We need the same for target binutils too.

Yeah, though it wants slightly different handling in the target case.  I
was planning to leave that for someone who actually uses on-target
binutils to sort out :-)

There's also the sdk case which I haven't looked at either.  I'm not
sure to what extent that needs special handling.

p.

Patch

diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc
index 4b90972..5a41970 100644
--- a/meta/recipes-devtools/binutils/binutils-cross.inc
+++ b/meta/recipes-devtools/binutils/binutils-cross.inc
@@ -5,7 +5,8 @@  EXTRA_OECONF = "--with-sysroot=${STAGING_DIR_TARGET} \
                 --program-prefix=${TARGET_PREFIX} \
                 --disable-install-libbfd \
                 --disable-werror \
-                --enable-poison-system-directories"
+                --enable-poison-system-directories \
+		${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default', '', d)}"
 
 do_install () {
 	oe_runmake 'DESTDIR=${D}' install