summaryrefslogtreecommitdiffstats
path: root/toolchain-layer/recipes-devtools/gcc/gcc-4.6/gcc-with-linker-hash-style.patch
blob: 94b61cdcc9b8cd206c72870c858c011e28a6767c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
Upstream-Status: Backport
Signed-off-by: Khem Raj <raj.khem@gmail.com>

commit 3cb9bbfa927aa187048534f9069202c017a78e38
Author: ppluzhnikov <ppluzhnikov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed May 11 18:28:14 2011 +0000

    2011-05-11  Satoru Takabayashi  <satorux@google.com>
    	    Paul Pluzhnikov  <ppluzhnikov@google.com>
    
    	* gcc/doc/install.texi (Configuration): Document
    	--with-linker-hash-style.
    	* gcc/gcc.c (init_spec): Handle LINKER_HASH_STYLE.
    	* gcc/config.in: Add LINKER_HASH_STYLE.
    	* gcc/configure.ac: Add --with-linker-hash-style.
    	* gcc/configure: Regenerate.
    
    
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173668 138bc75d-0d04-0410-961f-82ee72b054a4

Index: gcc-4_6-branch/gcc/config.in
===================================================================
--- gcc-4_6-branch.orig/gcc/config.in	2012-03-04 09:30:04.000000000 -0800
+++ gcc-4_6-branch/gcc/config.in	2012-03-04 09:32:30.878646575 -0800
@@ -1583,6 +1583,12 @@
 #endif
 
 
+/* The linker hash style */
+#ifndef USED_FOR_TARGET
+#undef LINKER_HASH_STYLE
+#endif
+
+
 /* Define to the name of the LTO plugin DSO that must be passed to the
    linker's -plugin=LIB option. */
 #ifndef USED_FOR_TARGET
Index: gcc-4_6-branch/gcc/configure
===================================================================
--- gcc-4_6-branch.orig/gcc/configure	2012-03-04 09:30:05.000000000 -0800
+++ gcc-4_6-branch/gcc/configure	2012-03-04 09:32:39.918647011 -0800
@@ -915,6 +915,7 @@
 enable_poison_system_directories
 enable_plugin
 enable_libquadmath_support
+with_linker_hash_style
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1667,6 +1668,8 @@
                           with the compiler
   --with-system-zlib      use installed libz
   --with-slibdir=DIR      shared libraries in DIR [LIBDIR]
+  --with-linker-hash-style={sysv,gnu,both}
+                          specify the linker hash style
 
 Some influential environment variables:
   CC          C compiler command
@@ -17501,7 +17504,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17504 "configure"
+#line 17507 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17607,7 +17610,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17610 "configure"
+#line 17613 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -26432,6 +26435,36 @@
 fi
 
 
+# Specify what hash style to use by default.
+
+# Check whether --with-linker-hash-style was given.
+if test "${with_linker_hash_style+set}" = set; then :
+  withval=$with_linker_hash_style; case x"$withval" in
+   xsysv)
+     LINKER_HASH_STYLE=sysv
+     ;;
+   xgnu)
+     LINKER_HASH_STYLE=gnu
+     ;;
+   xboth)
+     LINKER_HASH_STYLE=both
+     ;;
+   *)
+     as_fn_error "$withval is an invalid option to --with-linker-hash-style" "$LINENO" 5
+     ;;
+ esac
+else
+  LINKER_HASH_STYLE=''
+fi
+
+if test x"${LINKER_HASH_STYLE}" != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define LINKER_HASH_STYLE "$LINKER_HASH_STYLE"
+_ACEOF
+
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
Index: gcc-4_6-branch/gcc/configure.ac
===================================================================
--- gcc-4_6-branch.orig/gcc/configure.ac	2012-03-04 09:30:05.000000000 -0800
+++ gcc-4_6-branch/gcc/configure.ac	2012-03-04 09:32:30.890646574 -0800
@@ -4905,6 +4905,30 @@
 fi
 
 
+# Specify what hash style to use by default.
+AC_ARG_WITH([linker-hash-style],
+[AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
+                [specify the linker hash style])],
+[case x"$withval" in
+   xsysv)
+     LINKER_HASH_STYLE=sysv
+     ;;
+   xgnu)
+     LINKER_HASH_STYLE=gnu
+     ;;
+   xboth)
+     LINKER_HASH_STYLE=both
+     ;;
+   *)
+     AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style])
+     ;;
+ esac],
+[LINKER_HASH_STYLE=''])
+if test x"${LINKER_HASH_STYLE}" != x; then
+  AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE",
+                                         [The linker hash style])
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
Index: gcc-4_6-branch/gcc/doc/install.texi
===================================================================
--- gcc-4_6-branch.orig/gcc/doc/install.texi	2012-03-03 00:46:39.000000000 -0800
+++ gcc-4_6-branch/gcc/doc/install.texi	2012-03-04 09:32:30.894646574 -0800
@@ -1665,6 +1665,11 @@
 support @option{--build-id} option, a warning is issued and the
 @option{--enable-linker-build-id} option is ignored.  The default is off.
 
+@item --with-linker-hash-style=@var{choice}
+Tells GCC to pass @option{--hash-style=@var{choice}} option to the
+linker for all final links. @var{choice} can be one of
+@samp{sysv}, @samp{gnu}, and @samp{both} where @samp{sysv} is the default.
+
 @item --enable-gnu-unique-object
 @itemx --disable-gnu-unique-object
 Tells GCC to use the gnu_unique_object relocation for C++ template
Index: gcc-4_6-branch/gcc/gcc.c
===================================================================
--- gcc-4_6-branch.orig/gcc/gcc.c	2012-03-04 09:30:04.000000000 -0800
+++ gcc-4_6-branch/gcc/gcc.c	2012-03-04 09:32:30.894646574 -0800
@@ -1427,7 +1427,8 @@
   }
 #endif
 
-#if defined LINK_EH_SPEC || defined LINK_BUILDID_SPEC
+#if defined LINK_EH_SPEC || defined LINK_BUILDID_SPEC || \
+    defined LINKER_HASH_STYLE
 # ifdef LINK_BUILDID_SPEC
   /* Prepend LINK_BUILDID_SPEC to whatever link_spec we had before.  */
   obstack_grow (&obstack, LINK_BUILDID_SPEC, sizeof(LINK_BUILDID_SPEC) - 1);
@@ -1436,6 +1437,16 @@
   /* Prepend LINK_EH_SPEC to whatever link_spec we had before.  */
   obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
 # endif
+# ifdef LINKER_HASH_STYLE
+  /* Prepend --hash-style=LINKER_HASH_STYLE to whatever link_spec we had
+     before.  */
+  {
+    static const char hash_style[] = "--hash-style=";
+    obstack_grow (&obstack, hash_style, sizeof(hash_style) - 1);
+    obstack_grow (&obstack, LINKER_HASH_STYLE, sizeof(LINKER_HASH_STYLE) - 1);
+    obstack_1grow (&obstack, ' ');
+  }
+# endif
   obstack_grow0 (&obstack, link_spec, strlen (link_spec));
   link_spec = XOBFINISH (&obstack, const char *);
 #endif