mirror of
https://github.com/opnsense/src.git
synced 2026-06-17 04:29:12 -04:00
boot: Always use ELF Tool Chain elfcopy for EFI builds
We now use llvm-objcopy by default (as of commit 1cae7121c6), but it
does not support efi-app-x86_64 and similar ouptut formats (for more
detail see LLVM issue 108609[1]).
Go back to installing ELF Tool Chain's version of objcopy as elfcopy
(the standard upstream name) and use it for EFI builds.
[1] https://github.com/llvm/llvm-project/issues/108609).
PR: 280771
Reviewed by: andrew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49362
This commit is contained in:
parent
74361d693a
commit
b885643b63
7 changed files with 18 additions and 9 deletions
|
|
@ -13587,9 +13587,6 @@ OLD_FILES+=usr/share/man/man1/rlog.1.gz
|
|||
OLD_FILES+=usr/share/man/man5/rcsfile.5.gz
|
||||
# 20161010: remove link to removed m_getclr(9) macro
|
||||
OLD_FILES+=usr/share/man/man9/m_getclr.9.gz
|
||||
# 20161003: MK_ELFCOPY_AS_OBJCOPY option retired
|
||||
OLD_FILES+=usr/bin/elfcopy
|
||||
OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
|
||||
# 20160906: libkqueue tests moved to /usr/tests/sys/kqueue/libkqueue
|
||||
OLD_FILES+=usr/tests/sys/kqueue/kqtest
|
||||
OLD_FILES+=usr/tests/sys/kqueue/kqueue_test
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ EFI_TARGET= efi-app-x86_64
|
|||
.else
|
||||
EFI_TARGET= binary
|
||||
.endif
|
||||
EFI_OBJCOPY?= elfcopy
|
||||
|
||||
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2024 00:00:00
|
||||
# for build reproducibility.
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ ${BOOT1}.efi: ${PROG}
|
|||
exit 1; \
|
||||
fi
|
||||
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
||||
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
||||
${EFI_OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
||||
-j .dynamic -j .dynsym -j .rel.dyn \
|
||||
-j .rela.dyn -j .reloc -j .eh_frame \
|
||||
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ ${LOADER}.efi: ${PROG}
|
|||
exit 1; \
|
||||
fi
|
||||
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
||||
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
||||
${EFI_OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
||||
-j .dynamic -j .dynsym -j .rel.dyn \
|
||||
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
|
||||
-j set_X${LOADER_INTERP}_compile_set \
|
||||
|
|
|
|||
|
|
@ -8125,6 +8125,7 @@ OLD_FILES+=usr/bin/cc
|
|||
OLD_FILES+=usr/bin/c88
|
||||
OLD_FILES+=usr/bin/c++
|
||||
OLD_FILES+=usr/bin/c++filt
|
||||
OLD_FILES+=usr/bin/elfcopy
|
||||
OLD_FILES+=usr/bin/ld
|
||||
OLD_FILES+=usr/bin/ld.bfd
|
||||
OLD_FILES+=usr/bin/nm
|
||||
|
|
@ -8135,6 +8136,7 @@ OLD_FILES+=usr/bin/strip
|
|||
OLD_FILES+=usr/bin/yacc
|
||||
OLD_FILES+=usr/share/man/man1/addr2line.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/c++filt.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/nm.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/readelf.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/size.1.gz
|
||||
|
|
|
|||
|
|
@ -247,7 +247,6 @@ SUBDIR.${MK_TFTP}+= tftp
|
|||
SUBDIR.${MK_TOOLCHAIN}+= addr2line
|
||||
SUBDIR.${MK_TOOLCHAIN}+= ar
|
||||
SUBDIR.${MK_TOOLCHAIN}+= nm
|
||||
SUBDIR.${MK_TOOLCHAIN}+= objcopy
|
||||
SUBDIR.${MK_TOOLCHAIN}+= readelf
|
||||
SUBDIR.${MK_TOOLCHAIN}+= size
|
||||
.endif
|
||||
|
|
@ -270,6 +269,8 @@ SUBDIR.${MK_TOOLCHAIN}+= indent
|
|||
SUBDIR.${MK_TOOLCHAIN}+= lex
|
||||
SUBDIR.${MK_TOOLCHAIN}+= lorder
|
||||
SUBDIR.${MK_TOOLCHAIN}+= mkstr
|
||||
# ELF Tool Chain elfcopy required for EFI objects (PR280771)
|
||||
SUBDIR.${MK_TOOLCHAIN}+= objcopy
|
||||
SUBDIR.${MK_TOOLCHAIN}+= rpcgen
|
||||
SUBDIR.${MK_TOOLCHAIN}+= unifdef
|
||||
SUBDIR.${MK_TOOLCHAIN}+= xstr
|
||||
|
|
|
|||
|
|
@ -7,12 +7,22 @@ ELFCOPYDIR= ${ELFTCDIR}/elfcopy
|
|||
|
||||
.PATH: ${ELFCOPYDIR}
|
||||
|
||||
PROG= objcopy
|
||||
PROG= elfcopy
|
||||
MAN= elfcopy.1
|
||||
|
||||
.if ${MK_LLVM_BINUTILS} == "no"
|
||||
|
||||
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/objcopy
|
||||
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/strip
|
||||
MAN+= objcopy.1 strip.1
|
||||
|
||||
objcopy.1: elfcopy.1
|
||||
sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
|
||||
-e '/\.Nm elfcopy ,/d' < ${.ALLSRC} > ${.TARGET}
|
||||
CLEANFILES+= objcopy.1
|
||||
|
||||
.endif
|
||||
|
||||
SRCS= archive.c ascii.c binary.c main.c pe.c sections.c segments.c symbols.c
|
||||
|
||||
WARNS?= 5
|
||||
|
|
@ -22,9 +32,7 @@ LIBADD= archive elftc elf pe
|
|||
CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
|
||||
CFLAGS+=-DWITH_PE=1
|
||||
|
||||
MAN= ${PROG}.1 strip.1
|
||||
|
||||
LINKS= ${BINDIR}/${PROG} ${BINDIR}/strip
|
||||
|
||||
# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
|
||||
# We need to link against the correct version of these files. One
|
||||
|
|
|
|||
Loading…
Reference in a new issue