All of lore.kernel.org
 help / color / mirror / Atom feed
* [SDK] How to use the gold linker
@ 2020-12-14 11:14 Christian Eggers
  2020-12-14 22:09 ` [OE-core] " Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Eggers @ 2020-12-14 11:14 UTC (permalink / raw)
  To: openembedded-core

Branch: dunfell
Arch: arm

When I set -fuse-ld=gold with the Yocto SDK, the bfd linker is used anyway:

> . /opt/poky-tiny/3.1.4/environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-musleabi
> ${CC} -fuse-ld=gold -Wl,--threads -o test test.c
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: unrecognized option '--threads'
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: use the --help option for usage information

When I call the "real-ld" with -h, I can see that it's the BFD linker.

> ${CC} -print-prog-name=ld
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld

> ${CC} -fuse-ld=bfd -print-prog-name=ld
ld.bfd

> ${CC} -fuse-ld=gold -print-prog-name=ld
ld.gold

Compared to other cross toolchains I use, the output of the previous two commands
miss the full path to the linker. The gold linker is part of my SDK:

> arm-poky-linux-musleabi-ld.gold --help
Usage: arm-poky-linux-musleabi-ld.gold [options] file...
Options:
  --help                      Report usage information
...

How can I use the gold linker from gcc (without making it default)?

regards
Christian



________________________________
 [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] <https://microsites.arri.com/stellar/>

Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [SDK] How to use the gold linker
  2020-12-14 11:14 [SDK] How to use the gold linker Christian Eggers
@ 2020-12-14 22:09 ` Khem Raj
       [not found]   ` <CABcZAN=QdWzV=LObrdHMWfcDx_1VV3Ce-i_nYL3H7WYUcCtSSA@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2020-12-14 22:09 UTC (permalink / raw)
  To: openembedded-core



On 12/14/20 3:14 AM, Christian Eggers wrote:
> Branch: dunfell
> Arch: arm
> 
> When I set -fuse-ld=gold with the Yocto SDK, the bfd linker is used anyway:
> 
>> . /opt/poky-tiny/3.1.4/environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-musleabi
>> ${CC} -fuse-ld=gold -Wl,--threads -o test test.c
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: unrecognized option '--threads'
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld: use the --help option for usage information
> 
> When I call the "real-ld" with -h, I can see that it's the BFD linker.
> 
>> ${CC} -print-prog-name=ld
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld
> 
>> ${CC} -fuse-ld=bfd -print-prog-name=ld
> ld.bfd
> 
>> ${CC} -fuse-ld=gold -print-prog-name=ld
> ld.gold
> 
> Compared to other cross toolchains I use, the output of the previous two commands
> miss the full path to the linker. The gold linker is part of my SDK:
> 
>> arm-poky-linux-musleabi-ld.gold --help
> Usage: arm-poky-linux-musleabi-ld.gold [options] file...
> Options:
>    --help                      Report usage information
> ...
> 
> How can I use the gold linker from gcc (without making it default)?
> 

This is kind of known and kind of works as intended, see
https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-cross-canadian.inc#n132

You might want to try commenting it out and see if it works for you in 
resulting SDK
> regards
> Christian
> 
> 
> 
> ________________________________
>   [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] <https://microsites.arri.com/stellar/>
> 
> Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.
> 
> Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
> Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
> Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
> Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
> Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [SDK] How to use the gold linker
       [not found]   ` <CABcZAN=QdWzV=LObrdHMWfcDx_1VV3Ce-i_nYL3H7WYUcCtSSA@mail.gmail.com>
@ 2020-12-15 17:15     ` Khem Raj
  2020-12-18 11:30       ` Christian Eggers
  0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2020-12-15 17:15 UTC (permalink / raw)
  To: Christopher Larson; +Cc: Patches and discussions about the oe-core layer



On 12/15/20 8:50 AM, Christopher Larson wrote:
> This can be fixed via two changes, first removing real-ld, then adding 
> the missing links to fix -fuse-ld=. I have this in one of my 
> not-yet-submitted bbappends:
> 
>      # Remove real-ld, as it prevents checking for ld or gold in the 
> search path
>      rm -f ${dest}real-ld$suffix
>      # Then add links to fix builds with -fuse-ld=
>      ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld.gold$suffix 
> ${dest}ld.gold$suffix
>      ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld.bfd$suffix ${dest}ld.bfd$suffix
> 

