From 1e9ee2cf3858c2e99e863fc0d130034227f0a6ca Mon Sep 17 00:00:00 2001
From: Simon South <ssouth@simonsouth.com>
Date: Wed, 4 Nov 2015 04:07:34 -0500
Subject: [PATCH] gcc2, gcc4: Correct LINK_SPEC
Correct LINK_SPEC so it
* Sets appropriate dynamic-link options for any type of dynamically
linked executable, not only position-independent ones.
* Does not omit these options if "-pie" is specified by the user.
* Recognizes the "-static" option.
* Includes a hyphen previously missing from "--no-undefined".
---
gcc/gcc/config/arm/haiku.h | 6 +++---
gcc/gcc/config/i386/haiku.h | 6 +++---
gcc/gcc/config/i386/haiku64.h | 6 +++---
gcc/gcc/config/m68k/haiku.h | 6 +++---
gcc/gcc/config/mips/haiku.h | 5 +++--
gcc/gcc/config/rs6000/haiku.h | 6 +++---
legacy/gcc/gcc/config/i386/haiku.h | 6 +++---
7 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/gcc/gcc/config/arm/haiku.h b/gcc/gcc/config/arm/haiku.h
index b15fdc1..dedc53b 100644
a
|
b
|
|
77 | 77 | #undef LINK_SPEC |
78 | 78 | #define LINK_SPEC \ |
79 | 79 | "%{!o*:-o %b} -m armelf \ |
80 | | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
81 | | :-pie --allow-shlib-undefined --export-dynamic} %{shared:-shared} \ |
82 | | %{nostart|shared:-e 0;:-no-undefined} %{mbig-endian:-EB} \ |
| 80 | %{shared:-shared;!r:%{fno-pic|fno-PIC|fno-pie|fno-PIE:;:%{!pie:-pie}} \ |
| 81 | %{!static:--export-dynamic --allow-shlib-undefined}} %{static:-static} \ |
| 82 | %{nostart|shared:-e 0;:--no-undefined} %{mbig-endian:-EB} \ |
83 | 83 | %{mlittle-endian:-EL} -X" |
84 | 84 | |
diff --git a/gcc/gcc/config/i386/haiku.h b/gcc/gcc/config/i386/haiku.h
index 5320329..39e55ce 100644
a
|
b
|
Boston, MA 02111-1307, USA. */
|
55 | 55 | #undef LINK_SPEC |
56 | 56 | #define LINK_SPEC \ |
57 | 57 | "-m elf_i386_haiku \ |
58 | | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
59 | | :-pie --allow-shlib-undefined --export-dynamic} %{shared:-shared} \ |
60 | | %{nostart|shared:-e 0;:-no-undefined}" |
| 58 | %{shared:-shared;!r:%{fno-pic|fno-PIC|fno-pie|fno-PIE:;:%{!pie:-pie}} \ |
| 59 | %{!static:--export-dynamic --allow-shlib-undefined}} %{static:-static} \ |
| 60 | %{nostart|shared:-e 0;:--no-undefined}" |
61 | 61 | |
62 | 62 | /* A C statement (sans semicolon) to output to the stdio stream |
63 | 63 | FILE the assembler definition of uninitialized global DECL named |
diff --git a/gcc/gcc/config/i386/haiku64.h b/gcc/gcc/config/i386/haiku64.h
index 1a63749..82a0420 100644
a
|
b
|
Boston, MA 02111-1307, USA. */
|
66 | 66 | #undef LINK_SPEC |
67 | 67 | #define LINK_SPEC \ |
68 | 68 | "%{" SPEC_64 ":-m elf_x86_64_haiku} %{" SPEC_32 ":-m elf_i386_haiku} \ |
69 | | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
70 | | :-pie --allow-shlib-undefined --export-dynamic} %{shared:-shared} \ |
71 | | %{nostart|shared:-e 0;:-no-undefined}" |
| 69 | %{shared:-shared;!r:%{fno-pic|fno-PIC|fno-pie|fno-PIE:;:%{!pie:-pie}} \ |
| 70 | %{!static:--export-dynamic --allow-shlib-undefined}} %{static:-static} \ |
| 71 | %{nostart|shared:-e 0;:--no-undefined}" |
72 | 72 | |
73 | 73 | /* A C statement (sans semicolon) to output to the stdio stream |
74 | 74 | FILE the assembler definition of uninitialized global DECL named |
diff --git a/gcc/gcc/config/m68k/haiku.h b/gcc/gcc/config/m68k/haiku.h
index 94e8dff..a1f7750 100644
a
|
b
|
Boston, MA 02110-1301, USA. */
|
110 | 110 | /*#define LINK_SPEC "%{!o*:-o %b} -m elf_m68k_haiku -shared -no-undefined %{nostart:-e 0}"*/ |
111 | 111 | #define LINK_SPEC \ |
112 | 112 | "%{!o*:-o %b} -m m68kelf \ |
113 | | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
114 | | :-pie --allow-shlib-undefined --export-dynamic} -no-undefined \ |
115 | | %{nostart:-e 0}" |
| 113 | %{shared:-shared;!r:%{fno-pic|fno-PIC|fno-pie|fno-PIE:;:%{!pie:-pie}} \ |
| 114 | %{!static:--export-dynamic --allow-shlib-undefined}} %{static:-static} \ |
| 115 | --no-undefined %{nostart:-e 0}" |
116 | 116 | |
117 | 117 | /* XXX: not sure for the rest there... */ |
118 | 118 | |
diff --git a/gcc/gcc/config/mips/haiku.h b/gcc/gcc/config/mips/haiku.h
index 3bfa10a..2393af6 100644
a
|
b
|
Boston, MA 02111-1307, USA. */
|
42 | 42 | #undef LINK_SPEC |
43 | 43 | #define LINK_SPEC \ |
44 | 44 | "%{!o*:-o %b} -m elf_mipsel_haiku \ |
45 | | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
46 | | :-pie --allow-shlib-undefined --export-dynamic} %{nostart:-e 0}" |
| 45 | %{shared:-shared;!r:%{fno-pic|fno-PIC|fno-pie|fno-PIE:;:%{!pie:-pie}} \ |
| 46 | %{!static:--export-dynamic --allow-shlib-undefined}} %{static:-static} \ |
| 47 | %{nostart:-e 0}" |
47 | 48 | |
diff --git a/gcc/gcc/config/rs6000/haiku.h b/gcc/gcc/config/rs6000/haiku.h
index c76214c..4a6be20 100644
a
|
b
|
Boston, MA 02111-1307, USA. */
|
55 | 55 | #undef LINK_SPEC |
56 | 56 | #define LINK_SPEC \ |
57 | 57 | "%{!o*:-o %b} -m elf32ppchaiku \ |
58 | | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
59 | | :-pie --allow-shlib-undefined --export-dynamic} %{shared:-shared} \ |
60 | | %{nostart|shared:-e 0;:-no-undefined}" |
| 58 | %{shared:-shared;!r:%{fno-pic|fno-PIC|fno-pie|fno-PIE:;:%{!pie:-pie}} \ |
| 59 | %{!static:--export-dynamic --allow-shlib-undefined}} %{static:-static} \ |
| 60 | %{nostart|shared:-e 0;:--no-undefined}" |
diff --git a/legacy/gcc/gcc/config/i386/haiku.h b/legacy/gcc/gcc/config/i386/haiku.h
index 7c66036..3403732 100644
a
|
b
|
Boston, MA 02111-1307, USA. */
|
187 | 187 | #undef LINK_SPEC |
188 | 188 | #define LINK_SPEC \ |
189 | 189 | "%{!o*:-o %b} -m elf_i386_haiku \ |
190 | | %{!shared:%{!r:%{!fno-pic:%{!fno-PIC:-pie --export-dynamic}} \ |
191 | | %{!static:--no-add-needed --allow-shlib-undefined}}} \ |
192 | | %{shared:-shared -Bsymbolic} %{nostart|shared:-e 0} \ |
| 190 | %{!shared:%{!r:%{!fno-pic:%{!fno-PIC:-pie}} \ |
| 191 | %{!static:--no-add-needed --export-dynamic --allow-shlib-undefined}}} \ |
| 192 | %{shared:-shared -Bsymbolic} %{static:-static} %{nostart|shared:-e 0} \ |
193 | 193 | %{!nostart:%{!shared:--no-undefined}}" |
194 | 194 | |
195 | 195 | /* Provide start and end file specs appropriate to glibc. */ |