From 447212cb301f5c90f44e082960229436d7d3597d Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Wed, 19 May 2021 11:33:18 +0200 Subject: [PATCH] sys-boot/grub: fix build error with binutils 2.36 With binutils 2.36, build of grub fails like that: ``` ld: section .note.gnu.property VMA [0000000000400158,0000000000400187] overlaps section .bss VMA [000000000000e000,000000000041d207] ``` It is caused by assembler, as it generates the GNU property notes section by default. Use the assmbler option `-mx86-used-note=no` to disable the section from being generated to workaround the ensuing linker issue. Patch was originally written by OpenSUSE. https://sourceware.org/bugzilla/show_bug.cgi?id=27377 https://bugzilla.opensuse.org/show_bug.cgi?id=1181741 https://build.opensuse.org/package/view_file/Base:System/grub2/0001-Fix-build-error-in-binutils-2.36.patch --- ...rub-2.02-binutils-2.36-x86-used-note.patch | 47 +++++++++++++++++++ ...rub-2.02-r5.ebuild => grub-2.02-r6.ebuild} | 0 .../sys-boot/grub/grub-9999.ebuild | 8 +++- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-boot/grub/files/grub-2.02-binutils-2.36-x86-used-note.patch rename sdk_container/src/third_party/coreos-overlay/sys-boot/grub/{grub-2.02-r5.ebuild => grub-2.02-r6.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/files/grub-2.02-binutils-2.36-x86-used-note.patch b/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/files/grub-2.02-binutils-2.36-x86-used-note.patch new file mode 100644 index 0000000000..72ce7a7b41 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/files/grub-2.02-binutils-2.36-x86-used-note.patch @@ -0,0 +1,47 @@ +From 7801d671905329d28e789082225570fc54fe5784 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Fri, 19 Feb 2021 17:40:43 +0800 +Subject: [PATCH] Fix build error in binutils 2.36 + +The build fails in binutils 2.36 + +[ 520s] cat kernel_syms.lst > syminfo.lst.new +[ 520s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: section .note.gnu.property VMA [0000000000400158,0000000000400187] overlaps section .bss VMA [000000000000f000,000000000041e1af] + +It is caused by assembler now generates the GNU property notes section +by default. Use the assmbler option -mx86-used-note=no to disable the +section from being generated to workaround the ensuing linker issue. + +Signed-off-by: Michael Chang +--- + configure.ac | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/configure.ac b/configure.ac +index c39e8379f..a3fb713ad 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -827,6 +827,20 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" + fi + ++if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ); then ++ AC_CACHE_CHECK([whether -Wa,-mx86-used-note works], [grub_cv_cc_mx86_used_note], [ ++ CFLAGS="$TARGET_CFLAGS -Wa,-mx86-used-note=no -Werror" ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [grub_cv_cc_mx86_used_note=yes], ++ [grub_cv_cc_mx86_used_note=no]) ++ ]) ++ ++ if test "x$grub_cv_cc_mx86_used_note" = xyes; then ++ TARGET_CFLAGS="$TARGET_CFLAGS -Wa,-mx86-used-note=no" ++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mx86-used-note=no" ++ fi ++fi ++ + # GRUB doesn't use float or doubles at all. Yet some toolchains may decide + # that floats are a good fit to run instead of what's written in the code. + # Given that floating point unit is disabled (if present to begin with) +-- +2.30.0 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-2.02-r5.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-2.02-r6.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-2.02-r5.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-2.02-r6.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-9999.ebuild index 37ab75202d..2e97454696 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-boot/grub/grub-9999.ebuild @@ -111,12 +111,18 @@ QA_EXECSTACK="usr/bin/grub*-emu* usr/lib/grub/*" QA_WX_LOAD="usr/lib/grub/*" QA_MULTILIB_PATHS="usr/lib/grub/.*" +PATCHES=( + "${FILESDIR}/${PN}-2.02-binutils-2.36-x86-used-note.patch" +) + src_unpack() { cros-workon_src_unpack default } src_prepare() { + default + sed -i -e /autoreconf/d autogen.sh || die if use multislot; then @@ -132,8 +138,6 @@ src_prepare() { tests/util/grub-fs-tester.in \ || die - eapply_user - if [[ -n ${GRUB_AUTOGEN} ]]; then python_setup bash autogen.sh || die