right this looks ok. Can you submit this for upstreaming please

> On Mon, Dec 14, 2020 at 3:09 PM Khem Raj <raj.khem@gmail.com 
> <mailto:raj.khem@gmail.com>> wrote:
> 
> 
> 
>     On 12/14/20 3:14 AM, Christian Eggers wrote:
>      > Branch: dunfell
>      > Arch: arm
>      >
>      > When I set -fuse-ld=gold with the Yocto SDK, the bfd linker is
>     used anyway:
>      >
>      >> .
>     /opt/poky-tiny/3.1.4/environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-musleabi
>      >> ${CC} -fuse-ld=gold -Wl,--threads -o test test.c
>      >
>     /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld:
>     unrecognized option '--threads'
>      >
>     /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/real-ld:
>     use the --help option for usage information
>      >
>      > When I call the "real-ld" with -h, I can see that it's the BFD
>     linker.
>      >
>      >> ${CC} -print-prog-name=ld
>      >
>     /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld
>      >
>      >> ${CC} -fuse-ld=bfd -print-prog-name=ld
>      > ld.bfd
>      >
>      >> ${CC} -fuse-ld=gold -print-prog-name=ld
>      > ld.gold
>      >
>      > Compared to other cross toolchains I use, the output of the
>     previous two commands
>      > miss the full path to the linker. The gold linker is part of my SDK:
>      >
>      >> arm-poky-linux-musleabi-ld.gold --help
>      > Usage: arm-poky-linux-musleabi-ld.gold [options] file...
>      > Options:
>      >    --help                      Report usage information
>      > ...
>      >
>      > How can I use the gold linker from gcc (without making it default)?
>      >
> 
>     This is kind of known and kind of works as intended, see
>     https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-cross-canadian.inc#n132
>     <https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-cross-canadian.inc#n132>
> 
>     You might want to try commenting it out and see if it works for you in
>     resulting SDK
>      > regards
>      > Christian
>      >
>      >
>      >
>      > ________________________________
>      > 
>       [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg <http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg>] <https://microsites.arri.com/stellar/ <https://microsites.arri.com/stellar/>>
>      >
>      > Get all the latest information from www.arri.com
>     <http://www.arri.com><https://www.arri.com/
>     <https://www.arri.com/>>, Facebook<https://www.facebook.com/TeamARRI
>     <https://www.facebook.com/TeamARRI>>,
>     Twitter<https://twitter.com/ARRIChannel
>     <https://twitter.com/ARRIChannel>>,
>     Instagram<https://instagram.com/arri <https://instagram.com/arri>>
>     and YouTube<https://www.youtube.com/user/ARRIChannel
>     <https://www.youtube.com/user/ARRIChannel>>.
>      >
>      > Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
>      > Sitz: München - Registergericht: Amtsgericht München -
>     Handelsregisternummer: HRA 57918
>      > Persönlich haftender Gesellschafter: Arnold & Richter Cine
>     Technik GmbH
>      > Sitz: München - Registergericht: Amtsgericht München -
>     Handelsregisternummer: HRB 54477
>      > Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter
>     Trauninger; Markus Zeiler
>      >
>      >
>      >
>      >
>      >
> 
>     
> 
> 
> 
> -- 
> Christopher Larson
> kergoth at gmail dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Senior Software Engineer, Mentor Graphics

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [SDK] How to use the gold linker
  2020-12-15 17:15     ` Khem Raj
@ 2020-12-18 11:30       ` Christian Eggers
  2020-12-18 16:32         ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Eggers @ 2020-12-18 11:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj, Christopher Larson

Hi Khem, hi Christopher,

On Tuesday, 15 December 2020, 18:15:52 CET, Khem Raj wrote:
>
> On 12/15/20 8:50 AM, Christopher Larson wrote:
> > This can be fixed via two changes, first removing real-ld, then adding
> > the missing links to fix -fuse-ld=. I have this in one of my
> > not-yet-submitted bbappends:
> >
> >      # Remove real-ld, as it prevents checking for ld or gold in the
> > search path
> >      rm -f ${dest}real-ld$suffix
> >      # Then add links to fix builds with -fuse-ld=
> >      ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld.gold$suffix
> > ${dest}ld.gold$suffix
> >      ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld.bfd$suffix ${dest}ld.bfd$suffix
> >
>
> right this looks ok. Can you submit this for upstreaming please

