Initial commit
[kopensolaris-gnu/patches.git] / binutils-2.18.1.diff
1 diff -uraN binutils-2.18.1~cvs20080103.orig/debian/patches/00list binutils-2.18.1~cvs20080103/debian/patches/00list
2 --- binutils-2.18.1~cvs20080103.orig/debian/patches/00list      2008-10-01 23:49:16.000000000 -0400
3 +++ binutils-2.18.1~cvs20080103/debian/patches/00list   2008-10-01 23:41:14.536458895 -0400
4 @@ -11,3 +11,5 @@
5  308_mips-pic
6  309_m68k-pie
7  310_hppa-gas-unused
8 +336_kopensolaris-gnu
9 +337_execlastload
10 diff -uraN binutils-2.18.1~cvs20080103.orig/debian/patches/336_kopensolaris-gnu.dpatch binutils-2.18.1~cvs20080103/debian/patches/336_kopensolaris-gnu.dpatch
11 --- binutils-2.18.1~cvs20080103.orig/debian/patches/336_kopensolaris-gnu.dpatch 1969-12-31 19:00:00.000000000 -0500
12 +++ binutils-2.18.1~cvs20080103/debian/patches/336_kopensolaris-gnu.dpatch      2008-10-01 23:41:14.537098866 -0400
13 @@ -0,0 +1,442 @@
14 +#! /bin/sh /usr/share/dpatch/dpatch-run
15 +## 371_kopensolaris-gnu.dpatch by  <root@maltodextrin.csclub.uwaterloo.ca>
16 +##
17 +## All lines beginning with `## DP:' are a description of the patch.
18 +## DP: No description.
19 +
20 +@DPATCH@
21 +diff -urNad binutils-2.18.1~cvs20080103~/bfd/config.bfd binutils-2.18.1~cvs20080103/bfd/config.bfd
22 +--- binutils-2.18.1~cvs20080103~/bfd/config.bfd        2007-09-18 10:26:21.000000000 -0400
23 ++++ binutils-2.18.1~cvs20080103/bfd/config.bfd 2008-09-25 05:16:44.001280109 -0400
24 +@@ -482,7 +482,7 @@
25 +     targ_defvec=bfd_elf32_i386_vec
26 +     targ_selvecs=i386coff_vec
27 +     ;;
28 +-  i[3-7]86-*-solaris2*)
29 ++  i[3-7]86-*-solaris2* | i[3-7]86-*-kopensolaris*-gnu*)
30 +     targ_defvec=bfd_elf32_i386_vec
31 +     targ_selvecs=i386coff_vec
32 +     targ64_selvecs=bfd_elf64_x86_64_vec
33 +diff -urNad binutils-2.18.1~cvs20080103~/bfd/configure binutils-2.18.1~cvs20080103/bfd/configure
34 +--- binutils-2.18.1~cvs20080103~/bfd/configure 2008-01-03 15:51:01.000000000 -0500
35 ++++ binutils-2.18.1~cvs20080103/bfd/configure  2008-09-25 05:18:53.985970063 -0400
36 +@@ -5029,7 +5029,7 @@
37 +   ;;
38
39 + # This must be Linux ELF.
40 +-linux* | k*bsd*-gnu)
41 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
42 +   lt_cv_deplibs_check_method=pass_all
43 +   ;;
44
45 +@@ -6998,7 +6998,7 @@
46 +       lt_prog_compiler_static='-non_shared'
47 +       ;;
48
49 +-    linux* | k*bsd*-gnu)
50 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
51 +       case $cc_basename in
52 +       icc* | ecc*)
53 +       lt_prog_compiler_wl='-Wl,'
54 +@@ -7539,7 +7539,7 @@
55 +       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
56 +       ;;
57
58 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
59 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
60 +       tmp_diet=no
61 +       if test "$host_os" = linux-dietlibc; then
62 +       case $cc_basename in
63 +@@ -9089,7 +9089,7 @@
64 +   ;;
65
66 + # This must be Linux ELF.
67 +-linux* | k*bsd*-gnu)
68 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
69 +   version_type=linux
70 +   need_lib_prefix=no
71 +   need_version=no
72 +diff -urNad binutils-2.18.1~cvs20080103~/binutils/configure binutils-2.18.1~cvs20080103/binutils/configure
73 +--- binutils-2.18.1~cvs20080103~/binutils/configure    2007-07-16 06:11:01.000000000 -0400
74 ++++ binutils-2.18.1~cvs20080103/binutils/configure     2008-09-25 05:17:23.202124129 -0400
75 +@@ -4860,7 +4860,7 @@
76 +   ;;
77
78 + # This must be Linux ELF.
79 +-linux* | k*bsd*-gnu)
80 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
81 +   lt_cv_deplibs_check_method=pass_all
82 +   ;;
83
84 +@@ -6829,7 +6829,7 @@
85 +       lt_prog_compiler_static='-non_shared'
86 +       ;;
87
88 +-    linux* | k*bsd*-gnu)
89 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
90 +       case $cc_basename in
91 +       icc* | ecc*)
92 +       lt_prog_compiler_wl='-Wl,'
93 +@@ -7370,7 +7370,7 @@
94 +       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
95 +       ;;
96
97 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
98 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
99 +       tmp_diet=no
100 +       if test "$host_os" = linux-dietlibc; then
101 +       case $cc_basename in
102 +@@ -8920,7 +8920,7 @@
103 +   ;;
104
105 + # This must be Linux ELF.
106 +-linux* | k*bsd*-gnu)
107 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
108 +   version_type=linux
109 +   need_lib_prefix=no
110 +   need_version=no
111 +diff -urNad binutils-2.18.1~cvs20080103~/configure binutils-2.18.1~cvs20080103/configure
112 +--- binutils-2.18.1~cvs20080103~/configure     2007-11-21 03:50:52.000000000 -0500
113 ++++ binutils-2.18.1~cvs20080103/configure      2008-09-25 05:18:52.479962900 -0400
114 +@@ -2086,7 +2086,7 @@
115 + # Disable libmudflap on some systems.
116 + if test x$enable_libmudflap = x ; then
117 +     case "${target}" in
118 +-    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | bfin*-*-uclinux*)
119 ++    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu | bfin*-*-uclinux*)
120 +         # Enable libmudflap by default in GNU and friends.
121 +       ;;
122 +     *-*-freebsd*)
123 +@@ -2103,7 +2103,7 @@
124 + if test x$enable_libgomp = x ; then
125 +     # Enable libgomp by default on hosted POSIX systems.
126 +     case "${target}" in
127 +-    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
128 ++    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu)
129 +       ;;
130 +     *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
131 +       ;;
132 +@@ -2562,7 +2562,7 @@
133 +   ip2k-*-*)
134 +     noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
135 +     ;;
136 +-  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
137 ++  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu)
138 +     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
139 +     ;;
140 +   *-*-lynxos*)
141 +@@ -5224,7 +5224,7 @@
142 +   *-*-netware*)
143 +     target_makefile_frag="config/mt-netware"
144 +     ;;
145 +-  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
146 ++  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu)
147 +     target_makefile_frag="config/mt-gnu"
148 +     ;;
149 +   *-*-aix4.[3456789]* | *-*-aix[56789].*)
150 +diff -urNad binutils-2.18.1~cvs20080103~/configure.ac binutils-2.18.1~cvs20080103/configure.ac
151 +--- binutils-2.18.1~cvs20080103~/configure.ac  2007-11-21 03:50:52.000000000 -0500
152 ++++ binutils-2.18.1~cvs20080103/configure.ac   2008-09-25 05:19:11.918172476 -0400
153 +@@ -364,7 +364,7 @@
154 + # Disable libmudflap on some systems.
155 + if test x$enable_libmudflap = x ; then
156 +     case "${target}" in
157 +-    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | bfin*-*-uclinux*)
158 ++    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu | bfin*-*-uclinux*)
159 +         # Enable libmudflap by default in GNU and friends.
160 +       ;;
161 +     *-*-freebsd*)
162 +@@ -381,7 +381,7 @@
163 + if test x$enable_libgomp = x ; then
164 +     # Enable libgomp by default on hosted POSIX systems.
165 +     case "${target}" in
166 +-    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
167 ++    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu)
168 +       ;;
169 +     *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
170 +       ;;
171 +@@ -840,7 +840,7 @@
172 +   ip2k-*-*)
173 +     noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
174 +     ;;
175 +-  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
176 ++  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu)
177 +     noconfigdirs="$noconfigdirs target-newlib target-libgloss"
178 +     ;;
179 +   *-*-lynxos*)
180 +@@ -1748,7 +1748,7 @@
181 +   *-*-netware*)
182 +     target_makefile_frag="config/mt-netware"
183 +     ;;
184 +-  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
185 ++  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | kopensolaris*-gnu)
186 +     target_makefile_frag="config/mt-gnu"
187 +     ;;
188 +   *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
189 +diff -urNad binutils-2.18.1~cvs20080103~/gas/configure binutils-2.18.1~cvs20080103/gas/configure
190 +--- binutils-2.18.1~cvs20080103~/gas/configure 2007-06-14 11:31:00.000000000 -0400
191 ++++ binutils-2.18.1~cvs20080103/gas/configure  2008-09-25 05:19:14.782142257 -0400
192 +@@ -4122,7 +4122,7 @@
193 +   ;;
194
195 + # This must be Linux ELF.
196 +-linux* | k*bsd*-gnu)
197 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
198 +   lt_cv_deplibs_check_method=pass_all
199 +   ;;
200
201 +@@ -6091,7 +6091,7 @@
202 +       lt_prog_compiler_static='-non_shared'
203 +       ;;
204
205 +-    linux* | k*bsd*-gnu)
206 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
207 +       case $cc_basename in
208 +       icc* | ecc*)
209 +       lt_prog_compiler_wl='-Wl,'
210 +@@ -6632,7 +6632,7 @@
211 +       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
212 +       ;;
213
214 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
215 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
216 +       tmp_diet=no
217 +       if test "$host_os" = linux-dietlibc; then
218 +       case $cc_basename in
219 +@@ -8182,7 +8182,7 @@
220 +   ;;
221
222 + # This must be Linux ELF.
223 +-linux* | k*bsd*-gnu)
224 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
225 +   version_type=linux
226 +   need_lib_prefix=no
227 +   need_version=no
228 +diff -urNad binutils-2.18.1~cvs20080103~/gprof/configure binutils-2.18.1~cvs20080103/gprof/configure
229 +--- binutils-2.18.1~cvs20080103~/gprof/configure       2007-08-13 03:08:48.000000000 -0400
230 ++++ binutils-2.18.1~cvs20080103/gprof/configure        2008-09-25 05:19:10.331107631 -0400
231 +@@ -4120,7 +4120,7 @@
232 +   ;;
233
234 + # This must be Linux ELF.
235 +-linux* | k*bsd*-gnu)
236 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
237 +   lt_cv_deplibs_check_method=pass_all
238 +   ;;
239
240 +@@ -6089,7 +6089,7 @@
241 +       lt_prog_compiler_static='-non_shared'
242 +       ;;
243
244 +-    linux* | k*bsd*-gnu)
245 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
246 +       case $cc_basename in
247 +       icc* | ecc*)
248 +       lt_prog_compiler_wl='-Wl,'
249 +@@ -6630,7 +6630,7 @@
250 +       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
251 +       ;;
252
253 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
254 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
255 +       tmp_diet=no
256 +       if test "$host_os" = linux-dietlibc; then
257 +       case $cc_basename in
258 +@@ -8180,7 +8180,7 @@
259 +   ;;
260
261 + # This must be Linux ELF.
262 +-linux* | k*bsd*-gnu)
263 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
264 +   version_type=linux
265 +   need_lib_prefix=no
266 +   need_version=no
267 +diff -urNad binutils-2.18.1~cvs20080103~/ld/configure binutils-2.18.1~cvs20080103/ld/configure
268 +--- binutils-2.18.1~cvs20080103~/ld/configure  2007-08-13 03:08:57.000000000 -0400
269 ++++ binutils-2.18.1~cvs20080103/ld/configure   2008-09-25 05:19:08.674911989 -0400
270 +@@ -4123,7 +4123,7 @@
271 +   ;;
272
273 + # This must be Linux ELF.
274 +-linux* | k*bsd*-gnu)
275 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
276 +   lt_cv_deplibs_check_method=pass_all
277 +   ;;
278
279 +@@ -6092,7 +6092,7 @@
280 +       lt_prog_compiler_static='-non_shared'
281 +       ;;
282
283 +-    linux* | k*bsd*-gnu)
284 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
285 +       case $cc_basename in
286 +       icc* | ecc*)
287 +       lt_prog_compiler_wl='-Wl,'
288 +@@ -6633,7 +6633,7 @@
289 +       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
290 +       ;;
291
292 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
293 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
294 +       tmp_diet=no
295 +       if test "$host_os" = linux-dietlibc; then
296 +       case $cc_basename in
297 +@@ -8183,7 +8183,7 @@
298 +   ;;
299
300 + # This must be Linux ELF.
301 +-linux* | k*bsd*-gnu)
302 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
303 +   version_type=linux
304 +   need_lib_prefix=no
305 +   need_version=no
306 +diff -urNad binutils-2.18.1~cvs20080103~/ld/configure.host binutils-2.18.1~cvs20080103/ld/configure.host
307 +--- binutils-2.18.1~cvs20080103~/ld/configure.host     2007-09-18 10:26:52.000000000 -0400
308 ++++ binutils-2.18.1~cvs20080103/ld/configure.host      2008-09-25 05:16:44.001654824 -0400
309 +@@ -73,6 +73,11 @@
310 +   HOSTING_LIBS="$HOSTING_LIBS /usr/lib/crtend.o"
311 +   ;;
312
313 ++*-*-kopensolaris*-gnu*)
314 ++  HOSTING_CRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[     ][      ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
315 ++  HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
316 ++  ;;
317 ++
318 + esac
319
320 + #
321 +diff -urNad binutils-2.18.1~cvs20080103~/ld/emultempl/elf32.em binutils-2.18.1~cvs20080103/ld/emultempl/elf32.em
322 +--- binutils-2.18.1~cvs20080103~/ld/emultempl/elf32.em 2007-08-15 04:30:45.000000000 -0400
323 ++++ binutils-2.18.1~cvs20080103/ld/emultempl/elf32.em  2008-09-25 05:19:55.843396757 -0400
324 +@@ -69,7 +69,7 @@
325
326 + if [ "x${USE_LIBPATH}" = xyes ] ; then
327 +   case ${target} in
328 +-    *-*-linux-* | *-*-k*bsd*-*)
329 ++    *-*-linux-* | *-*-k*bsd*-* | *-*-kopensolaris*-*)
330 +   fragment <<EOF
331 + #ifdef HAVE_GLOB
332 + #include <glob.h>
333 +@@ -362,7 +362,7 @@
334
335 + EOF
336 + case ${target} in
337 +-  *-*-linux-* | *-*-k*bsd*-*)
338 ++  *-*-linux-* | *-*-k*bsd*-* | *-*-kopensolaris*-*)
339 +     fragment <<EOF
340 +         {
341 +           struct bfd_link_needed_list *l;
342 +@@ -597,7 +597,7 @@
343 +     # FreeBSD
344 +     ;;
345
346 +-    *-*-linux-* | *-*-k*bsd*-*)
347 ++    *-*-linux-* | *-*-k*bsd*-* | *-*-kopensolaris*-*)
348 +       fragment <<EOF
349 + /* For a native linker, check the file /etc/ld.so.conf for directories
350 +    in which we may find shared libraries.  /etc/ld.so.conf is really
351 +@@ -1253,7 +1253,7 @@
352 +     # FreeBSD
353 +     ;;
354
355 +-    *-*-linux-* | *-*-k*bsd*-*)
356 ++    *-*-linux-* | *-*-k*bsd*-* | *-*-kopensolaris*-*)
357 +     # Linux
358 +       fragment <<EOF
359 +         if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
360 +diff -urNad binutils-2.18.1~cvs20080103~/libtool.m4 binutils-2.18.1~cvs20080103/libtool.m4
361 +--- binutils-2.18.1~cvs20080103~/libtool.m4    2007-06-01 07:33:01.000000000 -0400
362 ++++ binutils-2.18.1~cvs20080103/libtool.m4     2008-09-25 05:17:25.050422153 -0400
363 +@@ -2312,7 +2312,7 @@
364 +   ;;
365
366 + # This must be Linux ELF.
367 +-linux* | k*bsd*-gnu)
368 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
369 +   version_type=linux
370 +   need_lib_prefix=no
371 +   need_version=no
372 +@@ -2925,7 +2925,7 @@
373 +   ;;
374
375 + # This must be Linux ELF.
376 +-linux* | k*bsd*-gnu)
377 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
378 +   lt_cv_deplibs_check_method=pass_all
379 +   ;;
380
381 +@@ -3544,7 +3544,7 @@
382 +           ;;
383 +       esac
384 +       ;;
385 +-      linux* | k*bsd*-gnu)
386 ++      linux* | k*bsd*-gnu | kopensolaris*-gnu)
387 +       case $cc_basename in
388 +         KCC*)
389 +           # KAI C++ Compiler
390 +@@ -3816,7 +3816,7 @@
391 +       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
392 +       ;;
393
394 +-    linux* | k*bsd*-gnu)
395 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
396 +       case $cc_basename in
397 +       icc* | ecc*)
398 +       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
399 +@@ -4175,7 +4175,7 @@
400 +       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
401 +       ;;
402
403 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
404 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
405 +       tmp_diet=no
406 +       if test "$host_os" = linux-dietlibc; then
407 +       case $cc_basename in
408 +@@ -5752,7 +5752,7 @@
409 +         _LT_TAGVAR(inherit_rpath, $1)=yes
410 +         ;;
411
412 +-      linux* | k*bsd*-gnu)
413 ++      linux* | k*bsd*-gnu | kopensolaris*-gnu)
414 +         case $cc_basename in
415 +           KCC*)
416 +           # Kuck and Associates, Inc. (KAI) C++ Compiler
417 +diff -urNad binutils-2.18.1~cvs20080103~/opcodes/configure binutils-2.18.1~cvs20080103/opcodes/configure
418 +--- binutils-2.18.1~cvs20080103~/opcodes/configure     2007-07-05 05:49:00.000000000 -0400
419 ++++ binutils-2.18.1~cvs20080103/opcodes/configure      2008-09-25 05:17:31.912875188 -0400
420 +@@ -4290,7 +4290,7 @@
421 +   ;;
422
423 + # This must be Linux ELF.
424 +-linux* | k*bsd*-gnu)
425 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
426 +   lt_cv_deplibs_check_method=pass_all
427 +   ;;
428
429 +@@ -6259,7 +6259,7 @@
430 +       lt_prog_compiler_static='-non_shared'
431 +       ;;
432
433 +-    linux* | k*bsd*-gnu)
434 ++    linux* | k*bsd*-gnu | kopensolaris*-gnu)
435 +       case $cc_basename in
436 +       icc* | ecc*)
437 +       lt_prog_compiler_wl='-Wl,'
438 +@@ -6800,7 +6800,7 @@
439 +       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
440 +       ;;
441
442 +-    gnu* | linux* | tpf* | k*bsd*-gnu)
443 ++    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
444 +       tmp_diet=no
445 +       if test "$host_os" = linux-dietlibc; then
446 +       case $cc_basename in
447 +@@ -8350,7 +8350,7 @@
448 +   ;;
449
450 + # This must be Linux ELF.
451 +-linux* | k*bsd*-gnu)
452 ++linux* | k*bsd*-gnu | kopensolaris*-gnu)
453 +   version_type=linux
454 +   need_lib_prefix=no
455 +   need_version=no
456 diff -uraN binutils-2.18.1~cvs20080103.orig/debian/patches/337_execlastload.dpatch binutils-2.18.1~cvs20080103/debian/patches/337_execlastload.dpatch
457 --- binutils-2.18.1~cvs20080103.orig/debian/patches/337_execlastload.dpatch     1969-12-31 19:00:00.000000000 -0500
458 +++ binutils-2.18.1~cvs20080103/debian/patches/337_execlastload.dpatch  2008-10-01 23:49:05.509177150 -0400
459 @@ -0,0 +1,159 @@
460 +#! /bin/sh /usr/share/dpatch/dpatch-run
461 +## 337_execlastload.dpatch by  <root@maltodextrin.csclub.uwaterloo.ca>
462 +##
463 +## All lines beginning with `## DP:' are a description of the patch.
464 +## DP: No description.
465 +
466 +@DPATCH@
467 +diff -urNad binutils-2.18.1~cvs20080103~/bfd/config.in binutils-2.18.1~cvs20080103/bfd/config.in
468 +--- binutils-2.18.1~cvs20080103~/bfd/config.in 2007-07-12 03:16:40.000000000 -0400
469 ++++ binutils-2.18.1~cvs20080103/bfd/config.in  2008-10-01 23:41:38.965637884 -0400
470 +@@ -295,3 +295,6 @@
471 + #ifndef _GNU_SOURCE
472 + # undef _GNU_SOURCE
473 + #endif
474 ++
475 ++/* Add support for making last PT_LOAD header executable */
476 ++#undef USE_EXECLASTLOAD
477 +diff -urNad binutils-2.18.1~cvs20080103~/bfd/configure binutils-2.18.1~cvs20080103/bfd/configure
478 +--- binutils-2.18.1~cvs20080103~/bfd/configure 2008-10-01 23:41:25.226671530 -0400
479 ++++ binutils-2.18.1~cvs20080103/bfd/configure  2008-10-01 23:41:38.970709857 -0400
480 +@@ -18917,6 +18917,17 @@
481
482
483
484 ++# Add support for making last PT_LOAD header executable.
485 ++case "${host}" in
486 ++  *-*solaris2 | *-*kopensolaris*-gnu*)
487 ++
488 ++cat >>confdefs.h <<\_ACEOF
489 ++#define USE_EXECLASTLOAD 1
490 ++_ACEOF
491 ++
492 ++    ;;
493 ++esac
494 ++
495 + # target stuff:
496
497 + # Canonicalize the secondary target names.
498 +diff -urNad binutils-2.18.1~cvs20080103~/bfd/configure.in binutils-2.18.1~cvs20080103/bfd/configure.in
499 +--- binutils-2.18.1~cvs20080103~/bfd/configure.in      2008-10-01 23:41:25.166682566 -0400
500 ++++ binutils-2.18.1~cvs20080103/bfd/configure.in       2008-10-01 23:41:38.971631017 -0400
501 +@@ -495,6 +495,14 @@
502 + AC_SUBST(WIN32LDFLAGS)
503 + AC_SUBST(WIN32LIBADD)
504
505 ++# Add support for making last PT_LOAD header executable.
506 ++case "${host}" in
507 ++  *-*solaris2 | *-*kopensolaris*-gnu*)
508 ++  AC_DEFINE(USE_EXECLASTLOAD, 1,
509 ++    [Add support for making last PT_LOAD header executable])
510 ++    ;;
511 ++esac
512 ++
513 + # target stuff:
514
515 + # Canonicalize the secondary target names.
516 +diff -urNad binutils-2.18.1~cvs20080103~/bfd/elf.c binutils-2.18.1~cvs20080103/bfd/elf.c
517 +--- binutils-2.18.1~cvs20080103~/bfd/elf.c     2007-11-21 03:50:12.000000000 -0500
518 ++++ binutils-2.18.1~cvs20080103/bfd/elf.c      2008-10-01 23:41:38.973547144 -0400
519 +@@ -3723,6 +3723,10 @@
520 +         m = make_mapping (abfd, sections, phdr_index, i, phdr_in_segment);
521 +         if (m == NULL)
522 +           goto error_return;
523 ++#ifdef USE_EXECLASTLOAD
524 ++      if (info->execlastload)
525 ++          m->p_flags = PF_X;
526 ++#endif
527
528 +         *pm = m;
529 +         pm = &m->next;
530 +diff -urNad binutils-2.18.1~cvs20080103~/include/bfdlink.h binutils-2.18.1~cvs20080103/include/bfdlink.h
531 +--- binutils-2.18.1~cvs20080103~/include/bfdlink.h     2007-07-09 17:21:42.000000000 -0400
532 ++++ binutils-2.18.1~cvs20080103/include/bfdlink.h      2008-10-01 23:41:38.974006935 -0400
533 +@@ -321,6 +321,9 @@
534 +   /* TRUE if PT_GNU_RELRO segment should be created.  */
535 +   unsigned int relro: 1;
536
537 ++  /* TRUE if we should mark the last PT_LOAD header as executable.  */
538 ++  unsigned int execlastload : 1;
539 ++
540 +   /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
541 +   unsigned int warn_shared_textrel: 1;
542
543 +diff -urNad binutils-2.18.1~cvs20080103~/ld/config.in binutils-2.18.1~cvs20080103/ld/config.in
544 +--- binutils-2.18.1~cvs20080103~/ld/config.in  2007-07-02 03:12:52.000000000 -0400
545 ++++ binutils-2.18.1~cvs20080103/ld/config.in   2008-10-01 23:49:04.196531942 -0400
546 +@@ -136,3 +136,6 @@
547 + /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
548 +    `char[]'. */
549 + #undef YYTEXT_POINTER
550 ++
551 ++/* Add support for making last PT_LOAD header executable */
552 ++#undef USE_EXECLASTLOAD
553 +diff -urNad binutils-2.18.1~cvs20080103~/ld/configure binutils-2.18.1~cvs20080103/ld/configure
554 +--- binutils-2.18.1~cvs20080103~/ld/configure  2008-10-01 23:41:25.242462750 -0400
555 ++++ binutils-2.18.1~cvs20080103/ld/configure   2008-10-01 23:46:52.755386343 -0400
556 +@@ -12389,6 +12389,17 @@
557
558
559
560 ++# Add support for making last PT_LOAD header executable.
561 ++case "${host}" in
562 ++  *-*solaris2 | *-*kopensolaris*-gnu*)
563 ++
564 ++cat >>confdefs.h <<\_ACEOF
565 ++#define USE_EXECLASTLOAD 1
566 ++_ACEOF
567 ++
568 ++    ;;
569 ++esac
570 ++
571 + TDIRS=tdirs
572
573
574 +diff -urNad binutils-2.18.1~cvs20080103~/ld/configure.in binutils-2.18.1~cvs20080103/ld/configure.in
575 +--- binutils-2.18.1~cvs20080103~/ld/configure.in       2007-08-13 03:08:58.000000000 -0400
576 ++++ binutils-2.18.1~cvs20080103/ld/configure.in        2008-10-01 23:46:10.633853183 -0400
577 +@@ -221,6 +221,14 @@
578
579 + AC_SUBST(EMUL)
580
581 ++# Add support for making last PT_LOAD header executable.
582 ++case "${host}" in
583 ++  *-*solaris2 | *-*kopensolaris*-gnu*)
584 ++  AC_DEFINE(USE_EXECLASTLOAD, 1,
585 ++    [Add support for making last PT_LOAD header executable])
586 ++    ;;
587 ++esac
588 ++
589 + TDIRS=tdirs
590 + AC_SUBST_FILE(TDIRS)
591
592 +diff -urNad binutils-2.18.1~cvs20080103~/ld/emultempl/elf32.em binutils-2.18.1~cvs20080103/ld/emultempl/elf32.em
593 +--- binutils-2.18.1~cvs20080103~/ld/emultempl/elf32.em 2008-10-01 23:41:25.243452618 -0400
594 ++++ binutils-2.18.1~cvs20080103/ld/emultempl/elf32.em  2008-10-01 23:41:38.974741415 -0400
595 +@@ -2148,6 +2148,13 @@
596 +   fi
597
598 + fragment <<EOF
599 ++#ifdef USE_EXECLASTLOAD
600 ++      else if (strcmp (optarg, "execlastload") == 0)
601 ++      link_info.execlastload = TRUE;
602 ++#endif
603 ++EOF
604 ++
605 ++fragment <<EOF
606 +       else if (CONST_STRNEQ (optarg, "max-page-size="))
607 +       {
608 +         char *end;
609 +@@ -2221,6 +2228,9 @@
610 +   fprintf (file, _("  -z nodlopen\t\tMark DSO not available to dlopen\n"));
611 +   fprintf (file, _("  -z nodump\t\tMark DSO not available to dldump\n"));
612 +   fprintf (file, _("  -z noexecstack\tMark executable as not requiring executable stack\n"));
613 ++#ifdef USE_EXECLASTLOAD
614 ++  fprintf (file, _("  -z execlastload\tMark the final PT_LOAD header as executable\n"));
615 ++#endif
616 + EOF
617
618 +   if test -n "$COMMONPAGESIZE"; then