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
|
Set '-brtl' for executables, to allow overriding shared library symbol
definitions with local symbol definitions - this is called runtime-linking.
Even if that usually is a hack, it is the only option with SVR4/ELF/Linux.
This requires shared libraries to be linked with '-bnosymbolic':
Using -G is recommended to mimic SVR4 behaviour as good as possible.
Better not use '-bexpfull', may trigger this AIX 7.1 kernel problem:
https://www-304.ibm.com/support/docview.wss?uid=isg1IV39558
Use '-bexpall' instead, even if that won't export symbol names with leading _.
Actually, '-bexpall' is more similar to SVR4/ELF except for the leading _.
For collect2, take -G and -bsvr4 to change library-extension search order to
what -brtl does. Also, take -bnortl to disable -brtl mode. Upstream report is
https://gcc.gnu.org/ml/gcc-patches/2013-02/msg00104.html
For collect2, ignore shared archive members with the F_LOADONLY flag.
diff -ruN gcc-4.2.4/gcc/config/rs6000/aix43.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix43.h
--- gcc-4.2.4/gcc/config/rs6000/aix43.h 2014-07-01 09:07:24 +0200
+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix43.h 2014-06-30 15:51:22 +0200
@@ -143,8 +143,8 @@
"
#undef LINK_SPEC
-#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\
%{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
%{mpe:-binitfini:poe_remote_main}"
diff -ruN gcc-4.2.4/gcc/config/rs6000/aix51.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix51.h
--- gcc-4.2.4/gcc/config/rs6000/aix51.h 2014-07-01 09:07:24 +0200
+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix51.h 2014-06-30 15:51:22 +0200
@@ -138,8 +138,8 @@
%{pthread:}-lpthreads -lc"
#undef LINK_SPEC
-#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\
%{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
%{mpe:-binitfini:poe_remote_main}"
diff -ruN gcc-4.2.4/gcc/config/rs6000/aix52.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix52.h
--- gcc-4.2.4/gcc/config/rs6000/aix52.h 2014-07-01 09:07:24 +0200
+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix52.h 2014-06-30 15:51:22 +0200
@@ -140,8 +140,8 @@
%{pthread:}-lpthreads -lc"
#undef LINK_SPEC
-#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\
%{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
%{mpe:-binitfini:poe_remote_main}"
diff -ruN gcc-4.2.4/gcc/config/rs6000/aix61.h /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix61.h
--- gcc-4.2.4/gcc/config/rs6000/aix61.h 2014-07-01 09:07:24 +0200
+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/config/rs6000/aix61.h 2014-06-30 15:51:24 +0200
@@ -143,8 +143,8 @@
%{pthread:}-lpthreads -lc"
#undef LINK_SPEC
-#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
- %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
+#define LINK_SPEC "%{!shared:-brtl -bexpall} -bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
+ %{static:-bnso %(link_syscalls) } %{shared:-G -bernotok %{!e:-bnoentry}}\
%{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
%{mpe:-binitfini:poe_remote_main}"
diff -ruN gcc-4.2.4/gcc/collect2.c /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/collect2.c
--- gcc-4.2.4/gcc/collect2.c 2007-12-31 17:04:26 +0100
+++ /junk/base-2010.0u/portage/sys-devel/gcc-4.2.4-r01.11/work/gcc-4.2.4/gcc/collect2.c 2014-06-30 15:51:22 +0200
@@ -1068,8 +1068,15 @@
export_flag = 1;
else if (arg[2] == '6' && arg[3] == '4')
aix64_flag = 1;
- else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l')
- aixrtl_flag = 1;
+ else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l' && arg[5] == '\0')
+ aixrtl_flag = 1; /* -brtl enables (but not -brtllib) */
+ else if (arg[2] == 'n' && arg[3] == 'o' && arg[4] == 'r' && arg[5] == 't' && arg[6] == 'l' && arg[7] == '\0')
+ aixrtl_flag = 0; /* -bnortl disables (but not -bnortllib) */
+ else if (arg[2] == 's' && arg[3] == 'v' && arg[4] == 'r' && arg[5] == '4')
+ aixrtl_flag = 1; /* -bsvr4 enables -brtl too */
+ break;
+ case 'G':
+ aixrtl_flag = 1; /* -G enables -brtl too */
break;
#endif
@@ -2322,12 +2329,14 @@
/* 0757 = U803XTOCMAGIC (AIX 4.3) and 0767 = U64_TOCMAGIC (AIX V5) */
#ifdef _AIX51
# define GCC_CHECK_HDR(X) \
- ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
- || (HEADER (X).f_magic == 0767 && aix64_flag))
+ (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
+ || (HEADER (X).f_magic == 0767 && aix64_flag)) \
+ && !(HEADER (X).f_flags & F_LOADONLY))
#else
# define GCC_CHECK_HDR(X) \
- ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
- || (HEADER (X).f_magic == 0757 && aix64_flag))
+ (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
+ || (HEADER (X).f_magic == 0757 && aix64_flag)) \
+ && !(HEADER (X).f_flags & F_LOADONLY))
#endif
#endif
|