This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ia64, alpha, sparc* with -z relro


Hi!

Tom, does this cure your sparc* build problems?

2004-02-19  Jakub Jelinek  <jakub@redhat.com>

	* elf/rtld.c (_dl_argv): If DL_ARGV_NOT_RELRO defined, don't
	use attribute_relro for _dl_argv.
	* sysdeps/alpha/dl-machine.h (DL_ARGV_NOT_RELRO): Define.
	* sysdeps/ia64/dl-machine.h (DL_ARGV_NOT_RELRO): Define.
	* sysdeps/sparc/sparc32/dl-machine.h (DL_ARGV_NOT_RELRO): Define.
	* sysdeps/sparc/sparc64/dl-machine.h (DL_ARGV_NOT_RELRO): Define.

--- libc/elf/rtld.c.jj	2004-02-19 17:50:33.000000000 +0100
+++ libc/elf/rtld.c	2004-02-19 22:52:00.563917040 +0100
@@ -68,7 +68,11 @@ enum mode { normal, list, verify, trace 
 static void process_envvars (enum mode *modep);
 
 int _dl_argc attribute_relro attribute_hidden;
+#ifdef DL_ARGV_NOT_RELRO
+char **_dl_argv = NULL;
+#else
 char **_dl_argv attribute_relro = NULL;
+#endif
 INTDEF(_dl_argv)
 
 /* Nonzero if we were run directly.  */
--- libc/sysdeps/alpha/dl-machine.h.jj	2004-01-27 15:44:24.000000000 +0100
+++ libc/sysdeps/alpha/dl-machine.h	2004-02-19 22:55:04.815906480 +0100
@@ -293,6 +293,10 @@ elf_machine_runtime_setup (struct link_m
   strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
 #endif
 
+/* _dl_argv cannot be attribute_relro, because _dl_start_user below
+   might write into it after _dl_start returns.  */
+#define DL_ARGV_NOT_RELRO 1
+
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
--- libc/sysdeps/sparc/sparc32/dl-machine.h.jj	2003-10-02 21:51:11.000000000 +0200
+++ libc/sysdeps/sparc/sparc32/dl-machine.h	2004-02-19 22:58:02.427905352 +0100
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SPARC version.
-   Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -253,6 +253,10 @@ elf_machine_runtime_setup (struct link_m
 #define DL_STACK_END(cookie) \
   ((void *) (((long) (cookie)) - (22 - 6) * 4))
 
+/* _dl_argv cannot be attribute_relro, because _dl_start_user below
+   might write into it after _dl_start returns.  */
+#define DL_ARGV_NOT_RELRO 1
+
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
--- libc/sysdeps/sparc/sparc64/dl-machine.h.jj	2003-10-02 21:51:12.000000000 +0200
+++ libc/sysdeps/sparc/sparc64/dl-machine.h	2004-02-19 22:59:15.593782448 +0100
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  Sparc64 version.
-   Copyright (C) 1997,1998,1999,2000,2001,2002, 2003
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -671,6 +671,10 @@ elf_machine_runtime_setup (struct link_m
 #define DL_STACK_END(cookie) \
   ((void *) (((long) (cookie)) - (22 - 6) * 8 - STACK_BIAS))
 
+/* _dl_argv cannot be attribute_relro, because _dl_start_user below
+   might write into it after _dl_start returns.  */
+#define DL_ARGV_NOT_RELRO 1
+
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
--- libc/sysdeps/ia64/dl-machine.h.jj	2003-12-11 22:23:17.000000000 +0100
+++ libc/sysdeps/ia64/dl-machine.h	2004-02-19 22:56:30.615862904 +0100
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  IA-64 version.
-   Copyright (C) 1995-1997, 2000-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 2000-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -272,6 +272,10 @@ elf_machine_runtime_setup (struct link_m
 #define DL_STACK_END(cookie) \
   ((void *) (((long) (cookie)) - 16))
 
+/* _dl_argv cannot be attribute_relro, because _dl_start_user below
+   might write into it after _dl_start returns.  */
+#define DL_ARGV_NOT_RELRO 1
+
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]