mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2025-12-08 00:05:33 +03:00
app-crypt/efitools: fix building w/ llvm profile
1. ld.lld: error: section: .dynamic is not contiguous with other relro sections fix by force ld.bfd 2. llvm-objcopy: error: invalid output format: 'efi-app-x86_64' fix by force objcopy from binutils, check_and_set_objcopy is copied from sys-boot/gnu-efi Closes: https://bugs.gentoo.org/934377 Closes: https://bugs.gentoo.org/953401 Signed-off-by: Z. Liu <zhixu.liu@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/44380 Closes: https://github.com/gentoo/gentoo/pull/44380 Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
This commit is contained in:
parent
ec4c44e88f
commit
9b184c5de6
@ -26,6 +26,7 @@ BDEPEND="
|
||||
app-crypt/sbsigntools
|
||||
dev-perl/File-Slurp
|
||||
sys-apps/help2man
|
||||
sys-devel/binutils
|
||||
virtual/pkgconfig"
|
||||
|
||||
PATCHES=(
|
||||
@ -34,6 +35,35 @@ PATCHES=(
|
||||
"${FILESDIR}"/1.9.2-gcc15.patch
|
||||
)
|
||||
|
||||
check_and_set_objcopy() {
|
||||
if [[ ${MERGE_TYPE} != "binary" ]]; then
|
||||
# bug #931792
|
||||
# llvm-objcopy does not support EFI target, try to use binutils objcopy or fail
|
||||
tc-export OBJCOPY
|
||||
OBJCOPY="${OBJCOPY/llvm-/}"
|
||||
# Test OBJCOPY to see if it supports EFI targets, and return if it does
|
||||
LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' && return 0
|
||||
# If OBJCOPY does not support EFI targets, it is possible that the 'objcopy' on our path is
|
||||
# still LLVM if the 'binutils-plugin' USE flag is set. In this case, we check to see if the
|
||||
# '(prefix)/usr/bin/objcopy' binary is available (it should be, it's a dependency), and if
|
||||
# so, we use the absolute path explicitly.
|
||||
local binutils_objcopy="${EPREFIX}"/usr/bin/"${OBJCOPY}"
|
||||
if [[ -e "${binutils_objcopy}" ]]; then
|
||||
OBJCOPY="${binutils_objcopy}"
|
||||
fi
|
||||
if ! use arm && ! use riscv; then
|
||||
# bug #939338
|
||||
# objcopy does not understand PE/COFF on these arches: arm32, riscv64 and mips64le
|
||||
# gnu-efi contains a workaround
|
||||
LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) does not support EFI target"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
check_and_set_objcopy
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
@ -42,6 +72,10 @@ src_prepare() {
|
||||
sed -i -e 's/-fno-toplevel-reorder//g' Make.rules || die
|
||||
fi
|
||||
|
||||
if tc-ld-is-lld; then
|
||||
tc-ld-force-bfd
|
||||
fi
|
||||
|
||||
if use static; then
|
||||
append-ldflags -static
|
||||
export STATIC_FLAG=--static
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user