diff options
| author | christos <christos@NetBSD.org> | 2016-06-16 11:34:13 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2016-06-16 11:34:13 +0000 |
| commit | 1cf8c0dfee67719e43b37f7ef7caa47650b1f980 (patch) | |
| tree | 3f4b3de4e9be9a56f01143f236146d5e87d99850 /libexec | |
| parent | cbb20312eaf185f339949cff723eef8edb0be93f (diff) | |
Move relro after we've computed out relocbase and re-enable it.
(Matthias Weckbecker)
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ld.elf_so/Makefile | 4 | ||||
| -rw-r--r-- | libexec/ld.elf_so/map_object.c | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libexec/ld.elf_so/Makefile b/libexec/ld.elf_so/Makefile index aff744de321..46255f5e4fa 100644 --- a/libexec/ld.elf_so/Makefile +++ b/libexec/ld.elf_so/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.132 2016/06/15 12:08:47 christos Exp $ +# $NetBSD: Makefile,v 1.133 2016/06/16 11:34:13 christos Exp $ # # NOTE: when changing ld.so, ensure that ldd still compiles. # @@ -93,7 +93,7 @@ BINDIR= ${SHLINKINSTALLDIR} CPPFLAGS+= -DLIBDIR=\"${LIBDIR}\" -D_PATH_RTLD=\"${BINDIR}/${PROG}\" CPPFLAGS+= -I${.CURDIR} -I. -D_KERNTYPES CPPFLAGS+= -DRTLD_LOADER -#CPPFLAGS+= -DGNU_RELRO +CPPFLAGS+= -DGNU_RELRO CPPFLAGS+= -D_RTLD_SOURCE CPPFLAGS+= -DCOMBRELOC #CPPFLAGS+= -DDEBUG diff --git a/libexec/ld.elf_so/map_object.c b/libexec/ld.elf_so/map_object.c index 849143e91aa..e83b27b908c 100644 --- a/libexec/ld.elf_so/map_object.c +++ b/libexec/ld.elf_so/map_object.c @@ -1,4 +1,4 @@ -/* $NetBSD: map_object.c,v 1.54 2016/06/14 13:06:41 christos Exp $ */ +/* $NetBSD: map_object.c,v 1.55 2016/06/16 11:34:13 christos Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -34,7 +34,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: map_object.c,v 1.54 2016/06/14 13:06:41 christos Exp $"); +__RCSID("$NetBSD: map_object.c,v 1.55 2016/06/16 11:34:13 christos Exp $"); #endif /* not lint */ #include <errno.h> @@ -282,11 +282,6 @@ _rtld_map_object(const char *path, int fd, const struct stat *sb) obj->vaddrbase = base_vaddr; obj->isdynamic = ehdr->e_type == ET_DYN; -#ifdef GNU_RELRO - obj->relro_page = obj->relocbase + round_down(relro_page); - obj->relro_size = round_up(relro_size); -#endif - #if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II) if (phtls != NULL) { ++_rtld_tls_dtv_generation; @@ -408,6 +403,11 @@ _rtld_map_object(const char *path, int fd, const struct stat *sb) obj->mapsize = mapsize; obj->relocbase = mapbase - base_vaddr; +#ifdef GNU_RELRO + obj->relro_page = obj->relocbase + round_down(relro_page); + obj->relro_size = round_up(relro_size); +#endif + if (obj->dynamic) obj->dynamic = (void *)(obj->relocbase + (Elf_Addr)(uintptr_t)obj->dynamic); if (obj->entry) |
