XCOFF ld testsuite fixes

Alan Modra amodra@gmail.com
Tue Jul 7 08:56:00 GMT 2020
	* testsuite/ld-scripts/align.exp: Don't exclude xcoff.  Pass
	-bnogc ld option for xcoff.
	* testsuite/ld-scripts/provide.exp: Likewise.
	* testsuite/ld-scripts/data.exp: Pass -bnogc ld option for xcoff.
	* testsuite/ld-scripts/default-script.exp: Likewise.
	* testsuite/ld-scripts/defined.exp: Likewise.
	* testsuite/ld-scripts/empty-address.exp: Likewise.
	* testsuite/ld-scripts/expr.exp: Likewise.
	* testsuite/ld-scripts/include.exp: Likewise.
	* testsuite/ld-scripts/script.exp: Likewise.
	* testsuite/ld-scripts/assign-loc.d: Don't exclude xcoff.
	* testsuite/ld-scripts/defined3.d: Likewise.
	* testsuite/ld-scripts/defined4.d: Likewise.
	* testsuite/ld-scripts/pr18963.d: Likewise.
	* testsuite/ld-scripts/sane1.d: Likewise.
	* testsuite/ld-scripts/segment-start.d: Likewise.
	* testsuite/ld-scripts/include-1.d: Likewise, and relax text vma.
	* testsuite/ld-scripts/defined5.d: Update xfail and comment.
	* testsuite/ld-scripts/defined5.s: Tweak "defined" to be at
	non-zero section offset.
	* testsuite/ld-scripts/fill16.d: xfail for xcoff.
	* testsuite/ld-scripts/provide-2.d: Accept more symbols.
	* testsuite/ld-scripts/provide-4.d: Likewise.
	* testsuite/ld-scripts/provide-5.d: Likewise.
	* testsuite/ld-scripts/provide-6.d: Likewise.
	* testsuite/ld-scripts/provide-7.d: Likewise.
	* testsuite/ld-scripts/align.t: Accept xcoff mapped .text and .data.
	* testsuite/ld-scripts/defined3.t: Likewise.
	* testsuite/ld-scripts/defined4.t: Likewise.
	* testsuite/ld-scripts/defined5.t: Likewise.
	* testsuite/ld-scripts/fill.t: Likewise.
	* testsuite/ld-scripts/include-subdata.t: Likewise.
	* testsuite/ld-scripts/provide-1.t: Likewise.
	* testsuite/ld-scripts/provide-2.t: Likewise.
	* testsuite/ld-scripts/provide-3.t: Likewise.
	* testsuite/ld-scripts/provide-4.t: Likewise.
	* testsuite/ld-scripts/provide-5.t: Likewise.
	* testsuite/ld-scripts/provide-6.t: Likewise.
	* testsuite/ld-scripts/provide-7.t: Likewise.
	* testsuite/ld-scripts/provide-8.t: Likewise.
	* testsuite/ld-scripts/assign-loc.t: Add required xcoff sections.
	* testsuite/ld-scripts/sizeof.t: Likewise.
	* testsuite/ld-scripts/align2.t: Likewise, and mapped sections.
	* testsuite/ld-scripts/align5.t: Likewise.
	* testsuite/ld-scripts/default-script.t: Likewise.
	* testsuite/ld-scripts/empty-address-1.t: Likewise.
	* testsuite/ld-scripts/empty-address-2a.t: Likewise.
	* testsuite/ld-scripts/empty-address-2b.t: Likewise.
	* testsuite/ld-scripts/empty-address-3a.t: Likewise.
	* testsuite/ld-scripts/empty-address-3b.t: Likewise.
	* testsuite/ld-scripts/empty-address-3c.t: Likewise.
	* testsuite/ld-scripts/include-sections.t: Likewise.
	* testsuite/ld-scripts/pr14962.t: Likewise.
	* testsuite/ld-scripts/sane1.t: Likewise.

diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp
index 3817251730..9370aca6c8 100644
--- a/ld/testsuite/ld-scripts/align.exp
+++ b/ld/testsuite/ld-scripts/align.exp
@@ -19,11 +19,6 @@
 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
