Annotation of /trunk/glibc/patches/glibc-2.12.2-binutils-2.21.patch
Parent Directory | Revision Log
Revision 1256 -
(hide annotations)
(download)
Tue Jan 25 18:57:05 2011 UTC (13 years, 5 months ago) by niro
File size: 5453 byte(s)
Tue Jan 25 18:57:05 2011 UTC (13 years, 5 months ago) by niro
File size: 5453 byte(s)
added fix for newer binutils (>=2.21), see http://sourceware.org/bugzilla/show_bug.cgi?id=12343
1 | niro | 1256 | From 4a531bb0b3b582cb693de9f76d2d97d970f9a5d5 Mon Sep 17 00:00:00 2001 |
2 | From: H.J. Lu <hongjiu.lu@intel.com> | ||
3 | Date: Fri, 24 Dec 2010 20:14:37 -0500 | ||
4 | Subject: [PATCH] Remove `.ctors' and `.dtors' output sections | ||
5 | |||
6 | --- | ||
7 | ChangeLog | 15 ++ | ||
8 | config.h.in | 3 + | ||
9 | configure.in | 2 + | ||
10 | elf/sofini.c | 2 + | ||
11 | elf/soinit.c | 2 + | ||
12 | sysdeps/i386/init-first.c | 2 + | ||
13 | sysdeps/mach/hurd/i386/init-first.c | 2 +- | ||
14 | sysdeps/mach/hurd/powerpc/init-first.c | 2 +- | ||
15 | sysdeps/sh/init-first.c | 2 + | ||
16 | sysdeps/unix/sysv/linux/init-first.c | 2 +- | ||
17 | 11 files changed, 209 insertions(+), 159 deletions(-) | ||
18 | |||
19 | diff --git a/ChangeLog b/ChangeLog | ||
20 | index 958c76a..497de67 100644 | ||
21 | --- a/ChangeLog | ||
22 | +++ b/ChangeLog | ||
23 | @@ -1,3 +1,18 @@ | ||
24 | +2010-12-15 H.J. Lu <hongjiu.lu@intel.com> | ||
25 | + | ||
26 | + * config.h.in (NO_CTORS_DTORS_SECTIONS): Define. | ||
27 | + * configure.in: Define NO_CTORS_DTORS_SECTIONS if linker | ||
28 | + script has SORT_BY_INIT_PRIORITY. | ||
29 | + * elf/sofini.c: Remove `.ctors' and `.dtors' sections if | ||
30 | + NO_CTORS_DTORS_SECTIONS is defined. | ||
31 | + * elf/soinit.c: Likewise. | ||
32 | + * sysdeps/i386/init-first.c: Don't call __libc_global_ctors if | ||
33 | + NO_CTORS_DTORS_SECTIONS is defined. | ||
34 | + * sysdeps/mach/hurd/i386/init-first.c: Likewise. | ||
35 | + * sysdeps/mach/hurd/powerpc/init-first.c: Likewise. | ||
36 | + * sysdeps/sh/init-first.c: Likewise. | ||
37 | + * sysdeps/unix/sysv/linux/init-first.c: Likewise. | ||
38 | + | ||
39 | 2010-12-24 Ulrich Drepper <drepper@gmail.com> | ||
40 | |||
41 | * stdio-common/vfprintf.c (vfprintf): If printf handlers are installed | ||
42 | diff --git a/config.h.in b/config.h.in | ||
43 | index 18bf01a..9e797eb 100644 | ||
44 | --- a/config.h.in | ||
45 | +++ b/config.h.in | ||
46 | @@ -201,6 +201,9 @@ | ||
47 | /* Define if multi-arch DSOs should be generated. */ | ||
48 | #undef USE_MULTIARCH | ||
49 | |||
50 | +/* Define if `.ctors' and `.dtors' sections shouldn't be used. */ | ||
51 | +#undef NO_CTORS_DTORS_SECTIONS | ||
52 | + | ||
53 | /* | ||
54 | */ | ||
55 | |||
56 | diff --git a/configure.in b/configure.in | ||
57 | index d8cd5f1..ad25b9b 100644 | ||
58 | --- a/configure.in | ||
59 | +++ b/configure.in | ||
60 | @@ -1497,6 +1497,8 @@ EOF | ||
61 | rm -f conftest*]) | ||
62 | if test $libc_cv_initfini_array != yes; then | ||
63 | AC_MSG_ERROR([Need linker with .init_array/.fini_array support.]) | ||
64 | + elif AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep SORT_BY_INIT_PRIORITY 1>&AS_MESSAGE_LOG_FD]); then | ||
65 | + AC_DEFINE(NO_CTORS_DTORS_SECTIONS) | ||
66 | fi | ||
67 | |||
68 | AC_CACHE_CHECK(for libunwind-support in compiler, | ||
69 | diff --git a/elf/sofini.c b/elf/sofini.c | ||
70 | index 5e06f0c..13e74b7 100644 | ||
71 | --- a/elf/sofini.c | ||
72 | +++ b/elf/sofini.c | ||
73 | @@ -1,12 +1,14 @@ | ||
74 | /* Finalizer module for ELF shared C library. This provides terminating | ||
75 | null pointer words in the `.ctors' and `.dtors' sections. */ | ||
76 | |||
77 | +#ifndef NO_CTORS_DTORS_SECTIONS | ||
78 | static void (*const __CTOR_END__[1]) (void) | ||
79 | __attribute__ ((used, section (".ctors"))) | ||
80 | = { 0 }; | ||
81 | static void (*const __DTOR_END__[1]) (void) | ||
82 | __attribute__ ((used, section (".dtors"))) | ||
83 | = { 0 }; | ||
84 | +#endif | ||
85 | |||
86 | /* Terminate the frame unwind info section with a 4byte 0 as a sentinel; | ||
87 | this would be the 'length' field in a real FDE. */ | ||
88 | diff --git a/elf/soinit.c b/elf/soinit.c | ||
89 | index 6fecbb5..1db676a 100644 | ||
90 | --- a/elf/soinit.c | ||
91 | +++ b/elf/soinit.c | ||
92 | @@ -3,6 +3,7 @@ | ||
93 | the `.ctors' and `.dtors' sections so the lists are terminated, and | ||
94 | calling those lists of functions. */ | ||
95 | |||
96 | +#ifndef NO_CTORS_DTORS_SECTIONS | ||
97 | #include <libc-internal.h> | ||
98 | #include <stdlib.h> | ||
99 | |||
100 | @@ -40,3 +41,4 @@ __libc_fini (void) | ||
101 | |||
102 | void (*_fini_ptr) (void) __attribute__ ((section (".fini_array"))) | ||
103 | = &__libc_fini; | ||
104 | +#endif | ||
105 | diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c | ||
106 | index c6355a8..2af042f 100644 | ||
107 | --- a/sysdeps/i386/init-first.c | ||
108 | +++ b/sysdeps/i386/init-first.c | ||
109 | @@ -59,7 +59,9 @@ _init (int argc, ...) | ||
110 | { | ||
111 | init (&argc); | ||
112 | |||
113 | +#ifndef NO_CTORS_DTORS_SECTIONS | ||
114 | __libc_global_ctors (); | ||
115 | +#endif | ||
116 | } | ||
117 | #endif | ||
118 | |||
119 | diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c | ||
120 | index f9a7a58..60823bd 100644 | ||
121 | --- a/sysdeps/mach/hurd/i386/init-first.c | ||
122 | +++ b/sysdeps/mach/hurd/i386/init-first.c | ||
123 | @@ -92,7 +92,7 @@ posixland_init (int argc, char **argv, char **envp) | ||
124 | __getopt_clean_environment (envp); | ||
125 | #endif | ||
126 | |||
127 | -#ifdef SHARED | ||
128 | +#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS | ||
129 | __libc_global_ctors (); | ||
130 | #endif | ||
131 | } | ||
132 | diff --git a/sysdeps/mach/hurd/powerpc/init-first.c b/sysdeps/mach/hurd/powerpc/init-first.c | ||
133 | index 20fa1d4..21b5054 100644 | ||
134 | --- a/sysdeps/mach/hurd/powerpc/init-first.c | ||
135 | +++ b/sysdeps/mach/hurd/powerpc/init-first.c | ||
136 | @@ -82,7 +82,7 @@ posixland_init (int argc, char **argv, char **envp) | ||
137 | __getopt_clean_environment (__environ); | ||
138 | #endif | ||
139 | |||
140 | -#ifdef SHARED | ||
141 | +#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS | ||
142 | __libc_global_ctors (); | ||
143 | #endif | ||
144 | } | ||
145 | diff --git a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c | ||
146 | index d816625..1f3a821 100644 | ||
147 | --- a/sysdeps/sh/init-first.c | ||
148 | +++ b/sysdeps/sh/init-first.c | ||
149 | @@ -59,7 +59,9 @@ _init (int argc, ...) | ||
150 | { | ||
151 | init (&argc); | ||
152 | |||
153 | +#ifndef NO_CTORS_DTORS_SECTIONS | ||
154 | __libc_global_ctors (); | ||
155 | +#endif | ||
156 | } | ||
157 | #endif | ||
158 | |||
159 | diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c | ||
160 | index 7b2333d..a60212f 100644 | ||
161 | --- a/sysdeps/unix/sysv/linux/init-first.c | ||
162 | +++ b/sysdeps/unix/sysv/linux/init-first.c | ||
163 | @@ -93,7 +93,7 @@ _init (int argc, char **argv, char **envp) | ||
164 | __getopt_clean_environment (envp); | ||
165 | #endif | ||
166 | |||
167 | -#ifdef SHARED | ||
168 | +#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS | ||
169 | __libc_global_ctors (); | ||
170 | #endif | ||
171 | } | ||
172 | -- | ||
173 | 1.7.3.4 | ||
174 |