All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] go: Always pass interpreter to linker
@ 2022-04-11 12:35 Joerg Vehlow
  2022-04-11 13:30 ` [OE-core] " Jose Quaresma
  0 siblings, 1 reply; 6+ messages in thread
From: Joerg Vehlow @ 2022-04-11 12:35 UTC (permalink / raw)
  To: openembedded-core, raj.khem; +Cc: Joerg Vehlow

From: Joerg Vehlow <joerg.vehlow@aox.de>

When gos internal linker is used, it uses hardcoded paths to the
interpreter (dynamic linker). For x86_64 this hardcoded path is
/lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
is /lib64/ld-linux-x86-64.so.2.
Most of the time, the internal linker is not used and binutils linker
sets the correct path, but sometimes the internal linker is used and
the resulting binary will not work on x86_64.

To ensure the path is always correct, pass  it to the linker.

Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de>
---
 meta/classes/go.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 9c4c92bffd..df8d4db26d 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -1,4 +1,5 @@
 inherit goarch
+inherit linuxloader
 
 GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
 
@@ -44,7 +45,7 @@ GO_LINKMODE ?= ""
 GO_LINKMODE:class-nativesdk = "--linkmode=external"
 GO_LINKMODE:class-native = "--linkmode=external"
 GO_EXTRA_LDFLAGS ?= ""
-GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
+GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -I ${@get_linuxloader(d)} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
 export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
 export GOPATH_OMIT_IN_ACTIONID ?= "1"
 export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
-- 
2.25.1



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

* Re: [OE-core] [PATCH] go: Always pass interpreter to linker
  2022-04-11 12:35 [PATCH] go: Always pass interpreter to linker Joerg Vehlow
@ 2022-04-11 13:30 ` Jose Quaresma
  2022-04-11 13:32   ` Joerg Vehlow
  2022-04-11 16:04   ` Khem Raj
  0 siblings, 2 replies; 6+ messages in thread
From: Jose Quaresma @ 2022-04-11 13:30 UTC (permalink / raw)
  To: J?rg Vehlow; +Cc: OE-core, Khem Raj, Joerg Vehlow

[-- Attachment #1: Type: text/plain, Size: 2274 bytes --]

J?rg Vehlow <lkml@jv-coder.de> escreveu no dia segunda, 11/04/2022 à(s)
13:35:

> From: Joerg Vehlow <joerg.vehlow@aox.de>
>
> When gos internal linker is used, it uses hardcoded paths to the
> interpreter (dynamic linker). For x86_64 this hardcoded path is
> /lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
> is /lib64/ld-linux-x86-64.so.2.
>

Is this correct? The first path is the seme one of the second.

Jose


> Most of the time, the internal linker is not used and binutils linker
> sets the correct path, but sometimes the internal linker is used and
> the resulting binary will not work on x86_64.
>
> To ensure the path is always correct, pass  it to the linker.
>
> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de>
> ---
>  meta/classes/go.bbclass | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
> index 9c4c92bffd..df8d4db26d 100644
> --- a/meta/classes/go.bbclass
> +++ b/meta/classes/go.bbclass
> @@ -1,4 +1,5 @@
>  inherit goarch
> +inherit linuxloader
>
>  GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
>
> @@ -44,7 +45,7 @@ GO_LINKMODE ?= ""
>  GO_LINKMODE:class-nativesdk = "--linkmode=external"
>  GO_LINKMODE:class-native = "--linkmode=external"
>  GO_EXTRA_LDFLAGS ?= ""
> -GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_EXTRA_LDFLAGS}
> -extldflags '${GO_EXTLDFLAGS}'"'
> +GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -I
> ${@get_linuxloader(d)} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
>  export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
>  export GOPATH_OMIT_IN_ACTIONID ?= "1"
>  export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#164219):
> https://lists.openembedded.org/g/openembedded-core/message/164219
> Mute This Topic: https://lists.openembedded.org/mt/90393660/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
Best regards,

José Quaresma

