Allow overriding the tool used for stripping binaries
Since the make variable STRIP is already used for other purposes, this uses STRIPBIN (which is also used for the same purpose by install(1). This allows using LLVM objcopy to strip binaries instead of the in-tree elftoolchain objcopy. We make use of this in CheriBSD since passing binaries generated by our toolchain to elftoolchain strip sometimes results in assertion failures. This allows working around https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248516 by specifying STRIPBIN=/path/to/llvm-strip Obtained from: CheriBSD Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D25988
This commit is contained in:
parent
aa5dbc8953
commit
1a18ab420b
@ -180,7 +180,7 @@ MK_SYSTEM_LINKER= no
|
|||||||
.if defined(CROSS_TOOLCHAIN_PREFIX)
|
.if defined(CROSS_TOOLCHAIN_PREFIX)
|
||||||
CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
||||||
.endif
|
.endif
|
||||||
XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS
|
XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN
|
||||||
.for BINUTIL in ${XBINUTILS}
|
.for BINUTIL in ${XBINUTILS}
|
||||||
.if defined(CROSS_BINUTILS_PREFIX) && \
|
.if defined(CROSS_BINUTILS_PREFIX) && \
|
||||||
exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}})
|
exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}})
|
||||||
@ -755,7 +755,7 @@ CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \
|
|||||||
AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \
|
AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \
|
||||||
NM=${XNM} OBJCOPY="${XOBJCOPY}" \
|
NM=${XNM} OBJCOPY="${XOBJCOPY}" \
|
||||||
RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
|
RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
|
||||||
SIZE="${XSIZE}"
|
SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}"
|
||||||
|
|
||||||
.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
|
.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
|
||||||
# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
|
# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
|
||||||
|
@ -275,6 +275,7 @@ SHELL ?= sh
|
|||||||
|
|
||||||
.if !defined(%POSIX)
|
.if !defined(%POSIX)
|
||||||
SIZE ?= size
|
SIZE ?= size
|
||||||
|
STRIPBIN ?= strip
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
YACC ?= yacc
|
YACC ?= yacc
|
||||||
|
@ -64,7 +64,7 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
|
|||||||
-b ${BTXKERN} ${LOADER}.bin
|
-b ${BTXKERN} ${LOADER}.bin
|
||||||
|
|
||||||
${LOADER}.bin: ${LOADER}.sym
|
${LOADER}.bin: ${LOADER}.sym
|
||||||
strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
|
${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
|
||||||
|
|
||||||
.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
|
.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
|
||||||
LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/zfsloader
|
LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/zfsloader
|
||||||
|
@ -69,12 +69,12 @@ linux${SFX}_support.o: linux${SFX}_assym.h assym.inc
|
|||||||
${VDSO}.so: linux${SFX}_locore.o
|
${VDSO}.so: linux${SFX}_locore.o
|
||||||
${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd \
|
${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd \
|
||||||
--binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
|
--binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
|
||||||
strip -N _binary_linux${SFX}_locore_o_size ${.TARGET}
|
${STRIPBIN} -N _binary_linux${SFX}_locore_o_size ${.TARGET}
|
||||||
.else
|
.else
|
||||||
${VDSO}.so: linux${SFX}_locore.o
|
${VDSO}.so: linux${SFX}_locore.o
|
||||||
${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd \
|
${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd \
|
||||||
--binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
|
--binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
|
||||||
strip -N _binary_linux_locore_o_size ${.TARGET}
|
${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
linux${SFX}_genassym.o: offset.inc
|
linux${SFX}_genassym.o: offset.inc
|
||||||
|
@ -46,7 +46,7 @@ OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64
|
|||||||
${VDSO}.so: linux_locore.o
|
${VDSO}.so: linux_locore.o
|
||||||
${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \
|
${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \
|
||||||
linux_locore.o ${.TARGET}
|
linux_locore.o ${.TARGET}
|
||||||
strip -N _binary_linux_locore_o_size ${.TARGET}
|
${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET}
|
||||||
|
|
||||||
linux_support.o: assym.inc linux_assym.h
|
linux_support.o: assym.inc linux_assym.h
|
||||||
${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
|
${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
|
||||||
|
Loading…
Reference in New Issue
Block a user