Allow ELF Tool Chain elfcopy to be installed as objcopy
ELF Tool Chain elfcopy is nearly a drop-in replacement for GNU objcopy, but does not currently support PE output which is needed for building x86 UEFI bits. Add a src.conf knob to allow installing it as objcopy and set it by default for aarch64 only, where we don't have a native binutils. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2887
This commit is contained in:
parent
2d83b16bd4
commit
5ea9e83e2f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286030
@ -11,7 +11,7 @@ SUBDIR= doc\
|
|||||||
as \
|
as \
|
||||||
ld \
|
ld \
|
||||||
${_nm} \
|
${_nm} \
|
||||||
objcopy \
|
${_objcopy} \
|
||||||
objdump \
|
objdump \
|
||||||
${_readelf} \
|
${_readelf} \
|
||||||
${_size} \
|
${_size} \
|
||||||
@ -26,5 +26,8 @@ _size= size
|
|||||||
_strings= strings
|
_strings= strings
|
||||||
_strip= strip
|
_strip= strip
|
||||||
.endif
|
.endif
|
||||||
|
.if ${MK_ELFTOOLCHAIN_TOOLS} == "no" || ${MK_ELFCOPY_AS_OBJCOPY} == "no"
|
||||||
|
_objcopy= objcopy
|
||||||
|
.endif
|
||||||
|
|
||||||
.include <bsd.subdir.mk>
|
.include <bsd.subdir.mk>
|
||||||
|
@ -234,6 +234,9 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
|
|||||||
.endif
|
.endif
|
||||||
.if ${__T} == "aarch64"
|
.if ${__T} == "aarch64"
|
||||||
BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
|
BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
|
||||||
|
__DEFAULT_YES_OPTIONS+=ELFCOPY_AS_OBJCOPY
|
||||||
|
.else
|
||||||
|
__DEFAULT_NO_OPTIONS+=ELFCOPY_AS_OBJCOPY
|
||||||
.endif
|
.endif
|
||||||
# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
|
# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
|
||||||
.if ${__T} == "arm" || ${__T} == "armeb"
|
.if ${__T} == "arm" || ${__T} == "armeb"
|
||||||
|
@ -184,7 +184,9 @@ OLD_DIRS+=usr/share/examples/bhyve
|
|||||||
.if ${MK_BINUTILS} == no
|
.if ${MK_BINUTILS} == no
|
||||||
OLD_FILES+=usr/bin/as
|
OLD_FILES+=usr/bin/as
|
||||||
OLD_FILES+=usr/bin/ld
|
OLD_FILES+=usr/bin/ld
|
||||||
|
.if ${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} == no
|
||||||
OLD_FILES+=usr/bin/objcopy
|
OLD_FILES+=usr/bin/objcopy
|
||||||
|
.endif
|
||||||
OLD_FILES+=usr/bin/objdump
|
OLD_FILES+=usr/bin/objdump
|
||||||
OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x
|
OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x
|
||||||
OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn
|
OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn
|
||||||
@ -201,7 +203,9 @@ OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xu
|
|||||||
OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xw
|
OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xw
|
||||||
OLD_FILES+=usr/share/man/man1/as.1.gz
|
OLD_FILES+=usr/share/man/man1/as.1.gz
|
||||||
OLD_FILES+=usr/share/man/man1/ld.1.gz
|
OLD_FILES+=usr/share/man/man1/ld.1.gz
|
||||||
|
.if ${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} == no
|
||||||
OLD_FILES+=usr/share/man/man1/objcopy.1.gz
|
OLD_FILES+=usr/share/man/man1/objcopy.1.gz
|
||||||
|
.endif
|
||||||
OLD_FILES+=usr/share/man/man1/objdump.1.gz
|
OLD_FILES+=usr/share/man/man1/objdump.1.gz
|
||||||
OLD_FILES+=usr/share/man/man7/as.7.gz
|
OLD_FILES+=usr/share/man/man7/as.7.gz
|
||||||
OLD_FILES+=usr/share/man/man7/ld.7.gz
|
OLD_FILES+=usr/share/man/man7/ld.7.gz
|
||||||
@ -1646,7 +1650,8 @@ OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/ee.cat
|
|||||||
OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
|
OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_ELFTOOLCHAIN_TOOLS} == no
|
.if ${MK_ELFTOOLCHAIN_TOOLS} == no || \
|
||||||
|
(${MK_ELFTOOLCHAIN_TOOLS} != no && MK_ELFCOPY_AS_OBJCOPY != no)
|
||||||
OLD_FILES+=usr/bin/elfcopy
|
OLD_FILES+=usr/bin/elfcopy
|
||||||
OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
|
OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
|
||||||
.endif
|
.endif
|
||||||
|
4
tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY
Normal file
4
tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.\" $FreeBSD$
|
||||||
|
Set to build and install
|
||||||
|
.Xr objcopy 1
|
||||||
|
from GNU Binutils, instead of the one from ELF Tool Chain.
|
4
tools/build/options/WITH_ELFCOPY_AS_OBJCOPY
Normal file
4
tools/build/options/WITH_ELFCOPY_AS_OBJCOPY
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.\" $FreeBSD$
|
||||||
|
Set to build and install ELF Tool Chain's elfcopy as
|
||||||
|
.Xr objcopy 1 ,
|
||||||
|
instead of the one from GNU Binutils.
|
@ -7,7 +7,15 @@ ELFCOPYDIR= ${ELFTCDIR}/elfcopy
|
|||||||
|
|
||||||
.PATH: ${ELFCOPYDIR}
|
.PATH: ${ELFCOPYDIR}
|
||||||
|
|
||||||
|
.if ${MK_ELFCOPY_AS_OBJCOPY} != "no"
|
||||||
|
PROG= objcopy
|
||||||
|
objcopy.1: elfcopy.1
|
||||||
|
sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \
|
||||||
|
-e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET}
|
||||||
|
CLEANFILES+= objcopy.1
|
||||||
|
.else
|
||||||
PROG= elfcopy
|
PROG= elfcopy
|
||||||
|
.endif
|
||||||
|
|
||||||
SRCS= archive.c ascii.c binary.c main.c sections.c segments.c symbols.c
|
SRCS= archive.c ascii.c binary.c main.c sections.c segments.c symbols.c
|
||||||
|
|
||||||
@ -17,8 +25,8 @@ LIBADD= archive elftc elf
|
|||||||
|
|
||||||
CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
|
CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
|
||||||
|
|
||||||
MAN= elfcopy.1 strip.1
|
MAN= ${PROG}.1 strip.1
|
||||||
|
|
||||||
LINKS= ${BINDIR}/elfcopy ${BINDIR}/strip
|
LINKS= ${BINDIR}/${PROG} ${BINDIR}/strip
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
Loading…
Reference in New Issue
Block a user