Summary: | sys-boot/gnu-efi-3.0.17: error: expected the entry size (clang) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Violet Purcell <vimproved> |
Component: | Current packages | Assignee: | Mike Gilbert <floppym> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | chris, lschmelting, sht852680833 |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
build.log
working build log for clang-first system |
Description
Violet Purcell
2023-09-24 16:53:09 UTC
Which version of clang is being used here? I see you have 2 versions installed. (In reply to Mike Gilbert from comment #1) > Which version of clang is being used here? I see you have 2 versions > installed. Clang 17, however the same error is present when using CC="clang-16". There seems to be some clue here: https://github.com/kraj/meta-clang/blob/master/conf/nonclangable.conf in that they've added the following: # TOPDIR/build/tmp/work/core2-32-yoe-linux/gnu-efi/3.0.17-r0/gnu-efi-3.0.17//lib/ctors.S:11:41: error: expected the entry size # .section .init_array, "aM", @init_array # ^ CFLAGS:append:pn-gnu-efi:toolchain-clang = " -no-integrated-as" I've tried adding that to Make.defaults via a user patch, and changing both CC and BULDCC to "clang -no-integrated-as". I've also tried changing AS from AS=llvm-as to AS=as but none of these seem to work. I've also done some more digging, gnu-efi-3.0.15 builds fine, and it looks to be that the ctors.S file was added in 3.0.17. Looks like the GNU assembler accepts these without a defined size but the LLVM assembler doesn't. Unfortunately that's where my expertise ends... (In reply to Chris Pritchard from comment #4) > I've also done some more digging, gnu-efi-3.0.15 builds fine, and it looks > to be that the ctors.S file was added in 3.0.17. Looks like the GNU > assembler accepts these without a defined size but the LLVM assembler > doesn't. Unfortunately that's where my expertise ends... According to https://sourceware.org/binutils/docs/as/Section.html, the entsize argument is supposed to be required by GNU AS as well, but clearly this isn't enforced. > If flags contains the M symbol then the type argument must be specified as well as an extra argument—entsize—like this: > .section name , "flags"M, @type, entsize Seems like this was already fixed upstream actually, will backport. https://sourceforge.net/p/gnu-efi/code/ci/97499a0cf265bf2d515bfcab99349ce00ecf2662/ (In reply to Violet Purcell from comment #6) > Seems like this was already fixed upstream actually, will backport. > https://sourceforge.net/p/gnu-efi/code/ci/ > 97499a0cf265bf2d515bfcab99349ce00ecf2662/ Had a quick look at applying this as a user patch, I now get a completely new error: ld.lld: error: section: .dynamic is not contiguous with other relro sections make[1]: *** [/var/tmp/portage/sys-boot/gnu-efi-3.0.17/work/gnu-efi-3.0.17//apps/../Make.rules:49: t.so] Error 1 rm t.o make[1]: Leaving directory '/var/tmp/portage/sys-boot/gnu-efi-3.0.17/work/gnu-efi-3.0.17/ia32/apps' make: *** [Makefile:82: apps] Error 2 (In reply to Chris Pritchard from comment #7) > (In reply to Violet Purcell from comment #6) > > Seems like this was already fixed upstream actually, will backport. > > https://sourceforge.net/p/gnu-efi/code/ci/ > > 97499a0cf265bf2d515bfcab99349ce00ecf2662/ > > Had a quick look at applying this as a user patch, I now get a completely > new error: > > ld.lld: error: section: .dynamic is not contiguous with other relro sections > make[1]: *** > [/var/tmp/portage/sys-boot/gnu-efi-3.0.17/work/gnu-efi-3.0.17//apps/../Make. > rules:49: t.so] Error 1 > rm t.o > make[1]: Leaving directory > '/var/tmp/portage/sys-boot/gnu-efi-3.0.17/work/gnu-efi-3.0.17/ia32/apps' > make: *** [Makefile:82: apps] Error 2 Yep, same here. Haven't had the time to look into it yet. I looked into this issue and it seem the llvm toolchain defaults to `-zrelro` where as bfd defaults to `-znorelro` I have not been able to make gnu-efi use my own cflags so if someone could test with these it should make it possible to make gnu-efi build Created attachment 881261 [details]
working build log for clang-first system
I have backported the referenced patch manually (I couldn't find a way to download it) and it seems to work for me.
I have a clang-first system though, perhaps that plays a role. I have attached the working build log in case you want to check the actual build commands.
This is how my system is set up w.r.t. Clang/LLVM:
[ebuild R ] dev-libs/libffi-3.4.4-r2:0/8::gentoo USE="test -debug (-exec-static-trampoline) -pax-kernel -static-libs" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild R ~] sys-devel/llvm-common-17.0.6::gentoo USE="verify-sig -emacs" 0 KiB
[ebuild R ~] sys-devel/llvm-17.0.6:17::gentoo USE="binutils-plugin libffi ncurses verify-sig xml zstd -debug -debuginfod -doc -exegesis -libedit -test -xar -z3" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) (ARM) (AVR) (BPF) (Hexagon) (Lanai) (LoongArch) (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) -ARC -CSKY -DirectX -M68k -SPIRV -Xtensa" 0 KiB
[ebuild R ~] sys-apps/hwloc-2.9.3:0/15::gentoo USE="cairo cpuid pci svg udev xml -X -cuda -debug -nvml -static-libs -valgrind" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="-nvidia" 0 KiB
[ebuild R ~] dev-util/spirv-llvm-translator-17.0.0:17::gentoo USE="-test" 0 KiB
[ebuild R ~] sys-devel/lld-17.0.6:17::gentoo USE="test verify-sig zstd -debug" 0 KiB
[ebuild R ~] sys-devel/clang-common-17.0.6-r1::gentoo USE="default-compiler-rt default-libcxx default-lld hardened llvm-libunwind verify-sig" 0 KiB
[ebuild R ~] sys-devel/clang-17.0.6:17::gentoo USE="extra (pie) static-analyzer verify-sig xml -debug -doc (-ieee-long-double) -test" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) (ARM) (AVR) (BPF) (Hexagon) (Lanai) (LoongArch) (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) -ARC -CSKY -DirectX -M68k -SPIRV -Xtensa" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12" 0 KiB
[ebuild R ~] sys-libs/compiler-rt-17.0.6:17::gentoo USE="clang test verify-sig -debug" ABI_X86="32 (64)" 0 KiB
[ebuild R ~] sys-libs/compiler-rt-sanitizers-17.0.6:17::gentoo USE="asan cfi clang dfsan gwp-asan hwasan libfuzzer lsan memprof msan orc profile safestack scudo tsan ubsan verify-sig xray -debug (-shadowcallstack) -test" ABI_X86="32 (64)" 0 KiB
[ebuild R ~] sys-libs/libcxxabi-17.0.6::gentoo USE="clang static-libs test verify-sig" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild R ~] sys-libs/libomp-17.0.6:0/17::gentoo USE="hwloc offload test verify-sig -debug -gdb-plugin -ompt" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="AMDGPU -NVPTX" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12" 0 KiB
[ebuild R ~] dev-libs/libclc-17.0.6::gentoo USE="spirv verify-sig" VIDEO_CARDS="radeonsi -nvidia -r600" 0 KiB
[ebuild R ~] dev-util/lldb-17.0.6:0/17::gentoo USE="libedit lzma ncurses verify-sig xml -debug -python -test" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12" 0 KiB
[ebuild R ~] sys-libs/libcxx-17.0.6::gentoo USE="clang (libcxxabi) static-libs verify-sig -test" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild R ~] sys-devel/clang-runtime-17.0.6:17::gentoo USE="compiler-rt libcxx openmp sanitize" ABI_X86="32 (64) (-x32)" 0 KiB
emerge --info (relevant parts):
AR="llvm-ar"
CBUILD="x86_64-pc-linux-gnu"
CC="clang-17"
CFLAGS="-O3 -march=native -pipe -glldb -flto=thin -fwhole-program-vtables -gline-tables-only"
CHOST="x86_64-pc-linux-gnu"
CXX="clang++-17"
CXXFLAGS="-O3 -march=native -pipe -glldb -flto=thin -fwhole-program-vtables -gline-tables-only"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live compressdebug config-protect-if-modified distlocks downgrade-backup ebuild-locks fail-clean fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted prese
rve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog splitdebug strict test unknown-features-warn unmerge-backup unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O3,-z,now,--as-needed,--lto-O3,--icf=safe,--gc-sections"
MAKEOPTS="-j64"
NM="llvm-nm"
RANLIB="llvm-ranlib"
(In reply to Fabio Scaccabarozzi from comment #10) > I have a clang-first system though, perhaps that plays a role. I am on a fresh install using a "stage3-amd64-llvm-systemd-mergedusr" archive and got the same error messages mentioned above after applying the already mentioned patch. I then noticed that Fabio is using the following linker in the provided logs: "x86_64-pc-linux-gnu-ld". I then tried: LD=ld.bfd emerge gnu-efi and got another error: llvm-objcopy: error: invalid output format: 'efi-app-x86_64'. Looking at other bugs i saw that switching to binutils objcopy would enable me to install gnu-efi: LD=ld.bfd OBJCOPY="objcopy" emerge gnu-efi The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb4d8611da3298786eb12f11a367abf86e447036 commit cb4d8611da3298786eb12f11a367abf86e447036 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-04-23 19:40:55 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-04-23 19:40:55 +0000 sys-boot/gnu-efi: add 3.0.18 Closes: https://bugs.gentoo.org/914606 Closes: https://bugs.gentoo.org/929216 Signed-off-by: Sam James <sam@gentoo.org> sys-boot/gnu-efi/Manifest | 1 + sys-boot/gnu-efi/gnu-efi-3.0.18.ebuild | 85 ++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) |