-if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"]} {
-    # Target maps .text and .data to other sections.
-    return
-}
-
 set testname "align1"
 
 if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] {
@@ -35,6 +30,8 @@ if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] {
 set saved_LDFLAGS "$LDFLAGS"
 if { [is_pecoff_format] } then {
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 if ![ld_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align.o"] {
diff --git a/ld/testsuite/ld-scripts/align.t b/ld/testsuite/ld-scripts/align.t
index 81c21c6cae..63bf95aa56 100644
--- a/ld/testsuite/ld-scripts/align.t
+++ b/ld/testsuite/ld-scripts/align.t
@@ -1,6 +1,6 @@
 SECTIONS
 {
-  .text : {*(.text)}
+  .text : {*(.text .pr)}
   .data ALIGN(0x1000) : AT (ALIGN (LOADADDR (.text) + SIZEOF (.text), 0x80))
     {}
   ASSERT (LOADADDR(.data) == 0x80, "dyadic ALIGN broken")
diff --git a/ld/testsuite/ld-scripts/align2.t b/ld/testsuite/ld-scripts/align2.t
index d86f62aeab..29ae10e6cc 100644
--- a/ld/testsuite/ld-scripts/align2.t
+++ b/ld/testsuite/ld-scripts/align2.t
@@ -1,7 +1,8 @@
 SECTIONS
 {
-  .text : {*(.text)}
+  .text : {*(.text .pr)}
   . = ALIGN(data_align);
-  .data : {*(.data)}
+  .data : {*(.data .rw)}
+  .bss : {*(.bss)}
   /DISCARD/ : {*(*)}
 }
diff --git a/ld/testsuite/ld-scripts/align5.t b/ld/testsuite/ld-scripts/align5.t
index a0b33e58be..103b216327 100644
--- a/ld/testsuite/ld-scripts/align5.t
+++ b/ld/testsuite/ld-scripts/align5.t
@@ -1,12 +1,15 @@
 SECTIONS
 {
   .text : {
-    SORT_NONE (*) (.text .text.*)
+    SORT_NONE (*) (.text .text.* .pr)
   }
 
   .data : {
-    SORT_NONE (*) (.data .data.*)
+    SORT_NONE (*) (.data .data.* .rw)
     foo = .;
   }
+  .bss : {
+    SORT_NONE (*) (.bss)
+  }
   /DISCARD/ : {*(*)}
 }
diff --git a/ld/testsuite/ld-scripts/assign-loc.d b/ld/testsuite/ld-scripts/assign-loc.d
index f3115b08a6..308df97fca 100644
--- a/ld/testsuite/ld-scripts/assign-loc.d
+++ b/ld/testsuite/ld-scripts/assign-loc.d
@@ -1,7 +1,7 @@
 #ld: -T assign-loc.t
 #source: data.s
 #nm: -n
-#xfail: powerpc*-*-aix* rs6000-*-aix*
+
 #...
 0+0100 A HEAP_SIZE
 #...
diff --git a/ld/testsuite/ld-scripts/assign-loc.t b/ld/testsuite/ld-scripts/assign-loc.t
index e8c5102438..e5b5acd604 100644
--- a/ld/testsuite/ld-scripts/assign-loc.t
+++ b/ld/testsuite/ld-scripts/assign-loc.t
@@ -13,5 +13,8 @@ SECTIONS
 
   _end = .;
 
+  .text : { *(.text) }
+  .data : { *(.data) }
+  .bss : { *(.bss) }
   /DISCARD/ : { *(*) }
 }
diff --git a/ld/testsuite/ld-scripts/data.exp b/ld/testsuite/ld-scripts/data.exp
index d221af42b9..4e20cf7ec1 100644
--- a/ld/testsuite/ld-scripts/data.exp
+++ b/ld/testsuite/ld-scripts/data.exp
@@ -27,6 +27,13 @@ if {[is_aout_format]} {
 	return
 }
 
+set old_LDFLAGS $LDFLAGS
+if { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
+}
+
 run_dump_test data
 run_dump_test fill
 run_dump_test fill16
+
+set LDFLAGS $old_LDFLAGS
diff --git a/ld/testsuite/ld-scripts/default-script.exp b/ld/testsuite/ld-scripts/default-script.exp
index 5c9bf1f1ce..832c2bb847 100644
--- a/ld/testsuite/ld-scripts/default-script.exp
+++ b/ld/testsuite/ld-scripts/default-script.exp
@@ -21,6 +21,8 @@
 set old_ldflags $LDFLAGS
 if { [istarget spu*-*-*] } {
     set LDFLAGS "$LDFLAGS --local-store 0:0"
+} elseif { [is_xcoff_format] } {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 set test_list [lsort [glob -nocomplain $srcdir/$subdir/default-script*.d]]
diff --git a/ld/testsuite/ld-scripts/default-script.t b/ld/testsuite/ld-scripts/default-script.t
index ff0fcda7a9..c800e921b0 100644
--- a/ld/testsuite/ld-scripts/default-script.t
+++ b/ld/testsuite/ld-scripts/default-script.t
@@ -2,6 +2,8 @@ _START = DEFINED(_START) ? _START : 0x900;
 SECTIONS
 {
   . = _START;
-  .text : {*(.text)}
+  .text : {*(.text .pr)}
+  .data : {*(.data)}
+  .bss : {*(.bss)}
   /DISCARD/ : {*(*)}
 }
diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp
index 7a47030c70..18e5c13244 100644
--- a/ld/testsuite/ld-scripts/defined.exp
+++ b/ld/testsuite/ld-scripts/defined.exp
@@ -30,6 +30,8 @@ if ![ld_assemble $as $srcdir/$subdir/defined.s tmpdir/def.o] {
 set saved_LDFLAGS "$LDFLAGS"
 if { [is_pecoff_format] } then {
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 if { ![ld_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] } {
diff --git a/ld/testsuite/ld-scripts/defined3.d b/ld/testsuite/ld-scripts/defined3.d
index 3401e7cbcd..0b3831c6fb 100644
--- a/ld/testsuite/ld-scripts/defined3.d
+++ b/ld/testsuite/ld-scripts/defined3.d
@@ -2,7 +2,6 @@
 #nm: -B
 #source: phdrs.s
 #source: defined.s
-#xfail: powerpc*-*-aix* rs6000-*-aix*
 
 # Check that DEFINED matches only symbols defined before its location.
 # The ellipsis account for target-specific symbols.  Matching both A and T
diff --git a/ld/testsuite/ld-scripts/defined3.t b/ld/testsuite/ld-scripts/defined3.t
index 1fe6eef54e..ede74c9099 100644
--- a/ld/testsuite/ld-scripts/defined3.t
+++ b/ld/testsuite/ld-scripts/defined3.t
@@ -1,6 +1,6 @@
 defined6 = DEFINED (sym2) ? 1 : 0;
 SECTIONS {
-	.text : { *(.text) sym2 = .; }
+	.text : { *(.text .pr) sym2 = .; }
 	.data : { *(.data) }
 	.bss : { *(.bss) *(COMMON) }
 }
diff --git a/ld/testsuite/ld-scripts/defined4.d b/ld/testsuite/ld-scripts/defined4.d
index 0d6e7c54ec..7cc48dac41 100644
--- a/ld/testsuite/ld-scripts/defined4.d
+++ b/ld/testsuite/ld-scripts/defined4.d
@@ -1,7 +1,6 @@
 #ld: -Tdefined4.t
 #nm: -B
 #source: defined4.s
-#xfail: powerpc*-*-aix* rs6000-*-aix*
 #xfail: mips*-*-*
 # We check that defined and defined1 have the same address.  MIPS targets
 # use different address.
diff --git a/ld/testsuite/ld-scripts/defined4.t b/ld/testsuite/ld-scripts/defined4.t
index 1221df2bf1..92a8941da3 100644
--- a/ld/testsuite/ld-scripts/defined4.t
+++ b/ld/testsuite/ld-scripts/defined4.t
@@ -1,6 +1,6 @@
 SECTIONS {
 	.text : { *(.text) }
-	.data : { *(.data) }
+	.data : { *(.data .rw) }
 	.bss : { *(.bss) *(COMMON) }
 }
 defined1 = defined;
diff --git a/ld/testsuite/ld-scripts/defined5.d b/ld/testsuite/ld-scripts/defined5.d
index 8b2574362f..2530c0e09e 100644
--- a/ld/testsuite/ld-scripts/defined5.d
+++ b/ld/testsuite/ld-scripts/defined5.d
@@ -1,7 +1,8 @@
 #ld: -Tdefined5.t
 #nm: -B
 #source: defined5.s
-#xfail: powerpc*-*-aix* rs6000-*-aix*
+#xfail: [is_xcoff_format]
+# xcoff outputs value of "defined" from the object file
 
 # Check that arithmetic on DEFINED works.
 #...
diff --git a/ld/testsuite/ld-scripts/defined5.s b/ld/testsuite/ld-scripts/defined5.s
index 9dd58d693b..16ece95b99 100644
--- a/ld/testsuite/ld-scripts/defined5.s
+++ b/ld/testsuite/ld-scripts/defined5.s
@@ -2,5 +2,5 @@
 	.data
 	.byte 0
 	.text
-defined:
 	.byte 0
+defined:
diff --git a/ld/testsuite/ld-scripts/defined5.t b/ld/testsuite/ld-scripts/defined5.t
index 04daf6606d..6fabceb29a 100644
--- a/ld/testsuite/ld-scripts/defined5.t
+++ b/ld/testsuite/ld-scripts/defined5.t
@@ -1,7 +1,7 @@
 defined = addr1;
 SECTIONS {
-	.text : { *(.text) }
+	.text : { *(.text .pr) }
 	. = ALIGN (0x1000);
-	.data : { *(.data) }
+	.data : { *(.data .rw) }
 	addr1  = ADDR (.data);
 }
diff --git a/ld/testsuite/ld-scripts/empty-address-1.t b/ld/testsuite/ld-scripts/empty-address-1.t
index 7c4b8151c7..a24f25a138 100644
--- a/ld/testsuite/ld-scripts/empty-address-1.t
+++ b/ld/testsuite/ld-scripts/empty-address-1.t
@@ -1,11 +1,12 @@
 SECTIONS
 {
-  .text 0x0000000: { *(.text) }
+  .text 0: { *(.text .pr) }
   .data 0x200:
   {
     __data_start = . ;
     *(.data)
   }
   __data_end = .;
+  .bss : { *(.bss) }
   /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/empty-address-2a.t b/ld/testsuite/ld-scripts/empty-address-2a.t
index 6a40ad8b7c..0ab29a4db2 100644
--- a/ld/testsuite/ld-scripts/empty-address-2a.t
+++ b/ld/testsuite/ld-scripts/empty-address-2a.t
@@ -1,7 +1,8 @@
 SECTIONS
 {
-  .text : { *(.text) }
+  .text : { *(.text .pr) }
   .data : { *(.data) }
   __data_end = .;
+  .bss : { *(.bss) }
   /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/empty-address-2b.t b/ld/testsuite/ld-scripts/empty-address-2b.t
index dcf264f4a2..c6d1e523fc 100644
--- a/ld/testsuite/ld-scripts/empty-address-2b.t
+++ b/ld/testsuite/ld-scripts/empty-address-2b.t
@@ -1,11 +1,12 @@
 SECTIONS
 {
-  .text 0x0000000: { *(.text) }
+  .text 0x0000000: { *(.text .pr) }
   .data :
   {
     PROVIDE (__data_start = .);
     *(.data)
   }
   __data_end = .;
+  .bss : { *(.bss) }
   /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/empty-address-3a.t b/ld/testsuite/ld-scripts/empty-address-3a.t
index 2807e71f56..28767a19c5 100644
--- a/ld/testsuite/ld-scripts/empty-address-3a.t
+++ b/ld/testsuite/ld-scripts/empty-address-3a.t
@@ -1,10 +1,11 @@
 SECTIONS
 {
-  .text 0x00000000: { *(.text) }
+  .text 0x00000000: { *(.text .pr) }
   .data ALIGN(0x1000) + (. & (0x1000 - 1)):
   {
     *(.data)
   }
   __data_end = .;
+  .bss : { *(.bss) }
   /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/empty-address-3b.t b/ld/testsuite/ld-scripts/empty-address-3b.t
index 4f213af519..6da2421885 100644
--- a/ld/testsuite/ld-scripts/empty-address-3b.t
+++ b/ld/testsuite/ld-scripts/empty-address-3b.t
@@ -1,11 +1,12 @@
 SECTIONS
 {
-  .text 0x00000000: { *(.text) }
+  .text 0x00000000: { *(.text .pr) }
   .data ALIGN(0x1000) + (. & (0x1000 - 1)):
   {
     PROVIDE (__data_start = .);
     *(.data)
   }
   __data_end = .;
+  .bss : { *(.bss) }
   /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/empty-address-3c.t b/ld/testsuite/ld-scripts/empty-address-3c.t
index 6de519881f..0829c58a3e 100644
--- a/ld/testsuite/ld-scripts/empty-address-3c.t
+++ b/ld/testsuite/ld-scripts/empty-address-3c.t
@@ -1,11 +1,12 @@
 SECTIONS
 {
-  .text 0x00000000: { *(.text) }
+  .text 0x00000000: { *(.text .pr) }
   .data ALIGN(0x1000) + (. & (0x1000 - 1)):
   {
     __data_start = .;
     *(.data)
   }
   __data_end = .;
+  .bss : { *(.bss) }
   /DISCARD/ : { *(.*) }
 }
diff --git a/ld/testsuite/ld-scripts/empty-address.exp b/ld/testsuite/ld-scripts/empty-address.exp
index d71202a303..0bd45b98a9 100644
--- a/ld/testsuite/ld-scripts/empty-address.exp
+++ b/ld/testsuite/ld-scripts/empty-address.exp
@@ -22,6 +22,8 @@
 set old_LDFLAGS $LDFLAGS
 if { [is_pecoff_format] } then {
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 run_dump_test empty-address-1
diff --git a/ld/testsuite/ld-scripts/expr.exp b/ld/testsuite/ld-scripts/expr.exp
index 7b1c62751d..be7d6b8b4f 100644
--- a/ld/testsuite/ld-scripts/expr.exp
+++ b/ld/testsuite/ld-scripts/expr.exp
@@ -24,6 +24,8 @@ if { [istarget spu*-*-*] } then {
     set LDFLAGS "$LDFLAGS --no-overlays --local-store 0:0"
 } elseif { [is_pecoff_format] } then {
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 run_dump_test expr1
diff --git a/ld/testsuite/ld-scripts/fill.t b/ld/testsuite/ld-scripts/fill.t
index 835e009c48..63f4f84899 100644
--- a/ld/testsuite/ld-scripts/fill.t
+++ b/ld/testsuite/ld-scripts/fill.t
@@ -3,12 +3,12 @@ SECTIONS
   .text :
   {
     . += 4;
-    *0.o(.text)
+    *0.o(.text .pr)
     FILL (0x12)
-    *1.o(.text)
+    *1.o(.text .pr)
     . += 1;
     FILL (0x23)
-    *2.o(.text)
+    *2.o(.text .pr)
     FILL (0x003456)
     . += 4;
     FILL (0x00004567000089ab0000cdef00000123)
diff --git a/ld/testsuite/ld-scripts/fill16.d b/ld/testsuite/ld-scripts/fill16.d
index 6ff1099932..19be5f2c46 100644
--- a/ld/testsuite/ld-scripts/fill16.d
+++ b/ld/testsuite/ld-scripts/fill16.d
@@ -3,7 +3,7 @@
 #source: fill16_2.s
 #ld: -T fill.t
 #objdump: -s -j .text
-#skip: arm-*-coff i[3-7]86-*-coff
+#skip: arm-*-coff i[3-7]86-*-coff [is_xcoff_format]
 #xfail: alpha*-*-*ecoff sh-*-pe sparc*-*-coff
 #xfail: tic30-*-coff tic4x-*-* tic54x-*-* z8k-*-*
 #xfail: z80-*-coff
diff --git a/ld/testsuite/ld-scripts/include-1.d b/ld/testsuite/ld-scripts/include-1.d
index 4ad1fe8cc0..117d331419 100644
--- a/ld/testsuite/ld-scripts/include-1.d
+++ b/ld/testsuite/ld-scripts/include-1.d
@@ -1,13 +1,12 @@
-# name: include-1
-# source: include.s
-# ld: -T include-1.t
-# objdump: -w -h
-# xfail: "*-aix*"
-# AIX targets rename the .text and .data sectons...
+#name: include-1
+#source: include.s
+#ld: -T include-1.t
+#objdump: -w -h
 
 .*:     file format .*
 
 Sections:
 Idx +Name +Size +VMA +LMA +File off +Algn +Flags
-  0 .text         0+0000020  0+0000000  0+0000000  [0-9a-f]+  2\*\*[0-9]+  CONTENTS, ALLOC, LOAD,.*CODE
+  0 .text         0+(20|1000)  0+0000000  0+0000000  [0-9a-f]+  2\*\*[0-9]+  CONTENTS, ALLOC, LOAD,.*CODE
   1 .data         0+0000010  0+0100000  0+0100000  [0-9a-f]+  2\*\*[0-9]+  CONTENTS, ALLOC, LOAD, DATA
+#pass
diff --git a/ld/testsuite/ld-scripts/include-sections.t b/ld/testsuite/ld-scripts/include-sections.t
index 5d6ca1e1ba..51a86edaa2 100644
--- a/ld/testsuite/ld-scripts/include-sections.t
+++ b/ld/testsuite/ld-scripts/include-sections.t
@@ -1,5 +1,6 @@
 SECTIONS {
-	 .text : { *(.text) } >rom
+	 .text : { *(.text .pr) } >rom
 	 INCLUDE include-data.t
+	 .bss : { *(.bss) }
 	 /DISCARD/ : { *(*) }
 }
diff --git a/ld/testsuite/ld-scripts/include-subdata.t b/ld/testsuite/ld-scripts/include-subdata.t
index 136c9f4926..8024e12e68 100644
--- a/ld/testsuite/ld-scripts/include-subdata.t
+++ b/ld/testsuite/ld-scripts/include-subdata.t
@@ -1,2 +1,2 @@
- *(.data)
+ *(.data .rw)
 
diff --git a/ld/testsuite/ld-scripts/include.exp b/ld/testsuite/ld-scripts/include.exp
index c7e2ee58a0..a0bdc5aba8 100644
--- a/ld/testsuite/ld-scripts/include.exp
+++ b/ld/testsuite/ld-scripts/include.exp
@@ -27,6 +27,8 @@ if { [istarget spu*-*-*] } then {
     set LDFLAGS "$LDFLAGS --local-store 0:0 --no-overlays"
 } elseif { [is_pecoff_format] } then {
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 set test_list [lsort [glob -nocomplain $srcdir/$subdir/include*.d]]
diff --git a/ld/testsuite/ld-scripts/pr14962.t b/ld/testsuite/ld-scripts/pr14962.t
index f399acdcef..8780908e5a 100644
--- a/ld/testsuite/ld-scripts/pr14962.t
+++ b/ld/testsuite/ld-scripts/pr14962.t
@@ -2,7 +2,8 @@ NOCROSSREFS ( .text .data )
 x = ABSOLUTE(x);
 SECTIONS
 { 
-  .text : { *(.text) }
-  .data : { *(.data) }
+  .text : { *(.text .pr) }
+  .data : { *(.data .rw) }
+  .bss : { *(.bss) }
   /DISCARD/ : { *(*) }
 }
diff --git a/ld/testsuite/ld-scripts/pr18963.d b/ld/testsuite/ld-scripts/pr18963.d
index 875fe136ad..bda3b063a4 100644
--- a/ld/testsuite/ld-scripts/pr18963.d
+++ b/ld/testsuite/ld-scripts/pr18963.d
@@ -1,9 +1,8 @@
 # source: data.s
 # ld: -T pr18963.t
 # nm: -B -n
-# notarget: *-*-aix* *-*-vms
-# Skip on AIX targets because they require non-empty sections.
-# Plus skip for VMS based targets as the linker automatically adds extra libraries that may not be present in a cross build.
+# notarget: *-*-vms
+# Skip for VMS based targets as the linker automatically adds extra libraries that may not be present in a cross build.
 # 64-bit Cygwin targets always start their sections at 0x200000000 which is why the regexps include a 2.
 
 #...
diff --git a/ld/testsuite/ld-scripts/provide-1.t b/ld/testsuite/ld-scripts/provide-1.t
index 6b96b3389c..0cce3562d2 100644
--- a/ld/testsuite/ld-scripts/provide-1.t
+++ b/ld/testsuite/ld-scripts/provide-1.t
@@ -5,7 +5,7 @@ SECTIONS
     LONG (foo)
     LONG (bar)
     . = ALIGN (0x10);
-    *(.data)
+    *(.data .rw)
   }
   PROVIDE (foo = .);
   PROVIDE (bar = .);
diff --git a/ld/testsuite/ld-scripts/provide-2.d b/ld/testsuite/ld-scripts/provide-2.d
index e151b306b2..88513e8cbd 100644
--- a/ld/testsuite/ld-scripts/provide-2.d
+++ b/ld/testsuite/ld-scripts/provide-2.d
@@ -3,5 +3,6 @@
 #nm: -B
 #...
 0+3 A baz
+#...
 0+2000 D foo
 #pass
diff --git a/ld/testsuite/ld-scripts/provide-2.t b/ld/testsuite/ld-scripts/provide-2.t
index abf6eb324a..885093c08c 100644
--- a/ld/testsuite/ld-scripts/provide-2.t
+++ b/ld/testsuite/ld-scripts/provide-2.t
@@ -6,6 +6,6 @@ SECTIONS
   PROVIDE (baz = 3);
   .data 0x2000 :
   {
-    *(.data)
+    *(.data .rw)
   }
 }
diff --git a/ld/testsuite/ld-scripts/provide-3.t b/ld/testsuite/ld-scripts/provide-3.t
index f6229d4bc0..753d76d7be 100644
--- a/ld/testsuite/ld-scripts/provide-3.t
+++ b/ld/testsuite/ld-scripts/provide-3.t
@@ -4,7 +4,7 @@ SECTIONS
   {
     LONG (foo)
     LONG (bar)
-    *(.data)
+    *(.data .rw)
   }
   foo = .;
   bar = .;
diff --git a/ld/testsuite/ld-scripts/provide-4.d b/ld/testsuite/ld-scripts/provide-4.d
index b77b7dc194..dab25847fb 100644
--- a/ld/testsuite/ld-scripts/provide-4.d
+++ b/ld/testsuite/ld-scripts/provide-4.d
@@ -4,6 +4,10 @@
 #map: provide-4.map
 #...
 0+3 A baz
+#...
 0+2000 D foo
+#...
 0+2010 D loc2
+#...
 0+2030 A loc4
+#pass
diff --git a/ld/testsuite/ld-scripts/provide-4.t b/ld/testsuite/ld-scripts/provide-4.t
index da663db215..5bf581d727 100644
--- a/ld/testsuite/ld-scripts/provide-4.t
+++ b/ld/testsuite/ld-scripts/provide-4.t
@@ -6,7 +6,7 @@ SECTIONS
   PROVIDE (baz = 3);
   .data 0x2000 :
   {
-    *(.data)
+    *(.data .rw)
 
     PROVIDE (loc1 = ALIGN (., 0x10));
     PROVIDE (loc2 = ALIGN (., 0x10));
diff --git a/ld/testsuite/ld-scripts/provide-5.d b/ld/testsuite/ld-scripts/provide-5.d
index c7f9ddb7ba..852c1c6af4 100644
--- a/ld/testsuite/ld-scripts/provide-5.d
+++ b/ld/testsuite/ld-scripts/provide-5.d
@@ -4,3 +4,4 @@
 #map: provide-5.map
 #...
 0+10 A foo
+#pass
diff --git a/ld/testsuite/ld-scripts/provide-5.t b/ld/testsuite/ld-scripts/provide-5.t
index eda741e05c..fc18279517 100644
--- a/ld/testsuite/ld-scripts/provide-5.t
+++ b/ld/testsuite/ld-scripts/provide-5.t
@@ -5,6 +5,6 @@ SECTIONS
 
   .data 0x1000 :
   {
-    *(.data)
+    *(.data .rw)
   }
 }
diff --git a/ld/testsuite/ld-scripts/provide-6.d b/ld/testsuite/ld-scripts/provide-6.d
index fda3c2bd27..6b3808ee4e 100644
--- a/ld/testsuite/ld-scripts/provide-6.d
+++ b/ld/testsuite/ld-scripts/provide-6.d
@@ -5,5 +5,6 @@
 
 #...
 0+1000 D foo
+#...
 0+1000 D foo_2
 #...
diff --git a/ld/testsuite/ld-scripts/provide-6.t b/ld/testsuite/ld-scripts/provide-6.t
index 6b5d11c04b..518593e8f2 100644
--- a/ld/testsuite/ld-scripts/provide-6.t
+++ b/ld/testsuite/ld-scripts/provide-6.t
@@ -2,7 +2,7 @@ SECTIONS
 {
   .data 0x1000 :
   {
-    *(.data)
+    *(.data .rw)
   }
 
   foo = ADDR (.data);
diff --git a/ld/testsuite/ld-scripts/provide-7.d b/ld/testsuite/ld-scripts/provide-7.d
index e2c9504002..396a721df5 100644
--- a/ld/testsuite/ld-scripts/provide-7.d
+++ b/ld/testsuite/ld-scripts/provide-7.d
@@ -4,5 +4,6 @@
 
 #...
 0+10 A foo
+#...
 0+10 A foo_2
 #...
diff --git a/ld/testsuite/ld-scripts/provide-7.t b/ld/testsuite/ld-scripts/provide-7.t
index 882883eda0..d317f2e9cb 100644
--- a/ld/testsuite/ld-scripts/provide-7.t
+++ b/ld/testsuite/ld-scripts/provide-7.t
@@ -2,7 +2,7 @@ SECTIONS
 {
   .data 0x1000 :
   {
-    *(.data)
+    *(.data .rw)
   }
 
   foo = 0x10;
diff --git a/ld/testsuite/ld-scripts/provide-8.t b/ld/testsuite/ld-scripts/provide-8.t
index ffc3467911..a44f2f1f6b 100644
--- a/ld/testsuite/ld-scripts/provide-8.t
+++ b/ld/testsuite/ld-scripts/provide-8.t
@@ -2,7 +2,7 @@ SECTIONS
 {
   .data 0x1000 :
   {
-    *(.data)
+    *(.data .rw)
     QUAD (__FOO);
   }
 
diff --git a/ld/testsuite/ld-scripts/provide.exp b/ld/testsuite/ld-scripts/provide.exp
index 34aed400a1..da31a3701c 100644
--- a/ld/testsuite/ld-scripts/provide.exp
+++ b/ld/testsuite/ld-scripts/provide.exp
@@ -19,11 +19,10 @@
 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
-# AIX maps .text and .data to other sections.
 # a.out objdump displays the file header inside the text segment,
 # confusing run_dump_test.
 
-if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] || [is_aout_format]} {
+if { [is_aout_format] } {
     unsupported provide-1
     unsupported provide-2
     unsupported provide-3
@@ -33,6 +32,8 @@ if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] || [is_aout_forma
 set saved_LDFLAGS "$LDFLAGS"
 if { [is_pecoff_format] } then {
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 set test_list [lsort [glob -nocomplain $srcdir/$subdir/provide-*.d]]
diff --git a/ld/testsuite/ld-scripts/sane1.d b/ld/testsuite/ld-scripts/sane1.d
index 66d6eac173..adc75ba583 100644
--- a/ld/testsuite/ld-scripts/sane1.d
+++ b/ld/testsuite/ld-scripts/sane1.d
@@ -1,9 +1,8 @@
 # source: data.s
 # ld: -T sane1.t
 # nm: -B -n
-# notarget: mmix-* pdp11-* powerpc*-*-aix* rs6000-*-aix*
+# notarget: mmix-* pdp11-*
 # mmix symbol sections are wrong, pdp sign extends 16-bit addresses
-# rs6000-aix doesn't like empty .text
 
 #...
 0+0004 A s5
diff --git a/ld/testsuite/ld-scripts/sane1.t b/ld/testsuite/ld-scripts/sane1.t
index 90ee9b62d0..09c1409990 100644
--- a/ld/testsuite/ld-scripts/sane1.t
+++ b/ld/testsuite/ld-scripts/sane1.t
@@ -20,8 +20,10 @@ SECTIONS
     s4 = ABSOLUTE (d1) - 2;
     s5 = ABSOLUTE (d2) % 5;
     s6 = ABSOLUTE (d2) / 5;
-    *(.data)
+    *(.data .rw)
   }
+  .text : { *(.text) }
+  .bss : { *(.bss) }
   /DISCARD/ : {*(*)}
 
 diff = d2 - d1;
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 108e53989f..58d8b8b7cd 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -187,6 +187,9 @@ set old_LDFLAGS $LDFLAGS
 if { [is_pecoff_format] } then {
     set flags "--image-base 0"
     set LDFLAGS "$LDFLAGS --image-base 0"
+} elseif { [is_xcoff_format] } then {
+    set flags "-bnogc"
+    set LDFLAGS "$LDFLAGS -bnogc"
 }
 
 if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
diff --git a/ld/testsuite/ld-scripts/segment-start.d b/ld/testsuite/ld-scripts/segment-start.d
index eea87ff242..0e124b22d3 100644
--- a/ld/testsuite/ld-scripts/segment-start.d
+++ b/ld/testsuite/ld-scripts/segment-start.d
@@ -2,7 +2,7 @@
 #source: segment-start.s
 #ld: -e 0 -u __executable_start -T segment-start.ld
 #nm: -B
-#xfail: mmix-*-* pdp11-*-* powerpc-*-aix* powerpc-*-beos* rs6000-*-* sh-*-pe
+#xfail: mmix-*-* pdp11-*-* sh-*-pe
 #xfail: tic30-*-*aout* c54x*-*-*coff* tic54x-*-*coff*
 # XFAIL targets that are not expected to handle SEGMENT_START correctly.
 
diff --git a/ld/testsuite/ld-scripts/sizeof.t b/ld/testsuite/ld-scripts/sizeof.t
index 6244a37b7a..e637994943 100644
--- a/ld/testsuite/ld-scripts/sizeof.t
+++ b/ld/testsuite/ld-scripts/sizeof.t
@@ -11,7 +11,12 @@ SECTIONS {
 	    . = . + SIZEOF(.text);
 	    data_end = .;
 	  }
-}	
+	.bss :
+	  {
+	    . = 8;
+	    *(.bss)
+	  }
+}
 
 sizeof_text = SIZEOF(.text);
 sizeof_data = SIZEOF(.data);

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list