Skip to contentSkip to conversation

u-boot do_compile should be reentrant even with ld-is-gold

PATCH In review Martin Jansa 3 participants 14 messages Aug 1, 2012 – Aug 2, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

this commit:

reexecuting do_compile in u-boot causes .bfd being appended multiple times and resulting in errors like:
/bin/bash: arm-oe-linux-gnueabi-ld.bfd.bfd.bfd: command not found

Regex should be updated or patch like this:
http://git.shr-project.org/git/?p=meta-smartphone.git;a=blob;f=meta-nokia/recipes-bsp/u-boot/u-boot/0001-config-Always-use-GNU-ld.patch;h=2564d1d456d46651778aec9113cb2515f035ba90;hb=HEAD
applied instead of sed, especially if someone sends it upstream (maybe it's already resolved there - I haven't checked)

commit 2e79fcd673dadeab6358fe22d47c8534c14de03e

Author: Otavio Salvador <[email protected]>
Date:   Sun Apr 22 15:01:32 2012 -0300

u-boot.inc: fix compilation when using 'gold' as linker

meta/recipes-bsp/u-boot/u-boot.inc +3 -1
index 0445c34..a13eddc 100644
@@ -36,6 +36,10 @@ SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}"
 SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
 
 do_compile () {
+       if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
+               sed -i 's/$(CROSS_COMPILE)ld/$(CROSS_COMPILE)ld.bfd/g' config.mk
+       fi
 
 
-- 

Martin 'JaMa' Jansa jabber: [email protected]

#1 lore raw
Quoted 4 lines · Martin Jansa

Hi,

this commit:

Quoted 8 lines

reexecuting do_compile in u-boot causes .bfd being appended multiple times and resulting in errors like:
/bin/bash: arm-oe-linux-gnueabi-ld.bfd.bfd.bfd: command not found

Regex should be updated or patch like this:
http://git.shr-project.org/git/?p=meta-smartphone.git;a=blob;f=meta-nokia/recipes-bsp/u-boot/u-boot/0001-config-Always-use-GNU-ld.patch;h=2564d1d456d46651778aec9113cb2515f035ba90;hb=HEAD
applied instead of sed, especially if someone sends it upstream (maybe it's already resolved there - I haven't checked)

well not exactly like this one as this is causing
/bin/sh: 1: Syntax error: Bad fd number
probably from ">&" in dash

Quoted 23 lines

commit 2e79fcd673dadeab6358fe22d47c8534c14de03e

Author: Otavio Salvador <[email protected]>
Date:   Sun Apr 22 15:01:32 2012 -0300

u-boot.inc: fix compilation when using 'gold' as linker

meta/recipes-bsp/u-boot/u-boot.inc +3 -1
index 0445c34..a13eddc 100644
@@ -36,6 +36,10 @@ SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}"
 SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
 
 do_compile () {
+       if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
+               sed -i 's/$(CROSS_COMPILE)ld/$(CROSS_COMPILE)ld.bfd/g' config.mk
+       fi
 
 
-- 

Martin 'JaMa' Jansa jabber: [email protected]

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw
Quoted 3 lines · Martin Jansa

well not exactly like this one as this is causing
/bin/sh: 1: Syntax error: Bad fd number
probably from ">&" in dash

yes. I swear I have since fixed this patch this seems to be an older version did you look into meta-ti/master ?

#3 lore raw
Quoted 10 lines · Khem Raj
Quoted 3 lines · Martin Jansa

well not exactly like this one as this is causing
/bin/sh: 1: Syntax error: Bad fd number
probably from ">&" in dash

yes. I swear I have since fixed this patch this seems to be an older version did you look into meta-ti/master ?

Yes, your patch is fixed in meta-ti, but cannot be used together with Otavio's patch to u-boot.inc.

meta-ti is fine because it provides own u-boot.inc, but with your patch and u-boot.inc from oe-core it ends like this

config.mk:
+LD = $(call exists_bfd_ld, "$(CROSS_COMPILE)ld.bfd.bfd","$(CROSS_COMPILE)ld.bfd")

Quoted 1 line · Otavio Salvador

Wouldn't be better to grep for 'ld.bfd' and apply it *only* if not is not found?

no need for grep, something like
- sed -i 's/$(CROSS_COMPILE)ld/$(CROSS_COMPILE)ld.bfd/g' config.mk
+ sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
should be enough, I will test and send patch..

Cheers,

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#4 lore raw

PATCH 1/1 u-boot.inc: fix regexp used when ld-is-gold

* with old regexp it wasn't reentrant, causing stuff like this:

  -LD     = $(CROSS_COMPILE)ld
  +LD     = $(CROSS_COMPILE)ld.bfd.bfd
  -LDR    = $(CROSS_COMPILE)ldr
  +LDR    = $(CROSS_COMPILE)ld.bfd.bfdr

when do_compile was reexecuted, also breaking LDR variable and
http://git.yoctoproject.org/cgit/cgit.cgi/meta-ti/tree/recipes-bsp/u-boot/u-boot/0001-config-Always-use-GNU-ld.patch
when it was used together with u-boot.inc from oe-core (meta-ti is using own u-boot.inc)

* This patch is also better solution to ld-is-gold problem then regexp in metadata.

---
 meta/recipes-bsp/u-boot/u-boot.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
index 42bdde9..a8642f0 100644
@@ -34,7 +34,7 @@ SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
 
 do_compile () {
 	if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
-		sed -i 's/$(CROSS_COMPILE)ld/$(CROSS_COMPILE)ld.bfd/g' config.mk
+		sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
 	fi
 
 	unset LDFLAGS
Signature · 1 line
1.7.8.6
#5 lore raw

Re: [PATCH] u-boot.inc: fix regexp used when ld-is-gold

Quoted 10 lines · Martin Jansa

* with old regexp it wasn't reentrant, causing stuff like this:

 -LD     = $(CROSS_COMPILE)ld
 +LD     = $(CROSS_COMPILE)ld.bfd.bfd
 -LDR    = $(CROSS_COMPILE)ldr
 +LDR    = $(CROSS_COMPILE)ld.bfd.bfdr

when do_compile was reexecuted, also breaking LDR variable and
http://git.yoctoproject.org/cgit/cgit.cgi/meta-ti/tree/recipes-bsp/u-boot/u-boot/0001-config-Always-use-GNU-ld.patch
when it was used together with u-boot.inc from oe-core (meta-ti is using own u-boot.inc)

* This patch is also better solution to ld-is-gold problem then regexp in metadata.

It would be rather beneficial to import the u-boot patch to accommodate gold from meta-ti this helps in creating a uniform solution to same problem. u-boot patch should be upstreamed too.

Quoted 27 lines

---
meta/recipes-bsp/u-boot/u-boot.inc | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
index 42bdde9..a8642f0 100644
@@ -34,7 +34,7 @@ SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
 
 do_compile () {
 	if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
-		sed -i 's/$(CROSS_COMPILE)ld/$(CROSS_COMPILE)ld.bfd/g' config.mk
+		sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
 	fi
 
 	unset LDFLAGS
Signature · 7 lines
1.7.8.6


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
#6 lore raw

Re: [PATCH] u-boot.inc: fix regexp used when ld-is-gold

Quoted 12 lines · Khem Raj
Quoted 9 lines · Martin Jansa

* with old regexp it wasn't reentrant, causing stuff like this:

 -LD     = $(CROSS_COMPILE)ld
 +LD     = $(CROSS_COMPILE)ld.bfd.bfd
 -LDR    = $(CROSS_COMPILE)ldr
 +LDR    = $(CROSS_COMPILE)ld.bfd.bfdr

when do_compile was reexecuted, also breaking LDR variable and
http://git.yoctoproject.org/cgit/cgit.cgi/meta-ti/tree/recipes-bsp/u-boot/u-boot/0001-config-Always-use-GNU-ld.patch
when it was used together with u-boot.inc from oe-core (meta-ti is using own u-boot.inc)

Quoted 4 lines
Quoted 1 line

* This patch is also better solution to ld-is-gold problem then regexp in metadata.

It would be rather beneficial to import the u-boot patch to accommodate gold from meta-ti this helps in creating a uniform solution to same problem. u-boot patch should be upstreamed too.

Then upstream it :)

Quoted 34 lines
Quoted 28 lines

---
meta/recipes-bsp/u-boot/u-boot.inc | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-bsp/u-boot/u-boot.inc +1 -1
index 42bdde9..a8642f0 100644
@@ -34,7 +34,7 @@ SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
 
 do_compile () {
 	if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
-		sed -i 's/$(CROSS_COMPILE)ld/$(CROSS_COMPILE)ld.bfd/g' config.mk
+		sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
 	fi
 
 	unset LDFLAGS
Signature · 7 lines
1.7.8.6


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#7 lore raw

Re: [PATCH] u-boot.inc: fix regexp used when ld-is-gold

In reply to Khem Raj
Quoted 2 lines · Khem Raj

It would be rather beneficial to import the u-boot patch to accommodate gold from meta-ti this helps in creating a uniform solution to same problem. u-boot patch should be upstreamed too.

I'll port this patch to U-Boot master and send it for inclusion.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#8 lore raw
In reply to Martin Jansa
Quoted 9 lines · Martin Jansa
Quoted 8 lines · Khem Raj
Quoted 3 lines · Martin Jansa

well not exactly like this one as this is causing
/bin/sh: 1: Syntax error: Bad fd number
probably from ">&" in dash

Quoted 8 lines
Quoted 2 lines

yes. I swear I have since fixed this patch this seems to be an older version did you look into meta-ti/master ?

Yes, your patch is fixed in meta-ti, but cannot be used together with Otavio's patch to u-boot.inc.

meta-ti is fine because it provides own u-boot.inc, but with your patch and u-boot.inc from oe-core it ends like this

so why don't you migrate the patch from meta-ti into OE-Core ? and leave this sed thing out ?

#9 lore raw
Quoted 18 lines · Khem Raj
Quoted 15 lines · Martin Jansa
Quoted 10 lines · Khem Raj
Quoted 3 lines · Martin Jansa

well not exactly like this one as this is causing
/bin/sh: 1: Syntax error: Bad fd number
probably from ">&" in dash

yes. I swear I have since fixed this patch this seems to be an older version did you look into meta-ti/master ?

Yes, your patch is fixed in meta-ti, but cannot be used together with Otavio's patch to u-boot.inc.

Quoted 6 lines
Quoted 2 lines

meta-ti is fine because it provides own u-boot.inc, but with your patch and u-boot.inc from oe-core it ends like this

so why don't you migrate the patch from meta-ti into OE-Core ? and leave this sed thing out ?

Because all layers using u-boot.inc from oe-core probably already have this patch and adding it to oe-core too will cause do_patch to fail.

Or those layers are not using SRC_URI from u-boot.inc and then they won't get this patch anyway.

And I don't want to introduce another kind of automagic which would add that patch to SRC_URI only if it's not added by some .bbappend already..

One character change in that regexp fixed all use-cases I can think of, so looks like best solution to me..

Cheers,

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#10 lore raw
Quoted 2 lines · Martin Jansa

One character change in that regexp fixed all use-cases I can think of, so looks like best solution to me..

+1

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#11 lore raw
In reply to Martin Jansa
Quoted 3 lines · Martin Jansa

reexecuting do_compile in u-boot causes .bfd being appended multiple times and resulting in errors like:
/bin/bash: arm-oe-linux-gnueabi-ld.bfd.bfd.bfd: command not found

I am just wondering why it'd end re-executed? due changes on sstate hash?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#12 lore raw
Quoted 6 lines · Otavio Salvador
Quoted 3 lines · Martin Jansa

reexecuting do_compile in u-boot causes .bfd being appended multiple times and resulting in errors like:
/bin/bash: arm-oe-linux-gnueabi-ld.bfd.bfd.bfd: command not found

I am just wondering why it'd end re-executed? due changes on sstate hash?

e.g. when it fails due to compile error and someone reexecutes it then he will see arm-oe-linux-gnueabi-ld.bfd.bfd.bfd instead of real compile error.

Cheers,

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#13 lore raw
Quoted 11 lines · Martin Jansa
Quoted 6 lines · Otavio Salvador
Quoted 3 lines · Martin Jansa

reexecuting do_compile in u-boot causes .bfd being appended multiple times and resulting in errors like:
/bin/bash: arm-oe-linux-gnueabi-ld.bfd.bfd.bfd: command not found

I am just wondering why it'd end re-executed? due changes on sstate hash?

e.g. when it fails due to compile error and someone reexecutes it then he will see arm-oe-linux-gnueabi-ld.bfd.bfd.bfd instead of real compile error.

Wouldn't be better to grep for 'ld.bfd' and apply it *only* if not is not found?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br