Module Name:    src
Committed By:   christos
Date:           Thu Jun 16 11:34:13 UTC 2016

Modified Files:
        src/libexec/ld.elf_so: Makefile map_object.c

Log Message:
Move relro after we've computed out relocbase and re-enable it.
(Matthias Weckbecker)


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r1.54 -r1.55 src/libexec/ld.elf_so/map_object.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/Makefile
diff -u src/libexec/ld.elf_so/Makefile:1.132 src/libexec/ld.elf_so/Makefile:1.133
--- src/libexec/ld.elf_so/Makefile:1.132	Wed Jun 15 08:08:47 2016
+++ src/libexec/ld.elf_so/Makefile	Thu Jun 16 07:34:13 2016
@@ -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

Index: src/libexec/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.54 src/libexec/ld.elf_so/map_object.c:1.55
--- src/libexec/ld.elf_so/map_object.c:1.54	Tue Jun 14 09:06:41 2016
+++ src/libexec/ld.elf_so/map_object.c	Thu Jun 16 07:34:13 2016
@@ -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 f
 	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 f
 	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)

Reply via email to