aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-02-02 20:18:43 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2023-03-22 18:23:00 +0000
commit8e7ba6eb44da1c4dc538954c7e1a686aafc72b8b (patch)
tree26f946d13de33c4d8c9dd5cf829945e91ce05cba
parentfbe7e06a3ce279e0d0afd37118a46981b5d25f05 (diff)
downloadsrc-8e7ba6eb44da1c4dc538954c7e1a686aafc72b8b.tar.gz
src-8e7ba6eb44da1c4dc538954c7e1a686aafc72b8b.zip
stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.
ld.bfd in binutils 2.34+ now reports an error in more cases for custom ldscripts that do not place PHDRs in a LOAD segment. However, EFI binaries are not dynamic binaries which need PHDRs, so pass --no-dynamic-linker to disable this check. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D34124 (cherry picked from commit 8bd5e2f15cc9756e7d6b7feb43ec47f18a38e2bf)
-rw-r--r--stand/efi/boot1/Makefile3
-rw-r--r--stand/efi/loader/Makefile3
2 files changed, 6 insertions, 0 deletions
diff --git a/stand/efi/boot1/Makefile b/stand/efi/boot1/Makefile
index bf3860f36b5d..a11ad17eeb30 100644
--- a/stand/efi/boot1/Makefile
+++ b/stand/efi/boot1/Makefile
@@ -66,6 +66,9 @@ FILESMODE_${BOOT1}.efi= ${BINMODE}
LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE}
LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -pie
+.if ${LINKER_TYPE} == "bfd" && ${LINKER_VERSION} >= 23400
+LDFLAGS+= -Wl,--no-dynamic-linker
+.endif
.if ${MACHINE_CPUARCH} == "aarch64"
CFLAGS+= -mgeneral-regs-only
diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile
index 993a869ab13e..9f782f158c54 100644
--- a/stand/efi/loader/Makefile
+++ b/stand/efi/loader/Makefile
@@ -85,6 +85,9 @@ LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -pie
+.if ${LINKER_TYPE} == "bfd" && ${LINKER_VERSION} >= 23400
+LDFLAGS+= -Wl,--no-dynamic-linker
+.endif
CLEANFILES+= loader.efi