diff options
Diffstat (limited to 'libexec/rtld-elf/Makefile')
-rw-r--r-- | libexec/rtld-elf/Makefile | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 9ae998942a12..37c3840538d5 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -1,4 +1,3 @@ -# $FreeBSD$ # Use the following command to build local debug version of dynamic # linker: @@ -9,13 +8,22 @@ RTLD_ELF_DIR:= ${.PARSEDIR} .include <src.opts.mk> PACKAGE= clibs MK_PIE= no # Always position independent using local rules +# Not compatible with sanitizer instrumentation or SSP. +MK_ASAN= no MK_SSP= no +MK_UBSAN= no +.include <bsd.compat.pre.mk> + +.if !defined(NEED_COMPAT) CONFS= libmap.conf +.endif PROG?= ld-elf.so.1 -.if (${PROG:M*ld-elf32*} != "") -TAGS+= lib32 +.for _libcompat in ${_ALL_libcompats} +.if ${PROG:M*ld-elf${_libcompat}[-.]*} != "" +TAGS+= lib${_libcompat} .endif +.endfor SRCS= \ crtbrand.S \ rtld_start.S \ @@ -30,7 +38,7 @@ SRCS= \ libmap.c MAN?= rtld.1 ACFLAGS+= -DLOCORE -CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding +CFLAGS+= -Wall -DIN_RTLD -ffreestanding CFLAGS+= -I${SRCTOP}/lib/csu/common .if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH:S/powerpc64le/powerpc64/}) RTLD_ARCH= ${MACHINE_ARCH:S/powerpc64le/powerpc64/} @@ -52,9 +60,6 @@ CFLAGS+= -fpic -DPIC $(DEBUG) LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} # Pull in the dependencies that we use from libc .include "rtld-libc/Makefile.inc" -.if ${MK_TOOLCHAIN} == "no" -LDFLAGS+= -L${LIBCDIR} -.endif VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${RTLD_ELF_DIR}/Symbol.map @@ -68,6 +73,31 @@ SYMBOL_MAPS+= ${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map .sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc" RTLD_ENTRY?= .rtld_start +# Always produce the map file so that may be inspected to confirm +# undesired code is not linked from libsys/libc. +MAPFILE= ld-elf.so.1.map +LDFLAGS+= -Wl,-Map=${MAPFILE} -Wl,--cref +CLEANFILES+= ${MAPFILE} + +afterbuild: + @if grep __libsys_interposing ${MAPFILE} >/dev/null ; then \ + echo "libsys_interposing leaked" 1>&2 ; \ + exit 1 ; \ + fi + @if grep __libc_interposing ${MAPFILE} >/dev/null ; then \ + echo "libc_interposing leaked" 1>&2 ; \ + exit 1 ; \ + fi + @if grep xlocale ${MAPFILE} >/dev/null ; then \ + echo "xlocale leaked" 1>&2 ; \ + exit 1 ; \ + fi + @if grep fprintf ${MAPFILE} >/dev/null ; then \ + echo "stdio leaked" 1>&2 ; \ + exit 1 ; \ + fi + + # Since moving rtld-elf to /libexec, we need to create a symlink. # Fixup the existing binary that's there so we can symlink over it. beforeinstall: |