summaryrefslogtreecommitdiff
path: root/recipes/glibc/glibc-2.4/zecke-sane-readelf.patch
blob: 2bc87974a126f09c2f57c2edc9b453b27bd26dda (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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
upstream: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3004
status: WONTFIX
comment: Use OEs version of the readelf version. There might be no
host system version (e.g. on OSX) or it is not multiarch.

Index: glibc-2.6.1/configure
===================================================================
--- glibc-2.6.1.orig/configure	2007-07-31 06:46:12.000000000 -0700
+++ glibc-2.6.1/configure	2008-09-12 16:38:06.000000000 -0700
@@ -5478,6 +5478,96 @@
     fi
   fi
 
+###  AC_CHECK_TARGET_TOOL([READELF],[readelf],[readelf],[$PATH])
+### XXXX copy and pasted
+# Check for readelf
+# Extract the first word of "$target_alias-readelf", so it can be a program name with args.
+set dummy $target_alias-readelf; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_READELF+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$READELF"; then
+  ac_cv_prog_READELF="$READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_READELF="$target_alias-readelf"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+READELF=$ac_cv_prog_READELF
+if test -n "$READELF"; then
+  { echo "$as_me:$LINENO: result: $READELF" >&5
+echo "${ECHO_T}$READELF" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+if test -z "$ac_cv_prog_READELF"; then
+  if test "$build" = "$target"; then
+    ac_ct_READELF=$READELF
+    # Extract the first word of "readelf", so it can be a program name with args.
+set dummy readelf; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_READELF+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_READELF"; then
+  ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_READELF="readelf"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_ac_ct_READELF" && ac_cv_prog_ac_ct_READELF="readelf"
+fi
+fi
+ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
+if test -n "$ac_ct_READELF"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
+echo "${ECHO_T}$ac_ct_READELF" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+    READELF=ac_ct_READELF
+  else
+    READELF="readelf"
+  fi
+else
+  READELF="$ac_cv_prog_READELF"
+fi
+
+### XXXX copy and pasted
+
   echo "$as_me:$LINENO: checking for .preinit_array/.init_array/.fini_array support" >&5
 echo $ECHO_N "checking for .preinit_array/.init_array/.fini_array support... $ECHO_C" >&6
 if test "${libc_cv_initfini_array+set}" = set; then
@@ -5497,7 +5587,7 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
   then
-    if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
+    if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
       libc_cv_initfini_array=yes
     else
       libc_cv_initfini_array=no
@@ -5797,7 +5887,7 @@
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
   then
-    if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
+    if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
       libc_cv_z_combreloc=yes
     else
       libc_cv_z_combreloc=no
Index: glibc-2.6.1/configure.in
===================================================================
--- glibc-2.6.1.orig/configure.in	2007-03-20 05:11:23.000000000 -0700
+++ glibc-2.6.1/configure.in	2008-09-12 16:38:26.000000000 -0700
@@ -1347,6 +1347,96 @@
     fi
   fi
 
+###  AC_CHECK_TARGET_TOOL([READELF],[readelf],[readelf],[$PATH])
+### XXXX copy and pasted
+# Check for readelf
+# Extract the first word of "$target_alias-readelf", so it can be a program name with args.
+set dummy $target_alias-readelf; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_READELF+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$READELF"; then
+  ac_cv_prog_READELF="$READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_READELF="$target_alias-readelf"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+READELF=$ac_cv_prog_READELF
+if test -n "$READELF"; then
+  { echo "$as_me:$LINENO: result: $READELF" >&5
+echo "${ECHO_T}$READELF" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+if test -z "$ac_cv_prog_READELF"; then
+  if test "$build" = "$target"; then
+    ac_ct_READELF=$READELF
+    # Extract the first word of "readelf", so it can be a program name with args.
+set dummy readelf; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_READELF+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_READELF"; then
+  ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_READELF="readelf"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_ac_ct_READELF" && ac_cv_prog_ac_ct_READELF="readelf"
+fi
+fi
+ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
+if test -n "$ac_ct_READELF"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
+echo "${ECHO_T}$ac_ct_READELF" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+    READELF=ac_ct_READELF
+  else
+    READELF="readelf"
+  fi
+else
+  READELF="$ac_cv_prog_READELF"
+fi
+
+### XXXX copy and pasted
+
   AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
 		 libc_cv_initfini_array, [dnl
   cat > conftest.c <<EOF
@@ -1358,7 +1448,7 @@
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
 		     -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
   then
-    if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
+    if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
       libc_cv_initfini_array=yes
     else
       libc_cv_initfini_array=no
@@ -1543,7 +1633,7 @@
 dnl introducing new options this is not easily doable.  Instead use a tool
 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
 dnl look for a section named .rel.dyn.
-    if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
+    if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
       libc_cv_z_combreloc=yes
     else
       libc_cv_z_combreloc=no