Skip to contentSkip to conversation

runc-opencontainers: use bfd even with ld-is-gold

PATCH In review Martin Jansa 2 participants 5 messages May 3, 2021 – May 7, 2021 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 runc-opencontainers: use bfd even with ld-is-gold

* just a work around for internal error in binutils-2.36 gold:
http://errors.yoctoproject.org/Errors/Details/580099/
CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath -tags "seccomp seccomp netgo osusergo" -ldflags "-w -extldflags -static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty" -X main.version=1.0.0-rc93+dev " -o runc .
TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld: internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278
collect2: error: ld returned 1 exit status

* it fails like this only together with gcc-11, with gcc-10.3 it builds fine even with gold

---
 recipes-containers/runc/runc-opencontainers_git.bb | 7 +++++++
 1 file changed, 7 insertions(+)
recipes-containers/runc/runc-opencontainers_git.bb +7 -0
index f3ff9a8..51ba7c9 100644
@@ -8,3 +8,10 @@ SRC_URI = " \
 RUNC_VERSION = "1.0.0-rc93"
 
 CVE_PRODUCT = "runc"
+
+# use BFD when ld-is-gold is used to work around:
+# http://errors.yoctoproject.org/Errors/Details/580099/
+# CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath  -tags "seccomp seccomp                       netgo osusergo" -ldflags "-w -extldflags -static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty" -X main.version=1.0.0-rc93+dev " -o runc .
+# TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld: internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278
+# collect2: error: ld returned 1 exit status
+LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
Signature · 1 line
2.30.2
#2 lore raw
In reply to a message not in the archive

runc-opencontainers is the only recipe currently failing like this for me with gold, so instead of switching system linker I would prefer to force bfd only here.

But there is also one more issue which is probably introduced by gcc-11 (I had older version of your patches with 11.0.1 in my branches, so waiting for build to confirm if it's reproducible with 11.1.0 as well):

NOTE: > Executing update_font_cache intercept ...
NOTE: Exit code 132. Output:
+ '[' True = False -a qemuwrapper-cross '!=' nativesdk-qemuwrapper-cross ']'
+ qemu-i386 -r 3.2.0 -E LD_LIBRARY_PATH=/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs/usr/lib:/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs/lib -L
/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs
-E FC_DEBUG=16
/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs/usr/libexec/fc-cache --sysroot=/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs
--system-only -v
qemu: uncaught target signal 4 (Illegal instruction) - core dumped

Quoted 52 lines · Khem Raj
Quoted 3 lines · Martin Jansa

* just a work around for internal error in binutils-2.36 gold:
http://errors.yoctoproject.org/Errors/Details/580099/
CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath -tags "seccomp

seccomp netgo osusergo" -ldflags "-w -extldflags

(quoted diff) +0 -2
-static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty"
-X main.version=1.0.0-rc93+dev " -o runc .
Quoted 1 line

TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld:
internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278

Review

Quoted 11 lines

collect2: error: ld returned 1 exit status

* it fails like this only together with gcc-11, with gcc-10.3 it builds fine even with gold

---
  recipes-containers/runc/runc-opencontainers_git.bb | 7 +++++++
  1 file changed, 7 insertions(+)
(quoted diff) +0 -0

b/recipes-containers/runc/runc-opencontainers_git.bb

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 14

Quoted 11 lines

index f3ff9a8..51ba7c9 100644

recipes-containers/runc/runc-opencontainers_git.bb +4 -0
@@ -8,3 +8,10 @@ SRC_URI = " \
  RUNC_VERSION = "1.0.0-rc93"
 
  CVE_PRODUCT = "runc"
+
+# use BFD when ld-is-gold is used to work around:
+# http://errors.yoctoproject.org/Errors/Details/580099/
+# CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath  -tags "seccomp

seccomp netgo osusergo" -ldflags "-w -extldflags

(quoted diff) +0 -2
-static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty"
-X main.version=1.0.0-rc93+dev " -o runc .

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 15

Quoted 1 line
recipes-containers/runc/runc-opencontainers_git.bb +1 -0
+#

TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld:
internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 16

Quoted 1 line
recipes-containers/runc/runc-opencontainers_git.bb +1 -0
+# collect2: error: ld returned 1 exit status

this is because of dwarf-5 defaults in gcc 11 and gold has gotten some fixed recently fixes these issues, but we are not backporting them yet and perhaps will wait for binutils 2.37 to get it all. Maybe you should not use gold as system linker until then to avoid these pitfalls.

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 17

Quoted 1 line
recipes-containers/runc/runc-opencontainers_git.bb +1 -0
+LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold',

' -fuse-ld=bfd ', '', d)}"

Quoted 1 line
#4 lore raw
In reply to a message not in the archive
Quoted 3 lines · Martin Jansa via lists.yoctoproject.org

runc-opencontainers is the only recipe currently failing like this for me with gold, so instead of switching system linker I would prefer to force bfd only here.

In my world builds with ld-is-gold I've found only 2 more recipes which trigger this internal error.

Quoted 4 lines

