git: 8e7ba6eb44da - stable/12 - stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Mar 2023 22:28:34 UTC
The branch stable/12 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=8e7ba6eb44da1c4dc538954c7e1a686aafc72b8b
commit 8e7ba6eb44da1c4dc538954c7e1a686aafc72b8b
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-02 20:18:43 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-03-22 18:23:00 +0000
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)
---
stand/efi/boot1/Makefile | 3 +++
stand/efi/loader/Makefile | 3 +++
2 files changed, 6 insertions(+)
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