opnsense-src/usr.bin/objcopy/Makefile
Ed Maste b885643b63 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
2025-03-23 18:17:03 -04:00

50 lines
1.2 KiB
Makefile

.include <src.opts.mk>
PACKAGE= elftoolchain
ELFTCDIR= ${SRCTOP}/contrib/elftoolchain
ELFCOPYDIR= ${ELFTCDIR}/elfcopy
.PATH: ${ELFCOPYDIR}
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
LIBADD= archive elftc elf pe
CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/libpe -I${ELFTCDIR}/common
CFLAGS+=-DWITH_PE=1
# 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
# solution is to include SRCTOP/sys in the include path. This causes
# problems when a header file in sys depends on a file in another
# part of the tree, e.g. a machine dependent header.
#
SRCS+= sys/elf_common.h
CLEANDIRS= sys
CFLAGS+= -I.
sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA
mkdir -p ${.OBJDIR}/sys
ln -sf ${.ALLSRC} ${.TARGET}
.include <bsd.prog.mk>