aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:34:27 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:34:27 +0000
commit8602d4fea60dda606ad5e5e01e27f8f841120e15 (patch)
tree0c063210b9f1e8282b03acd84a1d078a463e97ed /ld
parent5b49f6dc399d611d8d8a10e2e2c922f38e6bb038 (diff)
downloadgdb-8602d4fea60dda606ad5e5e01e27f8f841120e15.zip
gdb-8602d4fea60dda606ad5e5e01e27f8f841120e15.tar.gz
gdb-8602d4fea60dda606ad5e5e01e27f8f841120e15.tar.bz2
include/coff/
* internal.h (C_AIX_WEAKEXT): New macro. (C_WEAKEXT): Use the GNU definition in the generic part of the file, and conditionally reset it to C_AIX_WEAKEXT in the XCOFF part of the file. (CSECT_SYM_P): New macro. * xcoff.h (L_WEAK): Define. (EXTERN_SYM_P): New macro. bfd/ * coffcode.h (coff_pointerize_aux_hook): Update CSECT_SYM_P to check whether a symbol has csect information. (coff_print_aux): Likewise. * coff-rs6000.c (_bfd_xcoff_swap_aux_in): Handle auxillary csect information for C_AIX_WEAKEXT too. (_bfd_xcoff_swap_aux_out): Likewise. (xcoff_reloc_type_br): Handle defweak symbols too. * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Handle auxillary csect information for C_AIX_WEAKEXT too. (_bfd_xcoff64_swap_aux_out): Likewise. (xcoff64_reloc_type_br): Handle defweak symbols too. * coffgen.c (coff_print_symbol): Handle auxillary function information for C_AIX_WEAKEXT too. * xcofflink.c (_bfd_xcoff_canonicalize_dynamic_symtab): Set BSF_WEAK instead of BSF_GLOBAL if the L_WEAK flag is set. (xcoff_dynamic_definition_p): New function. (xcoff_link_add_dynamic_symbols): Use it to decide whether ldsym defines h. Don't change h if ldsym isn't the definition. Otherwise, always take the symbol class from the ldsym. Use weak bfd symbol types for weak ldsyms. (xcoff_link_add_symbols): Use CSECT_SYM_P and EXTERN_SYM_P. Fix the check for whether a definition is from a shared object. Allow redefinitions of weak symbols. (xcoff_link_check_ar_symbols): Use EXTERN_SYM_P. (xcoff_keep_symbol_p): Likewise. (bfd_xcoff_size_dynamic_sections): Use CSECT_SYM_P. (xcoff_link_input_bfd): Use CSECT_SYM_P and EXTERN_SYM_P. Add .loader entries for C_AIX_WEAKEXT as well as C_EXT symbols, but mark them as L_WEAK. (xcoff_write_global_symbol): Treat weak symbols as C_AIX_WEAKEXT instead of C_EXT if C_AIX_WEAKEXT == C_WEAKEXT. gas/ * config/tc-ppc.c (ppc_frob_symbol): Add csect information for C_AIX_WEAKEXT too. ld/testsuite/ * ld-powerpc/aix-glink-2a.s, ld-powerpc/aix-glink-2a.ex, ld-powerpc/aix-glink-2b.s, ld-powerpc/aix-glink-2c.s, ld-powerpc/aix-glink-2c.ex, ld-powerpc/aix-glink-2d.s, ld-powerpc/aix-glink-2-32.dd, ld-powerpc/aix-glink-2-64.dd, ld-powerpc/aix-weak-1a.s, ld-powerpc/aix-weak-1b.s, ld-powerpc/aix-weak-1-rel.hd, ld-powerpc/aix-weak-1-rel.nd, ld-powerpc/aix-weak-1-dso.hd, ld-powerpc/aix-weak-1-dso.nd, ld-powerpc/aix-weak-1-dso.dnd, ld-powerpc/aix-weak-1.ex, ld-powerpc/aix-weak-2a.s, ld-powerpc/aix-weak-2a.ex, ld-powerpc/aix-weak-2a.nd, ld-powerpc/aix-weak-2b.s, ld-powerpc/aix-weak-2b.nd, ld-powerpc/aix-weak-2c.s, ld-powerpc/aix-weak-2c.ex, ld-powerpc/aix-weak-2c.nd, ld-powerpc/aix-weak-2c.od, ld-powerpc/aix-weak-3a.s, ld-powerpc/aix-weak-3a.ex, ld-powerpc/aix-weak-3b.s, ld-powerpc/aix-weak-3b.ex, ld-powerpc/aix-weak-3-32.d, ld-powerpc/aix-weak-3-32.dd, ld-powerpc/aix-weak-3-64.d, ld-powerpc/aix-weak-3-64.dd: New tests. * ld-powerpc/aix52.exp: Run them. Replace tmp/aix-* with tmp/aix64-* in 64-bit ld options.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog22
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2-32.dd69
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2-64.dd73
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2a.ex9
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2a.s41
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2b.s12
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2c.ex6
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2c.s33
-rw-r--r--ld/testsuite/ld-powerpc/aix-glink-2d.s12
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1-dso.dnd17
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1-dso.hd12
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1-dso.nd25
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1-rel.hd12
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1-rel.nd25
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1.ex8
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1a.s24
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-1b.s24
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2a.ex8
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2a.nd8
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2a.s21
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2b.nd8
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2b.s21
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2c.ex1
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2c.nd10
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2c.od13
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-2c.s11
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3-32.d5
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3-32.dd24
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3-64.d5
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3-64.dd26
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3a.ex3
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3a.s8
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3b.ex1
-rw-r--r--ld/testsuite/ld-powerpc/aix-weak-3b.s30
-rw-r--r--ld/testsuite/ld-powerpc/aix52.exp61
35 files changed, 688 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 81a6599..18b8bece 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,27 @@
2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+ * ld-powerpc/aix-glink-2a.s, ld-powerpc/aix-glink-2a.ex,
+ ld-powerpc/aix-glink-2b.s, ld-powerpc/aix-glink-2c.s,
+ ld-powerpc/aix-glink-2c.ex, ld-powerpc/aix-glink-2d.s,
+ ld-powerpc/aix-glink-2-32.dd, ld-powerpc/aix-glink-2-64.dd,
+ ld-powerpc/aix-weak-1a.s, ld-powerpc/aix-weak-1b.s,
+ ld-powerpc/aix-weak-1-rel.hd, ld-powerpc/aix-weak-1-rel.nd,
+ ld-powerpc/aix-weak-1-dso.hd, ld-powerpc/aix-weak-1-dso.nd,
+ ld-powerpc/aix-weak-1-dso.dnd, ld-powerpc/aix-weak-1.ex,
+ ld-powerpc/aix-weak-2a.s, ld-powerpc/aix-weak-2a.ex,
+ ld-powerpc/aix-weak-2a.nd, ld-powerpc/aix-weak-2b.s,
+ ld-powerpc/aix-weak-2b.nd, ld-powerpc/aix-weak-2c.s,
+ ld-powerpc/aix-weak-2c.ex, ld-powerpc/aix-weak-2c.nd,
+ ld-powerpc/aix-weak-2c.od, ld-powerpc/aix-weak-3a.s,
+ ld-powerpc/aix-weak-3a.ex, ld-powerpc/aix-weak-3b.s,
+ ld-powerpc/aix-weak-3b.ex, ld-powerpc/aix-weak-3-32.d,
+ ld-powerpc/aix-weak-3-32.dd, ld-powerpc/aix-weak-3-64.d,
+ ld-powerpc/aix-weak-3-64.dd: New tests.
+ * ld-powerpc/aix52.exp: Run them. Replace tmp/aix-* with
+ tmp/aix64-* in 64-bit ld options.
+
+2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+
* ld-powerpc/aix-no-dup-syms-1a.s, ld-powerpc/aix-no-dup-syms-1b.s,
ld-powerpc/aix-no-dup-syms-1.ex, ld-powerpc/aix-no-dup-syms-1.im,
ld-powerpc/aix-no-dup-syms-1-dso.dnd,
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2-32.dd b/ld/testsuite/ld-powerpc/aix-glink-2-32.dd
new file mode 100644
index 0000000..2c91d23
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2-32.dd
@@ -0,0 +1,69 @@
+
+tmpdir/aix-glink-2: file format aixcoff-rs6000
+
+
+Disassembly of section \.text:
+
+10000000 <\.b1>:
+10000000: 60 00 00 00 oril r0,r0,0
+
+10000004 <\.b2>:
+10000004: 60 00 00 00 oril r0,r0,0
+
+10000008 <\.b3>:
+10000008: 60 00 00 00 oril r0,r0,0
+
+1000000c <\.main>:
+1000000c: 48 00 f1 03 bla f100 <.*>
+10000010: 48 00 00 21 bl 10000030 <\.a2>
+10000014: 48 00 00 41 bl 10000054 <\.a3>
+10000018: 4b ff ff e9 bl 10000000 <\.b1>
+1000001c: 4b ff ff e9 bl 10000004 <\.b2>
+10000020: 4b ff ff e9 bl 10000008 <\.b3>
+10000024: 48 00 f5 03 bla f500 <.*>
+10000028: 48 00 00 51 bl 10000078 <\.c2>
+1000002c: 48 00 00 71 bl 1000009c <\.c3>
+
+10000030 <\.a2>:
+10000030: 81 82 00 00 l r12,0\(r2\)
+10000034: 90 41 00 14 st r2,20\(r1\)
+10000038: 80 0c 00 00 l r0,0\(r12\)
+1000003c: 80 4c 00 04 l r2,4\(r12\)
+10000040: 7c 09 03 a6 mtctr r0
+10000044: 4e 80 04 20 bctr
+10000048: 00 00 00 00 \.long 0x0
+1000004c: 00 0c 80 00 \.long 0xc8000
+10000050: 00 00 00 00 \.long 0x0
+
+10000054 <\.a3>:
+10000054: 81 82 00 04 l r12,4\(r2\)
+10000058: 90 41 00 14 st r2,20\(r1\)
+1000005c: 80 0c 00 00 l r0,0\(r12\)
+10000060: 80 4c 00 04 l r2,4\(r12\)
+10000064: 7c 09 03 a6 mtctr r0
+10000068: 4e 80 04 20 bctr
+1000006c: 00 00 00 00 \.long 0x0
+10000070: 00 0c 80 00 \.long 0xc8000
+10000074: 00 00 00 00 \.long 0x0
+
+10000078 <\.c2>:
+10000078: 81 82 00 08 l r12,8\(r2\)
+1000007c: 90 41 00 14 st r2,20\(r1\)
+10000080: 80 0c 00 00 l r0,0\(r12\)
+10000084: 80 4c 00 04 l r2,4\(r12\)
+10000088: 7c 09 03 a6 mtctr r0
+1000008c: 4e 80 04 20 bctr
+10000090: 00 00 00 00 \.long 0x0
+10000094: 00 0c 80 00 \.long 0xc8000
+10000098: 00 00 00 00 \.long 0x0
+
+1000009c <\.c3>:
+1000009c: 81 82 00 0c l r12,12\(r2\)
+100000a0: 90 41 00 14 st r2,20\(r1\)
+100000a4: 80 0c 00 00 l r0,0\(r12\)
+100000a8: 80 4c 00 04 l r2,4\(r12\)
+100000ac: 7c 09 03 a6 mtctr r0
+100000b0: 4e 80 04 20 bctr
+100000b4: 00 00 00 00 \.long 0x0
+100000b8: 00 0c 80 00 \.long 0xc8000
+100000bc: 00 00 00 00 \.long 0x0
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2-64.dd b/ld/testsuite/ld-powerpc/aix-glink-2-64.dd
new file mode 100644
index 0000000..5a34f0a
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2-64.dd
@@ -0,0 +1,73 @@
+
+tmpdir/aix64-glink-2: file format aix5coff64-rs6000
+
+
+Disassembly of section \.text:
+
+0000000010000000 <\.b1>:
+ 10000000: 60 00 00 00 nop
+
+0000000010000004 <\.b2>:
+ 10000004: 60 00 00 00 nop
+
+0000000010000008 <\.b3>:
+ 10000008: 60 00 00 00 nop
+
+000000001000000c <\.main>:
+ 1000000c: 48 00 f1 03 bla f100 <.*>
+ 10000010: 48 00 00 21 bl 10000030 <\.a2>
+ 10000014: 48 00 00 45 bl 10000058 <\.a3>
+ 10000018: 4b ff ff e9 bl 10000000 <\.b1>
+ 1000001c: 4b ff ff e9 bl 10000004 <\.b2>
+ 10000020: 4b ff ff e9 bl 10000008 <\.b3>
+ 10000024: 48 00 f5 03 bla f500 <.*>
+ 10000028: 48 00 00 59 bl 10000080 <\.c2>
+ 1000002c: 48 00 00 7d bl 100000a8 <\.c3>
+
+0000000010000030 <\.a2>:
+ 10000030: e9 82 00 00 ld r12,0\(r2\)
+ 10000034: f8 41 00 28 std r2,40\(r1\)
+ 10000038: e8 0c 00 00 ld r0,0\(r12\)
+ 1000003c: e8 4c 00 08 ld r2,8\(r12\)
+ 10000040: 7c 09 03 a6 mtctr r0
+ 10000044: 4e 80 04 20 bctr
+ 10000048: 00 00 00 00 \.long 0x0
+ 1000004c: 00 0c a0 00 \.long 0xca000
+ 10000050: 00 00 00 00 \.long 0x0
+ 10000054: 00 00 00 18 \.long 0x18
+
+0000000010000058 <\.a3>:
+ 10000058: e9 82 00 08 ld r12,8\(r2\)
+ 1000005c: f8 41 00 28 std r2,40\(r1\)
+ 10000060: e8 0c 00 00 ld r0,0\(r12\)
+ 10000064: e8 4c 00 08 ld r2,8\(r12\)
+ 10000068: 7c 09 03 a6 mtctr r0
+ 1000006c: 4e 80 04 20 bctr
+ 10000070: 00 00 00 00 \.long 0x0
+ 10000074: 00 0c a0 00 \.long 0xca000
+ 10000078: 00 00 00 00 \.long 0x0
+ 1000007c: 00 00 00 18 \.long 0x18
+
+0000000010000080 <\.c2>:
+ 10000080: e9 82 00 10 ld r12,16\(r2\)
+ 10000084: f8 41 00 28 std r2,40\(r1\)
+ 10000088: e8 0c 00 00 ld r0,0\(r12\)
+ 1000008c: e8 4c 00 08 ld r2,8\(r12\)
+ 10000090: 7c 09 03 a6 mtctr r0
+ 10000094: 4e 80 04 20 bctr
+ 10000098: 00 00 00 00 \.long 0x0
+ 1000009c: 00 0c a0 00 \.long 0xca000
+ 100000a0: 00 00 00 00 \.long 0x0
+ 100000a4: 00 00 00 18 \.long 0x18
+
+00000000100000a8 <\.c3>:
+ 100000a8: e9 82 00 18 ld r12,24\(r2\)
+ 100000ac: f8 41 00 28 std r2,40\(r1\)
+ 100000b0: e8 0c 00 00 ld r0,0\(r12\)
+ 100000b4: e8 4c 00 08 ld r2,8\(r12\)
+ 100000b8: 7c 09 03 a6 mtctr r0
+ 100000bc: 4e 80 04 20 bctr
+ 100000c0: 00 00 00 00 \.long 0x0
+ 100000c4: 00 0c a0 00 \.long 0xca000
+ 100000c8: 00 00 00 00 \.long 0x0
+ 100000cc: 00 00 00 18 \.long 0x18
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2a.ex b/ld/testsuite/ld-powerpc/aix-glink-2a.ex
new file mode 100644
index 0000000..406cabb
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2a.ex
@@ -0,0 +1,9 @@
+a1
+a2
+a3
+b1
+b2
+b3
+c1
+c2
+c3
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2a.s b/ld/testsuite/ld-powerpc/aix-glink-2a.s
new file mode 100644
index 0000000..fafbe43
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2a.s
@@ -0,0 +1,41 @@
+ .toc
+
+ .macro defabs,type,name,value
+ \type \name
+ \name = \value
+ .endm
+
+ .macro deffun,type,name,fn
+ \type \name
+ .csect \name\()[DS]
+\name\():
+ .if size == 32
+ .long .\name\()[PR],TOC[TC0],0
+ .else
+ .llong .\name\()[PR],TOC[TC0],0
+ .endif
+
+ .globl .\name
+ .csect .\name\()[PR]
+.\name\():
+ nop
+ .endm
+
+ .macro defdata,type,name,contents
+ \type \name
+ .csect \name\()[RW]
+\name\():
+ .long \contents
+ .endm
+
+ defabs .globl,a1,0xf100
+ deffun .globl,a2
+ defdata .globl,a3,0x1100
+
+ defabs .globl,b1,0xf200
+ deffun .globl,b2
+ defdata .globl,b3,0x2200
+
+ defabs .weak,c1,0xf300
+ deffun .weak,c2
+ defdata .weak,c3,0x3300
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2b.s b/ld/testsuite/ld-powerpc/aix-glink-2b.s
new file mode 100644
index 0000000..9c06d48
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2b.s
@@ -0,0 +1,12 @@
+ .toc
+
+ .macro deffun,type,name
+ .globl .\name
+ .csect .\name\()[PR]
+.\name\():
+ nop
+ .endm
+
+ deffun .globl,b1
+ deffun .globl,b2
+ deffun .globl,b3
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2c.ex b/ld/testsuite/ld-powerpc/aix-glink-2c.ex
new file mode 100644
index 0000000..4e16c9b
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2c.ex
@@ -0,0 +1,6 @@
+a1
+a2
+a3
+c1
+c2
+c3
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2c.s b/ld/testsuite/ld-powerpc/aix-glink-2c.s
new file mode 100644
index 0000000..7dd6dad
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2c.s
@@ -0,0 +1,33 @@
+ .toc
+
+ .macro defabs,type,name,value
+ \type \name
+ \name = \value
+ .endm
+
+ .macro deffun,type,name
+ \type \name
+ .csect \name\()[DS]
+\name\():
+ .long \name\()[PR],TOC[TC0],0
+
+ .globl .\name
+ .csect .\name\()[PR]
+.\name\():
+ nop
+ .endm
+
+ .macro defdata,type,name,contents
+ \type \name
+ .csect \name\()[RW]
+\name\():
+ .long \contents
+ .endm
+
+ defabs .globl,a1,0xf400
+ deffun .globl,a2
+ defdata .globl,a3,0x4400
+
+ defabs .globl,c1,0xf500
+ deffun .globl,c2
+ defdata .globl,c3,0x5500
diff --git a/ld/testsuite/ld-powerpc/aix-glink-2d.s b/ld/testsuite/ld-powerpc/aix-glink-2d.s
new file mode 100644
index 0000000..ba78609
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-glink-2d.s
@@ -0,0 +1,12 @@
+ .globl .main
+ .csect .main[PR]
+.main:
+ bl .a1
+ bl .a2
+ bl .a3
+ bl .b1
+ bl .b2
+ bl .b3
+ bl .c1
+ bl .c2
+ bl .c3
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1-dso.dnd b/ld/testsuite/ld-powerpc/aix-weak-1-dso.dnd
new file mode 100644
index 0000000..3105fa3
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1-dso.dnd
@@ -0,0 +1,17 @@
+# Comments are (aix-weak-1a.s type) wins over/loses to (aix-weak-1b.s type)
+# (strong common) loses to (strong data)
+0*10000010 D a
+# (strong common) wins over (weak data)
+0*10000020 B b
+# (strong data) wins over (strong common)
+0*10000000 D c
+# (weak data) loses to (strong common)
+0*10000028 B d
+# (weak common) loses to (strong data)
+0*10000018 D e
+# (weak common) wins over (weak data)
+0*10000024 W f
+# (strong data) wins over (weak common)
+0*10000008 D g
+# (weak data) wins over (weak common)
+0*1000000c W h
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1-dso.hd b/ld/testsuite/ld-powerpc/aix-weak-1-dso.hd
new file mode 100644
index 0000000..7368a5a
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1-dso.hd
@@ -0,0 +1,12 @@
+.*
+
+Sections:
+Idx Name * Size * VMA * LMA * File off *Algn
+ *0 \.text * 0+00 * 0*10000000 * 0*10000000 * [^ ]+ * 2\*\*2
+ *ALLOC, LOAD, CODE
+ *1 \.data * 0+20 * 0*10000000 * 0*10000000 * [^ ]+ * 2\*\*3
+ *CONTENTS, ALLOC, LOAD, DATA
+# Should only have 3 three common symbols.
+ *2 \.bss * 0+0c * 0*10000020 * 0*10000020 * [^ ]+ * 2\*\*3
+ *ALLOC
+#pass
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1-dso.nd b/ld/testsuite/ld-powerpc/aix-weak-1-dso.nd
new file mode 100644
index 0000000..3289e25
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1-dso.nd
@@ -0,0 +1,25 @@
+# Comments are (aix-weak-1a.s type) wins over/loses to (aix-weak-1b.s type)
+# (strong common) loses to (strong data)
+0*10000010 d a
+0*10000010 D a
+# (strong common) wins over (weak data)
+0*10000020 B b
+0*10000014 d b
+# (strong data) wins over (strong common)
+0*10000000 d c
+0*10000000 D c
+# (weak data) loses to (strong common)
+0*10000004 d d
+0*10000028 B d
+# (weak common) loses to (strong data)
+0*10000018 d e
+0*10000018 D e
+# (weak common) wins over (weak data)
+0*10000024 W f
+0*1000001c d f
+# (strong data) wins over (weak common)
+0*10000008 d g
+0*10000008 D g
+# (weak data) wins over (weak common)
+0*1000000c d h
+0*1000000c W h
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1-rel.hd b/ld/testsuite/ld-powerpc/aix-weak-1-rel.hd
new file mode 100644
index 0000000..9ae4d47
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1-rel.hd
@@ -0,0 +1,12 @@
+.*
+
+Sections:
+Idx Name * Size * VMA * LMA * File off *Algn
+ *0 \.text * 0+00 * 0+00 * 0+00 * [^ ]+ * 2\*\*2
+ *ALLOC, LOAD, CODE
+ *1 \.data * 0+20 * 0+00 * 0+00 * [^ ]+ * 2\*\*3
+ *CONTENTS, ALLOC, LOAD, DATA
+# Should only have 3 three common symbols.
+ *2 \.bss * 0+0c * 0+20 * 0+20 * [^ ]+ * 2\*\*3
+ *ALLOC
+#pass
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1-rel.nd b/ld/testsuite/ld-powerpc/aix-weak-1-rel.nd
new file mode 100644
index 0000000..73cfe90
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1-rel.nd
@@ -0,0 +1,25 @@
+# Comments are (aix-weak-1a.s type) wins over/loses to (aix-weak-1b.s type)
+# (strong common) loses to (strong data)
+0+10 d a
+0+10 D a
+# (strong common) wins over (weak data)
+0+20 B b
+0+14 d b
+# (strong data) wins over (strong common)
+0+00 d c
+0+00 D c
+# (weak data) loses to (strong common)
+0+04 d d
+0+28 B d
+# (weak common) loses to (strong data)
+0+18 d e
+0+18 D e
+# (weak common) wins over (weak data)
+0+24 W f
+0+1c d f
+# (strong data) wins over (weak common)
+0+08 d g
+0+08 D g
+# (weak data) wins over (weak common)
+0+0c d h
+0+0c W h
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1.ex b/ld/testsuite/ld-powerpc/aix-weak-1.ex
new file mode 100644
index 0000000..71ac1b5
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1.ex
@@ -0,0 +1,8 @@
+a
+b
+c
+d
+e
+f
+g
+h
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1a.s b/ld/testsuite/ld-powerpc/aix-weak-1a.s
new file mode 100644
index 0000000..da529ca
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1a.s
@@ -0,0 +1,24 @@
+ .comm a,4
+ .comm b,4
+ .globl c
+ .csect c[RW],2
+c:
+ .long 0x11111111
+ .weak d
+ .csect d[RW],2
+d:
+ .long 0x22222222
+
+ # Same again, with weak common symbols
+ .weak e
+ .comm e,4
+ .weak f
+ .comm f,4
+ .globl g
+ .csect g[RW],2
+g:
+ .long 0x33333333
+ .weak h
+ .csect h[RW],2
+h:
+ .long 0x44444444
diff --git a/ld/testsuite/ld-powerpc/aix-weak-1b.s b/ld/testsuite/ld-powerpc/aix-weak-1b.s
new file mode 100644
index 0000000..e6c2429
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-1b.s
@@ -0,0 +1,24 @@
+ .globl a
+ .csect a[RW],2
+a:
+ .long 0x55555555
+ .weak b
+ .csect b[RW],2
+b:
+ .long 0x66666666
+ .comm c,4
+ .comm d,4
+
+ # Same again, with weak common symbols
+ .globl e
+ .csect e[RW],2
+e:
+ .long 0x77777777
+ .weak f
+ .csect f[RW],2
+f:
+ .long 0x88888888
+ .weak g
+ .comm g,4
+ .weak h
+ .comm h,4
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2a.ex b/ld/testsuite/ld-powerpc/aix-weak-2a.ex
new file mode 100644
index 0000000..0e65a8f
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2a.ex
@@ -0,0 +1,8 @@
+c1
+c2
+c3
+c4
+d1
+d2
+d3
+d4
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2a.nd b/ld/testsuite/ld-powerpc/aix-weak-2a.nd
new file mode 100644
index 0000000..2c2ea1c
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2a.nd
@@ -0,0 +1,8 @@
+0*cccc1111 W c1
+0*cccc2222 W c2
+0*cccc3333 A c3
+0*cccc4444 A c4
+0*ffff1111 W d1
+0*ffff2222 W d2
+0*10000000 D d3
+0*10000004 D d4
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2a.s b/ld/testsuite/ld-powerpc/aix-weak-2a.s
new file mode 100644
index 0000000..e4d8a04
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2a.s
@@ -0,0 +1,21 @@
+ .weak c1
+ c1 = 0xcccc1111
+ .weak c2
+ c2 = 0xcccc2222
+ .globl c3
+ c3 = 0xcccc3333
+ .globl c4
+ c4 = 0xcccc4444
+
+ .weak d1
+ d1 = 0xffff1111
+ .weak d2
+ d2 = 0xffff2222
+ .globl d3
+ .csect d3[DS]
+d3:
+ .long 0xffff3333
+ .globl d4
+ .csect d4[DS]
+d4:
+ .long 0xffff4444
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2b.nd b/ld/testsuite/ld-powerpc/aix-weak-2b.nd
new file mode 100644
index 0000000..d54b35b
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2b.nd
@@ -0,0 +1,8 @@
+0*dddd1111 A c1
+0*dddd2222 W c2
+0*dddd3333 A c3
+0*dddd4444 W c4
+0*10000000 D d1
+0*eeee2222 W d2
+0*10000004 D d3
+0*eeee4444 W d4
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2b.s b/ld/testsuite/ld-powerpc/aix-weak-2b.s
new file mode 100644
index 0000000..84885ab
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2b.s
@@ -0,0 +1,21 @@
+ .globl c1
+ c1 = 0xdddd1111
+ .weak c2
+ c2 = 0xdddd2222
+ .globl c3
+ c3 = 0xdddd3333
+ .weak c4
+ c4 = 0xdddd4444
+
+ .globl d1
+ .csect d1[DS]
+d1:
+ .long 0xeeee1111
+ .weak d2
+ d2 = 0xeeee2222
+ .globl d3
+ .csect d3[DS]
+d3:
+ .long 0xeeee3333
+ .weak d4
+ d4 = 0xeeee4444
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2c.ex b/ld/testsuite/ld-powerpc/aix-weak-2c.ex
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2c.ex
@@ -0,0 +1 @@
+foo
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2c.nd b/ld/testsuite/ld-powerpc/aix-weak-2c.nd
new file mode 100644
index 0000000..d42034b
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2c.nd
@@ -0,0 +1,10 @@
+0*dddd1111 C c1
+0*cccc2222 C c2
+0*cccc3333 C c3
+0*cccc4444 C c4
+ * U d1
+0*ffff2222 C d2
+ * U d3
+ * U d4
+0*10000000 d foo
+0*10000000 D foo
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2c.od b/ld/testsuite/ld-powerpc/aix-weak-2c.od
new file mode 100644
index 0000000..272c80e
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2c.od
@@ -0,0 +1,13 @@
+
+.*
+
+DYNAMIC RELOCATION RECORDS
+OFFSET * TYPE * VALUE
+0*10000010 R_POS * d1
+0*10000018 R_POS * d3
+0*1000001c R_POS * d4
+
+
+Contents of section \.data:
+ 0*10000000 dddd1111 cccc2222 cccc3333 cccc4444 .*
+ 0*10000010 00000000 ffff2222 00000000 00000000 .*
diff --git a/ld/testsuite/ld-powerpc/aix-weak-2c.s b/ld/testsuite/ld-powerpc/aix-weak-2c.s
new file mode 100644
index 0000000..5ca93d3
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-2c.s
@@ -0,0 +1,11 @@
+ .globl foo
+ .csect foo[DS]
+foo:
+ .long c1
+ .long c2
+ .long c3
+ .long c4
+ .long d1
+ .long d2
+ .long d3
+ .long d4
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3-32.d b/ld/testsuite/ld-powerpc/aix-weak-3-32.d
new file mode 100644
index 0000000..45976c9
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3-32.d
@@ -0,0 +1,5 @@
+#name: Weak test 3 (main, static) (32-bit)
+#source: aix-weak-3b.s
+#as: -a32 --defsym size=32
+#ld: -b32 -e.main -bnoautoimp tmpdir/aix-weak-3a.so
+#error: .*multiple definition of `x1'\n[^\n]*first defined here
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3-32.dd b/ld/testsuite/ld-powerpc/aix-weak-3-32.dd
new file mode 100644
index 0000000..c52b735a
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3-32.dd
@@ -0,0 +1,24 @@
+
+.*
+
+
+Disassembly of section \.data:
+
+20000000 <x1>:
+20000000: 00 00 01 02 .*
+
+20000004 <x2>:
+20000004: 00 00 03 04 .*
+
+20000008 <TOC>:
+20000008: 20 00 00 00 .*
+ 20000008: R_POS x1\+.*
+
+2000000c <x2>:
+2000000c: 20 00 00 04 .*
+ 2000000c: R_POS x2\+.*
+
+20000010 <x3>:
+20000010: 00 00 00 00 .*
+ 20000010: R_POS x3
+20000014: 00 00 00 00 .*
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3-64.d b/ld/testsuite/ld-powerpc/aix-weak-3-64.d
new file mode 100644
index 0000000..4673175
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3-64.d
@@ -0,0 +1,5 @@
+#name: Weak test 3 (main, static) (64-bit)
+#source: aix-weak-3b.s
+#as: -a64 --defsym size=64
+#ld: -b64 -e.main -bnoautoimp tmpdir/aix64-weak-3a.so
+#error: .*multiple definition of `x1'\n[^\n]*first defined here
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3-64.dd b/ld/testsuite/ld-powerpc/aix-weak-3-64.dd
new file mode 100644
index 0000000..7c10f6c
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3-64.dd
@@ -0,0 +1,26 @@
+
+.*
+
+
+Disassembly of section \.data:
+
+0000000020000000 <x1>:
+ 20000000: 00 00 01 02 .*
+
+0000000020000004 <x2>:
+ 20000004: 00 00 03 04 .*
+
+0000000020000008 <TOC>:
+ 20000008: 00 00 00 00 .*
+ 20000008: R_POS_64 x1\+.*
+ 2000000c: 20 00 00 00 .*
+
+0000000020000010 <x2>:
+ 20000010: 00 00 00 00 .*
+ 20000010: R_POS_64 x2\+.*
+ 20000014: 20 00 00 04 .*
+
+0000000020000018 <x3>:
+ 20000018: 00 00 00 00 .*
+ 20000018: R_POS_64 x3
+ 2000001c: 00 00 00 00 .*
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3a.ex b/ld/testsuite/ld-powerpc/aix-weak-3a.ex
new file mode 100644
index 0000000..589f40b
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3a.ex
@@ -0,0 +1,3 @@
+x1
+x2
+x3
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3a.s b/ld/testsuite/ld-powerpc/aix-weak-3a.s
new file mode 100644
index 0000000..e8b9d96
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3a.s
@@ -0,0 +1,8 @@
+ .globl x1
+ x1 = 0x11223344
+ .globl x2
+ x2 = 0x55667788
+ .globl x3
+ .csect x3[RW]
+x3:
+ .long 42
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3b.ex b/ld/testsuite/ld-powerpc/aix-weak-3b.ex
new file mode 100644
index 0000000..975fbec
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3b.ex
@@ -0,0 +1 @@
+y
diff --git a/ld/testsuite/ld-powerpc/aix-weak-3b.s b/ld/testsuite/ld-powerpc/aix-weak-3b.s
new file mode 100644
index 0000000..4e69082
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-weak-3b.s
@@ -0,0 +1,30 @@
+ .globl x1
+ .csect x1[RW]
+x1:
+ .long 0x0102
+
+ .weak x2
+ .csect x2[RW]
+x2:
+ .long 0x0304
+
+ .toc
+Tx1:
+ .tc x1[TC],x1
+Tx2:
+ .tc x2[TC],x2
+Tx3:
+ .tc x3[TC],x3
+
+ .globl .main
+ .csect .main[PR]
+.main:
+ .if size == 32
+ lwz 1,Tx1(2)
+ lwz 1,Tx2(2)
+ lwz 1,Tx3(2)
+ .else
+ ld 1,Tx1(2)
+ ld 1,Tx2(2)
+ ld 1,Tx3(2)
+ .endif
diff --git a/ld/testsuite/ld-powerpc/aix52.exp b/ld/testsuite/ld-powerpc/aix52.exp
index 6cd26fe..98bbda3 100644
--- a/ld/testsuite/ld-powerpc/aix52.exp
+++ b/ld/testsuite/ld-powerpc/aix52.exp
@@ -124,6 +124,64 @@ set aix52tests {
{{objdump -dS aix-lineno-1b.dd} {nm {} aix-lineno-1b.nd}}
"aix-lineno-1b.exe"}
+ {"Glink test 2 (part a)" "-shared -bE:aix-glink-2a.ex"
+ "" {aix-glink-2a.s}
+ {}
+ "aix-glink-2a.so"}
+
+ {"Glink test 2 (part b)" "-r"
+ "" {aix-glink-2b.s}
+ {}
+ "aix-glink-2b.ro"}
+
+ {"Glink test 2 (part c)" "-shared -bE:aix-glink-2c.ex"
+ "" {aix-glink-2c.s}
+ {}
+ "aix-glink-2c.so"}
+
+ {"Glink test 2"
+ "-e.main tmpdir/aix-glink-2a.so tmpdir/aix-glink-2b.ro tmpdir/aix-glink-2c.so"
+ "" {aix-glink-2d.s}
+ {{objdump -d aix-glink-2-SIZE.dd}}
+ "aix-glink-2"}
+
+ {"Weak test 1 (rel)" "-r"
+ "" {aix-weak-1a.s aix-weak-1b.s}
+ {{nm {} aix-weak-1-rel.nd} {objdump -h aix-weak-1-rel.hd}}
+ "aix-weak-1.o"}
+
+ {"Weak test 1 (shared, nogc)" "-shared -bE:aix-weak-1.ex -bnogc"
+ "" {aix-weak-1a.s aix-weak-1b.s}
+ {{nm {} aix-weak-1-dso.nd} {objdump -h aix-weak-1-dso.hd}
+ {nm -D aix-weak-1-dso.dnd}}
+ "aix-weak-1-nogc.so"}
+
+ {"Weak test 2 (library 1)" "-shared -bE:aix-weak-2a.ex"
+ "" {aix-weak-2a.s}
+ {{nm -D aix-weak-2a.nd}}
+ "aix-weak-2a.so"}
+
+ {"Weak test 2 (library 2)" "-shared -bE:aix-weak-2a.ex"
+ "" {aix-weak-2b.s}
+ {{nm -D aix-weak-2b.nd}}
+ "aix-weak-2b.so"}
+
+ {"Weak test 2 (main library)"
+ "-shared -bE:aix-weak-2c.ex tmpdir/aix-weak-2a.so tmpdir/aix-weak-2b.so"
+ "" {aix-weak-2c.s}
+ {{nm {} aix-weak-2c.nd} {objdump {-sj.data -R} aix-weak-2c.od}}
+ "aix-weak-2c.so"}
+
+ {"Weak test 3 (library)" "-shared -bE:aix-weak-3a.ex"
+ "" {aix-weak-3a.s}
+ {}
+ "aix-weak-3a.so"}
+
+ {"Weak test 3 (main, dynamic)" "-e.main tmpdir/aix-weak-3a.so"
+ "" {aix-weak-3b.s}
+ {{objdump -Dzrj.data aix-weak-3-SIZE.dd}}
+ "aix-weak-3"}
+
{"TOC test 1" "-shared -bE:aix-toc-1.ex"
"" {aix-toc-1a.s aix-toc-1b.s}
{{objdump -dr aix-toc-1-SIZE.dd}}
@@ -136,3 +194,6 @@ foreach test $aix52tests {
run_aix_test 64 $name $ldopts $asopts $sources $tools $output
}
}
+
+run_dump_test "aix-weak-3-32"
+run_dump_test "aix-weak-3-64"