diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2019-05-10 13:29:22 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2019-05-10 13:29:22 +0000 |
commit | 7a997fa007d2414371c7b9fa2f4e83a0c3d406c2 (patch) | |
tree | ff8056bf55e605b407ec688972a67a4ab35dcd2b /libexec/ld.so/Makefile | |
parent | f16e61e66b2b5ec79eca82af98886596c97a38bb (diff) |
ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later
ok kettenis@
Diffstat (limited to 'libexec/ld.so/Makefile')
-rw-r--r-- | libexec/ld.so/Makefile | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile index ea50d59ae6f..da14f65f531 100644 --- a/libexec/ld.so/Makefile +++ b/libexec/ld.so/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.73 2018/08/29 15:56:46 robert Exp $ +# $OpenBSD: Makefile,v 1.74 2019/05/10 13:29:21 guenther Exp $ SUBDIR=ldconfig ldd MAN= ld.so.1 @@ -43,6 +43,11 @@ SRCS+= library.c .include "${.CURDIR}/${MACHINE_CPU}/Makefile.inc" .PATH: ${.CURDIR}/${MACHINE_CPU} +.ifdef LD_SCRIPT + ELF_LDFLAGS+=-T ${LD_SCRIPT} + CFLAGS += -DDO_CLEAN_BOOT +.endif + DEBUG?= -g CFLAGS += -fno-builtin CFLAGS += -Wall -Werror @@ -60,10 +65,10 @@ candidate= $(PROG).test CLEANFILES+= ${candidate} $(test_prog): - printf '#include <stdio.h>\nint main(int argc, char **argv){ printf("%%s: ", argv[0]); printf("%%s!\\n", argv[1] ? argv[1] : "foo"); }\n' | \ - $(CC) -P -x c - -Wl,-dynamic-linker,./$(candidate) -o $@ + printf '#include <stdio.h>\n#include <pthread.h>\nint main(int argc, char **argv){ pthread_attr_t attr; printf("%%s: ", argv[0]); pthread_attr_init(&attr); printf("%%s!\\n", argv[1] ? argv[1] : "foo"); }\n' | \ + $(CC) -P -x c - -Wl,-dynamic-linker,./$(candidate) -o $@ -lpthread -$(PROG): $(test_prog) ${VERSION_SCRIPT} $(OBJS) +$(PROG): $(test_prog) ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} .if defined(SYSPATCH_PATH) $(LD) ${DEBUG} -e _dl_start $(ELF_LDFLAGS) -o $(candidate) \ `readelf -Ws ${SYSPATCH_PATH}/usr/libexec/${.TARGET} | \ @@ -88,7 +93,7 @@ CLEANFILES+= ld.so.a all: ld.so.a -ld.so.a: ${OBJS} ${.CURDIR}/Symbols.map ${test_prog} +ld.so.a: ${OBJS} ${.CURDIR}/Symbols.map ${test_prog} ${LD_SCRIPT} ar cqD $@ $? afterinstall: ld.so.a |