But there is also one more issue which is probably introduced by gcc-11 (I had older version of your patches with 11.0.1 in my branches, so waiting for build to confirm if it's reproducible with 11.1.0 as well):

Quoted 12 lines

NOTE: > Executing update_font_cache intercept ...
NOTE: Exit code 132. Output:
+ '[' True = False -a qemuwrapper-cross '!=' nativesdk-qemuwrapper-cross ']'
+ qemu-i386 -r 3.2.0 -E LD_LIBRARY_PATH=/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs/usr/lib:/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs/lib -L
/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs
-E FC_DEBUG=16
/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs/usr/libexec/fc-cache --sysroot=/jenkins/mjansa/build/ose/honister/BUILD/work/qemux86-webos-linux/webos-image-ros-world/1.0-r3/rootfs
--system-only -v
qemu: uncaught target signal 4 (Illegal instruction) - core dumped

In case someone sees this Illegal instruction as well, then in my case it was caused by missing "-cpu n270" in qemuwrapper-cross script, because of how webOS sets PACKAGE_ARCH to be MACHINE_ARCH by default QEMU_OPTIONS didn't include QEMU_EXTRAOPTIONS_core2-32.

It used to work with default cpu in qemu-i386 until now, I think it stopped working when fontconfig was rebuilt with gcc-11, but not 100% sure.

#5 lore raw
In reply to Martin Jansa

This is on master-next now.

From the follow ups, I assume that this is still needed. Once I get a bit of soak and runtime testing done on some other queued changes, this will be part of my next push.

Bruce

Quoted 36 lines · Martin Jansa

* just a work around for internal error in binutils-2.36 gold:
http://errors.yoctoproject.org/Errors/Details/580099/
CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath -tags "seccomp seccomp netgo osusergo" -ldflags "-w -extldflags -static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty" -X main.version=1.0.0-rc93+dev " -o runc .
TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld: internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278
collect2: error: ld returned 1 exit status

* it fails like this only together with gcc-11, with gcc-10.3 it builds fine even with gold

---
 recipes-containers/runc/runc-opencontainers_git.bb | 7 +++++++
 1 file changed, 7 insertions(+)
recipes-containers/runc/runc-opencontainers_git.bb +7 -1
index f3ff9a8..51ba7c9 100644
@@ -8,3 +8,10 @@ SRC_URI = " \
 RUNC_VERSION = "1.0.0-rc93"
 
 CVE_PRODUCT = "runc"
+
+# use BFD when ld-is-gold is used to work around:
+# http://errors.yoctoproject.org/Errors/Details/580099/
+# CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath  -tags "seccomp seccomp                       netgo osusergo" -ldflags "-w -extldflags -static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty" -X main.version=1.0.0-rc93+dev " -o runc .
+# TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld: internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278
+# collect2: error: ld returned 1 exit status
+LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
--

2.30.2

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#6 lore raw

Thanks Bruce, yes it's still needed as work around for those with ld-is-gold in DISTRO_FEATURES. Once binutils are upgraded in oe-core I'll retest and send removal of this once it starts working fine again.

Quoted 65 lines · Bruce Ashfield

This is on master-next now.

From the follow ups, I assume that this is still needed. Once I get a bit of soak and runtime testing done on some other queued changes, this will be part of my next push.

Bruce

Quoted 4 lines · Martin Jansa

* just a work around for internal error in binutils-2.36 gold:
http://errors.yoctoproject.org/Errors/Details/580099/
CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath -tags "seccomp

seccomp netgo osusergo" -ldflags "-w -extldflags

(quoted diff) +0 -2
-static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty"
-X main.version=1.0.0-rc93+dev " -o runc .
Quoted 1 line

TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld:
internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278

Review

Quoted 11 lines

collect2: error: ld returned 1 exit status

* it fails like this only together with gcc-11, with gcc-10.3 it builds fine even with gold

---
 recipes-containers/runc/runc-opencontainers_git.bb | 7 +++++++
 1 file changed, 7 insertions(+)
(quoted diff) +0 -0

b/recipes-containers/runc/runc-opencontainers_git.bb

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 14

Quoted 11 lines

index f3ff9a8..51ba7c9 100644

recipes-containers/runc/runc-opencontainers_git.bb +4 -0
@@ -8,3 +8,10 @@ SRC_URI = " \
 RUNC_VERSION = "1.0.0-rc93"
 
 CVE_PRODUCT = "runc"
+
+# use BFD when ld-is-gold is used to work around:
+# http://errors.yoctoproject.org/Errors/Details/580099/
+# CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath  -tags "seccomp

seccomp netgo osusergo" -ldflags "-w -extldflags

(quoted diff) +0 -2
-static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty"
-X main.version=1.0.0-rc93+dev " -o runc .

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 15

Quoted 1 line
recipes-containers/runc/runc-opencontainers_git.bb +1 -0
+#

TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld:
internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278

recipes-containers/runc/runc-opencontainers_git.bb SRC_URI = " \ · line 17

Quoted 2 lines
recipes-containers/runc/runc-opencontainers_git.bb +2 -0
+# collect2: error: ld returned 1 exit status
+LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold',

' -fuse-ld=bfd ', '', d)}"

Quoted 6 lines

--
2.30.2

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II