public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix ia64, alpha, sparc* with -z relro
@ 2004-02-19 22:28 Jakub Jelinek
  2004-02-20  5:41 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-02-19 22:28 UTC (permalink / raw)
  To: Ulrich Drepper, tcallawa; +Cc: Glibc hackers

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ia64, alpha, sparc* with -z relro
  2004-02-19 22:28 [PATCH] Fix ia64, alpha, sparc* with -z relro Jakub Jelinek
@ 2004-02-20  5:41 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-02-20  5:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: tcallawa, Glibc hackers

Jakub Jelinek wrote:

> 	* 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.

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-20  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-19 22:28 [PATCH] Fix ia64, alpha, sparc* with -z relro Jakub Jelinek
2004-02-20  5:41 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).