while this change works "fine for me" (I can now use ld.gold which is about
3 times faster for my project), there are side effects:

> ${CC} -fuse-ld=bfd -print-prog-name=ld
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld.bfd

> ${CC} -fuse-ld=bfd -o test test.c
works fine

> ${CC} -fuse-ld=gold -print-prog-name=ld
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld.gold

> ${CC} -fuse-ld=gold -o test test.c
also works fine

> ${CC} print-prog-name=ld
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld

> ${CC} -o test test.c
collect2: fatal error: cannot find ‘ld’
compilation terminated.

> ls -l /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld
/opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld -> ../../../../../bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-ld



regards
Christian




________________________________
 [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] <https://microsites.arri.com/stellar/>

Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [SDK] How to use the gold linker
  2020-12-18 11:30       ` Christian Eggers
@ 2020-12-18 16:32         ` Khem Raj
  0 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2020-12-18 16:32 UTC (permalink / raw)
  To: Christian Eggers, openembedded-core; +Cc: Christopher Larson



On 12/18/20 3:30 AM, Christian Eggers wrote:
> Hi Khem, hi Christopher,
> 
> On Tuesday, 15 December 2020, 18:15:52 CET, Khem Raj wrote:
>>
>> On 12/15/20 8:50 AM, Christopher Larson wrote:
>>> This can be fixed via two changes, first removing real-ld, then adding
>>> the missing links to fix -fuse-ld=. I have this in one of my
>>> not-yet-submitted bbappends:
>>>
>>>       # Remove real-ld, as it prevents checking for ld or gold in the
>>> search path
>>>       rm -f ${dest}real-ld$suffix
>>>       # Then add links to fix builds with -fuse-ld=
>>>       ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld.gold$suffix
>>> ${dest}ld.gold$suffix
>>>       ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld.bfd$suffix ${dest}ld.bfd$suffix
>>>
>>
>> right this looks ok. Can you submit this for upstreaming please
> 
> while this change works "fine for me" (I can now use ld.gold which is about
> 3 times faster for my project), there are side effects:
> 
>> ${CC} -fuse-ld=bfd -print-prog-name=ld
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld.bfd
> 
>> ${CC} -fuse-ld=bfd -o test test.c
> works fine
> 
>> ${CC} -fuse-ld=gold -print-prog-name=ld
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld.gold
> 
>> ${CC} -fuse-ld=gold -o test test.c
> also works fine
> 
>> ${CC} print-prog-name=ld
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld
> 
>> ${CC} -o test test.c
> collect2: fatal error: cannot find ‘ld’
> compilation terminated.
> 
>> ls -l /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld
> /opt/poky-tiny/3.1.4/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/9.3.0/ld -> ../../../../../bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-ld
> 

we could patch it out in gcc sources so always use the real one because 
the default is one of gold or bfd linker anyway
> 
> 
> regards
> Christian
> 
> 
> 
> 
> ________________________________
>   [http://assets.arri.com/media/sign/2020-04-03-E-mail-signature-Stellar2_V1.jpg] <https://microsites.arri.com/stellar/>
> 
> Get all the latest information from www.arri.com<https://www.arri.com/>, Facebook<https://www.facebook.com/TeamARRI>, Twitter<https://twitter.com/ARRIChannel>, Instagram<https://instagram.com/arri> and YouTube<https://www.youtube.com/user/ARRIChannel>.
> 
> Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
> Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
> Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
> Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
> Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-18 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 11:14 [SDK] How to use the gold linker Christian Eggers
2020-12-14 22:09 ` [OE-core] " Khem Raj
     [not found]   ` <CABcZAN=QdWzV=LObrdHMWfcDx_1VV3Ce-i_nYL3H7WYUcCtSSA@mail.gmail.com>
2020-12-15 17:15     ` Khem Raj
2020-12-18 11:30       ` Christian Eggers
2020-12-18 16:32         ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.