diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2019-11-07 22:58:10 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2019-11-07 22:58:10 +0000 |
commit | a4330302f22d45d4158204b2d5d7c6738100f3a5 (patch) | |
tree | 9cb152bfad3e48051a626a02a237af9104e6929c /libexec | |
parent | 273b2e4c55f5de86ed5d2fea0a00677f944cbd9d (diff) | |
download | src-a4330302f22d45d4158204b2d5d7c6738100f3a5.tar.gz src-a4330302f22d45d4158204b2d5d7c6738100f3a5.zip |
libcompat: build 32-bit rtld and ldd as part of "everything"
Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.
Alter .PATH and CFLAGS settings in work when the Makefile is included.
While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.
The net effect of this change is to make Makefile.libcompat only build
compatability libraries.
Changes relative to r354449:
Correct detection of the compiler type when bsd.compat.mk is used
outside Makefile.libcompat. Previously it always matched the clang
case.
Set LDFLAGS including the linker emulation for mips where -m32 seems to
be insufficent.
Reviewed by: imp, kib (origional version in r354449)
Obtained from: CheriBSD (conceptually)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22251
Notes
Notes:
svn path=/head/; revision=354491
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/Makefile | 1 | ||||
-rw-r--r-- | libexec/rtld-elf/Makefile | 20 | ||||
-rw-r--r-- | libexec/rtld-elf32/Makefile | 10 |
3 files changed, 23 insertions, 8 deletions
diff --git a/libexec/Makefile b/libexec/Makefile index 89688daafb59..4ac65066619d 100644 --- a/libexec/Makefile +++ b/libexec/Makefile @@ -74,6 +74,7 @@ _tftp-proxy= tftp-proxy .if !defined(NO_PIC) && !defined(NO_RTLD) _rtld-elf= rtld-elf +SUBDIR.${MK_LIB32}+= rtld-elf32 .endif .if ${MK_RBOOTD} != "no" diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 0bbfbb89301e..67ec1eb35cb0 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -4,6 +4,8 @@ # linker: # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all +RTLD_ELF_DIR:= ${.PARSEDIR} + .include <src.opts.mk> PACKAGE= clibs MK_PIE= no # Always position independent using local rules @@ -25,16 +27,16 @@ SRCS= \ xmalloc.c \ debug.c \ libmap.c -MAN= rtld.1 +MAN?= rtld.1 CSTD?= gnu99 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding CFLAGS+= -I${SRCTOP}/lib/csu/common -.if exists(${.CURDIR}/${MACHINE_ARCH}) +.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH}) RTLD_ARCH= ${MACHINE_ARCH} .else RTLD_ARCH= ${MACHINE_CPUARCH} .endif -CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} +CFLAGS+= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR} .if ${MACHINE_ARCH} == "powerpc64" LDFLAGS+= -nostdlib -e _rtld_start .else @@ -81,16 +83,16 @@ LIBADD+= compiler_rt .if ${MK_SYMVER} == "yes" VERSION_DEF= ${LIBCSRCDIR}/Versions.def -SYMBOL_MAPS= ${.CURDIR}/Symbol.map +SYMBOL_MAPS= ${RTLD_ELF_DIR}/Symbol.map VERSION_MAP= Version.map LDFLAGS+= -Wl,--version-script=${VERSION_MAP} -.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) -SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map +.if exists(${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map) +SYMBOL_MAPS+= ${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" +.sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc" # 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. @@ -99,10 +101,12 @@ beforeinstall: -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} .endif -.PATH: ${.CURDIR}/${RTLD_ARCH} +.PATH: ${RTLD_ELF_DIR}/${RTLD_ARCH} +.if ${.CURDIR} == ${RTLD_ELF_DIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +.endif .include <bsd.prog.mk> ${PROG_FULL}: ${VERSION_MAP} diff --git a/libexec/rtld-elf32/Makefile b/libexec/rtld-elf32/Makefile new file mode 100644 index 000000000000..5b4c2e9c4007 --- /dev/null +++ b/libexec/rtld-elf32/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +NEED_COMPAT= 32 +.include <bsd.compat.mk> + +PROG= ld-elf32.so.1 +MAN= + +.PATH: ${SRCTOP}/libexec/rtld-elf +.include "${SRCTOP}/libexec/rtld-elf/Makefile" |