Skip to contentSkip to conversation

gcc-target: Ensure buildtools-extended-tarball doesn't use arch=native

PATCH In review Richard Purdie 3 participants 5 messages May 1, 2020 – May 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gcc-target: Ensure buildtools-extended-tarball doesn't use arch=native

A nativesdk BBCLASSEXTEND was added to gcc-target without realising this would pass arch=native through to it for x86-64. This heavily optimises gcc output for the host its running on meaning it can't be reused via sstate on other machines.

Add class-target overrides here to get the desired behaviour. All targets have been covered for completeness.

---
 meta/recipes-devtools/gcc/gcc-target.inc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
meta/recipes-devtools/gcc/gcc-target.inc +5 -5
index 8cb432780f5..6263e814971 100644
@@ -15,11 +15,11 @@ EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
 
 ARMFPARCHEXT ?= ""
 
-EXTRA_OECONF_append_armv6 = " --with-arch=armv6${ARMFPARCHEXT}"
-EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a${ARMFPARCHEXT}"
-EXTRA_OECONF_append_armv7ve = " --with-arch=armv7ve${ARMFPARCHEXT}"
-EXTRA_OECONF_append_arc = " --with-cpu=${TUNE_PKGARCH}"
-EXTRA_OECONF_append_x86-64 = " --with-arch=native"
+EXTRA_OECONF_append_armv6_class-target = " --with-arch=armv6${ARMFPARCHEXT}"
+EXTRA_OECONF_append_armv7a_class-target = " --with-arch=armv7-a${ARMFPARCHEXT}"
+EXTRA_OECONF_append_armv7ve_class-target = " --with-arch=armv7ve${ARMFPARCHEXT}"
+EXTRA_OECONF_append_arc_class-target = " --with-cpu=${TUNE_PKGARCH}"
+EXTRA_OECONF_append_x86-64_class-target = " --with-arch=native"
 
 # libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
 # set in subdir gcc, so subdir libcc1 can't use it, export it here to
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 abi_version/staging: Bump versions to force rebuild after sstate corruption

A "broken" buildtools-extended-tarball has been released into the wild where it is optimising binaries for the host processsor. This is fine in local usage but in a non-homogeneous cluster like our autobuilder, this results in SIGILL on other machines when the sstate is shared amongst them and is painful to debug.

The buildtools tarball has been fixed but we need to invalidate the hash equivalence and sstate data. This change does that. Adding to OE-Core rather than autobuilder local changes as its good to illustrate how to do this and the issue is potentially wider than just Yocto Project infrastructure.

---
 meta/classes/staging.bbclass | 1 +
 meta/conf/abi_version.conf   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
meta/classes/staging.bbclass +1 -0
index 5b04f88b2d8..de3a19815a3 100644
@@ -93,6 +93,7 @@ SYSROOT_PREPROCESS_FUNCS ?= ""
 SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir"
 
 python do_populate_sysroot () {
+    # SYSROOT 'version' 2
     bb.build.exec_func("sysroot_stage_all", d)
     bb.build.exec_func("sysroot_strip", d)
     for f in (d.getVar('SYSROOT_PREPROCESS_FUNCS') or '').split():
meta/conf/abi_version.conf +1 -1
index 2bdc55695bd..e04343b47c1 100644
@@ -12,4 +12,4 @@ OELAYOUT_ABI = "12"
 # a reset of the equivalence, for example when reproducibility issues break the
 # existing match data. Distros can also append to this value for the same effect.
 #
-HASHEQUIV_HASH_VERSION  = "1"
+HASHEQUIV_HASH_VERSION  = "3"
Signature · 1 line
2.25.1
#2 lore raw
In reply to Richard Purdie
Quoted 8 lines · Richard Purdie

A nativesdk BBCLASSEXTEND was added to gcc-target without realising this would pass arch=native through to it for x86-64. This heavily optimises gcc output for the host its running on meaning it can't be reused via sstate on other machines.

Add class-target overrides here to get the desired behaviour. All targets have been covered for completeness.

yeah perhaps it should have been --with-arch=generic for non target option,

this looks ok

Quoted 30 lines
---
  meta/recipes-devtools/gcc/gcc-target.inc | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
meta/recipes-devtools/gcc/gcc-target.inc +5 -5
index 8cb432780f5..6263e814971 100644
@@ -15,11 +15,11 @@ EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
 
  ARMFPARCHEXT ?= ""
 
-EXTRA_OECONF_append_armv6 = " --with-arch=armv6${ARMFPARCHEXT}"
-EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a${ARMFPARCHEXT}"
-EXTRA_OECONF_append_armv7ve = " --with-arch=armv7ve${ARMFPARCHEXT}"
-EXTRA_OECONF_append_arc = " --with-cpu=${TUNE_PKGARCH}"
-EXTRA_OECONF_append_x86-64 = " --with-arch=native"
+EXTRA_OECONF_append_armv6_class-target = " --with-arch=armv6${ARMFPARCHEXT}"
+EXTRA_OECONF_append_armv7a_class-target = " --with-arch=armv7-a${ARMFPARCHEXT}"
+EXTRA_OECONF_append_armv7ve_class-target = " --with-arch=armv7ve${ARMFPARCHEXT}"
+EXTRA_OECONF_append_arc_class-target = " --with-cpu=${TUNE_PKGARCH}"
+EXTRA_OECONF_append_x86-64_class-target = " --with-arch=native"
 
  # libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
  # set in subdir gcc, so subdir libcc1 can't use it, export it here to
#3 lore raw
In reply to Richard Purdie
Quoted 10 lines · Richard Purdie

A nativesdk BBCLASSEXTEND was added to gcc-target without realising this would pass arch=native through to it for x86-64. This heavily optimises gcc output for the host its running on meaning it can't be reused via sstate on other machines.

Add class-target overrides here to get the desired behaviour. All targets have been covered for completeness.
...
+EXTRA_OECONF_append_x86-64_class-target = " --with-arch=native"
...

What do you expect --with-arch=native to do for the target of a cross compiler?

cu
Adrian

#4 lore raw
Quoted 9 lines · Adrian Bunk
Quoted 8 lines · Richard Purdie

A nativesdk BBCLASSEXTEND was added to gcc-target without realising this
would pass arch=native through to it for x86-64. This heavily optimises
gcc output for the host its running on meaning it can't be reused via
sstate on other machines.

Quoted 8 lines
Quoted 5 lines

Add class-target overrides here to get the desired behaviour. All targets have been covered for completeness.
...
+EXTRA_OECONF_append_x86-64_class-target = " --with-arch=native"
...

What do you expect --with-arch=native to do for the target of a cross compiler?

gcc-target isn't a cross compiler.

Cheers,

Richard