[-- Attachment #2: Type: text/html, Size: 3815 bytes --]

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

* Re: [OE-core] [PATCH] go: Always pass interpreter to linker
  2022-04-11 13:30 ` [OE-core] " Jose Quaresma
@ 2022-04-11 13:32   ` Joerg Vehlow
  2022-04-11 16:04   ` Khem Raj
  1 sibling, 0 replies; 6+ messages in thread
From: Joerg Vehlow @ 2022-04-11 13:32 UTC (permalink / raw)
  To: Jose Quaresma; +Cc: OE-core, Khem Raj, Joerg Vehlow

Hi Jose,

Am 4/11/2022 um 3:30 PM schrieb Jose Quaresma:
> 
> 
> J?rg Vehlow <lkml@jv-coder.de <mailto:lkml@jv-coder.de>> escreveu no dia
> segunda, 11/04/2022 à(s) 13:35:
> 
>     From: Joerg Vehlow <joerg.vehlow@aox.de <mailto:joerg.vehlow@aox.de>>
> 
>     When gos internal linker is used, it uses hardcoded paths to the
>     interpreter (dynamic linker). For x86_64 this hardcoded path is
>     /lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
>     is /lib64/ld-linux-x86-64.so.2.
> 
> 
> Is this correct? The first path is the seme one of the second.
Yes... of course this is wrong. /lib/ld-linux-x86-64.so.2 is the default
linker path for yocto on x86_64

Sorry about that

Joerg



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

* Re: [OE-core] [PATCH] go: Always pass interpreter to linker
  2022-04-11 13:30 ` [OE-core] " Jose Quaresma
  2022-04-11 13:32   ` Joerg Vehlow
@ 2022-04-11 16:04   ` Khem Raj
  2022-04-14  5:24     ` Joerg Vehlow
  1 sibling, 1 reply; 6+ messages in thread
From: Khem Raj @ 2022-04-11 16:04 UTC (permalink / raw)
  To: Jose Quaresma; +Cc: J?rg Vehlow, OE-core, Joerg Vehlow

On Mon, Apr 11, 2022 at 6:30 AM Jose Quaresma <quaresma.jose@gmail.com> wrote:
>
>
>
> J?rg Vehlow <lkml@jv-coder.de> escreveu no dia segunda, 11/04/2022 à(s) 13:35:
>>
>> From: Joerg Vehlow <joerg.vehlow@aox.de>
>>
>> When gos internal linker is used, it uses hardcoded paths to the
>> interpreter (dynamic linker). For x86_64 this hardcoded path is
>> /lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
>> is /lib64/ld-linux-x86-64.so.2.
>
>
> Is this correct? The first path is the seme one of the second.

its a typo, Sadly we do differ in baselib naming convention on x86_64
( without multilib )
compared to other distributions which are inherently multilib and use
/lib64 OE instead uses
/lib when multilib is not enabled but lib64/ when multilib is enabled.

>
> Jose
>
>>
>> Most of the time, the internal linker is not used and binutils linker
>> sets the correct path, but sometimes the internal linker is used and
>> the resulting binary will not work on x86_64.
>>
>> To ensure the path is always correct, pass  it to the linker.
>>
>> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de>
>> ---
>>  meta/classes/go.bbclass | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
>> index 9c4c92bffd..df8d4db26d 100644
>> --- a/meta/classes/go.bbclass
>> +++ b/meta/classes/go.bbclass
>> @@ -1,4 +1,5 @@
>>  inherit goarch
>> +inherit linuxloader
>>
>>  GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
>>
>> @@ -44,7 +45,7 @@ GO_LINKMODE ?= ""
>>  GO_LINKMODE:class-nativesdk = "--linkmode=external"
>>  GO_LINKMODE:class-native = "--linkmode=external"
>>  GO_EXTRA_LDFLAGS ?= ""
>> -GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
>> +GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -I ${@get_linuxloader(d)} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
>>  export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
>>  export GOPATH_OMIT_IN_ACTIONID ?= "1"
>>  export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
>> --
>> 2.25.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#164219): https://lists.openembedded.org/g/openembedded-core/message/164219
>> Mute This Topic: https://lists.openembedded.org/mt/90393660/5052612
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [quaresma.jose@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>
>
> --
> Best regards,
>
> José Quaresma


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

* Re: [OE-core] [PATCH] go: Always pass interpreter to linker
  2022-04-11 16:04   ` Khem Raj
@ 2022-04-14  5:24     ` Joerg Vehlow
  2022-04-29 12:45       ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Joerg Vehlow @ 2022-04-14  5:24 UTC (permalink / raw)
  To: Khem Raj, Jose Quaresma; +Cc: OE-core, Joerg Vehlow

Hi,

Am 4/11/2022 um 6:04 PM schrieb Khem Raj:
> On Mon, Apr 11, 2022 at 6:30 AM Jose Quaresma <quaresma.jose@gmail.com> wrote:
>>
>>
>>
>> J?rg Vehlow <lkml@jv-coder.de> escreveu no dia segunda, 11/04/2022 à(s) 13:35:
>>>
>>> From: Joerg Vehlow <joerg.vehlow@aox.de>
>>>
>>> When gos internal linker is used, it uses hardcoded paths to the
>>> interpreter (dynamic linker). For x86_64 this hardcoded path is
>>> /lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
>>> is /lib64/ld-linux-x86-64.so.2.
>>
>>
>> Is this correct? The first path is the seme one of the second.
> 
> its a typo, Sadly we do differ in baselib naming convention on x86_64
> ( without multilib )
> compared to other distributions which are inherently multilib and use
> /lib64 OE instead uses
> /lib when multilib is not enabled but lib64/ when multilib is enabled.

Any comment on the content of the patch or do I have to send a v2 with a
fixed commit message?

Thanks,
Joerg


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

* Re: [OE-core] [PATCH] go: Always pass interpreter to linker
  2022-04-14  5:24     ` Joerg Vehlow
@ 2022-04-29 12:45       ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2022-04-29 12:45 UTC (permalink / raw)
  To: J?rg Vehlow, Khem Raj, Jose Quaresma; +Cc: OE-core, Joerg Vehlow

On Thu, 2022-04-14 at 07:24 +0200, J?rg Vehlow wrote:
> Hi,
> 
> Am 4/11/2022 um 6:04 PM schrieb Khem Raj:
> > On Mon, Apr 11, 2022 at 6:30 AM Jose Quaresma <quaresma.jose@gmail.com> wrote:
> > > 
> > > 
> > > 
> > > J?rg Vehlow <lkml@jv-coder.de> escreveu no dia segunda, 11/04/2022 à(s) 13:35:
> > > > 
> > > > From: Joerg Vehlow <joerg.vehlow@aox.de>
> > > > 
> > > > When gos internal linker is used, it uses hardcoded paths to the
> > > > interpreter (dynamic linker). For x86_64 this hardcoded path is
> > > > /lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path
> > > > is /lib64/ld-linux-x86-64.so.2.
> > > 
> > > 
> > > Is this correct? The first path is the seme one of the second.
> > 
> > its a typo, Sadly we do differ in baselib naming convention on x86_64
> > ( without multilib )
> > compared to other distributions which are inherently multilib and use
> > /lib64 OE instead uses
> > /lib when multilib is not enabled but lib64/ when multilib is enabled.
> 
> Any comment on the content of the patch or do I have to send a v2 with a
> fixed commit message?

It merged:

https://git.yoctoproject.org/poky/commit/?id=460012e04a89e0b84fd5949c9a2229ef46e7a341

Cheers,

Richard


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

end of thread, other threads:[~2022-04-29 12:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 12:35 [PATCH] go: Always pass interpreter to linker Joerg Vehlow
2022-04-11 13:30 ` [OE-core] " Jose Quaresma
2022-04-11 13:32   ` Joerg Vehlow
2022-04-11 16:04   ` Khem Raj
2022-04-14  5:24     ` Joerg Vehlow
2022-04-29 12:45       ` Richard Purdie

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.