+2020-07-07 Alan Modra <amodra@gmail.com>
+
+ * 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.
+
2020-07-07 Alan Modra <amodra@gmail.com>
* testsuite/ld-scripts/align.exp: Use is_pecoff_format.
# 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] {
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"] {
SECTIONS
{
- .text : {*(.text)}
+ .text : {*(.text .pr)}
.data ALIGN(0x1000) : AT (ALIGN (LOADADDR (.text) + SIZEOF (.text), 0x80))
{}
ASSERT (LOADADDR(.data) == 0x80, "dyadic ALIGN broken")
SECTIONS
{
- .text : {*(.text)}
+ .text : {*(.text .pr)}
. = ALIGN(data_align);
- .data : {*(.data)}
+ .data : {*(.data .rw)}
+ .bss : {*(.bss)}
/DISCARD/ : {*(*)}
}
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/ : {*(*)}
}
#ld: -T assign-loc.t
#source: data.s
#nm: -n
-#xfail: powerpc*-*-aix* rs6000-*-aix*
+
#...
0+0100 A HEAP_SIZE
#...
_end = .;
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) }
/DISCARD/ : { *(*) }
}
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
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]]
SECTIONS
{
. = _START;
- .text : {*(.text)}
+ .text : {*(.text .pr)}
+ .data : {*(.data)}
+ .bss : {*(.bss)}
/DISCARD/ : {*(*)}
}
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"] } {
#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
defined6 = DEFINED (sym2) ? 1 : 0;
SECTIONS {
- .text : { *(.text) sym2 = .; }
+ .text : { *(.text .pr) sym2 = .; }
.data : { *(.data) }
.bss : { *(.bss) *(COMMON) }
}
#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.
SECTIONS {
.text : { *(.text) }
- .data : { *(.data) }
+ .data : { *(.data .rw) }
.bss : { *(.bss) *(COMMON) }
}
defined1 = defined;
#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.
#...
.data
.byte 0
.text
-defined:
.byte 0
+defined:
defined = addr1;
SECTIONS {
- .text : { *(.text) }
+ .text : { *(.text .pr) }
. = ALIGN (0x1000);
- .data : { *(.data) }
+ .data : { *(.data .rw) }
addr1 = ADDR (.data);
}
SECTIONS
{
- .text 0x0000000: { *(.text) }
+ .text 0: { *(.text .pr) }
.data 0x200:
{
__data_start = . ;
*(.data)
}
__data_end = .;
+ .bss : { *(.bss) }
/DISCARD/ : { *(.*) }
}
SECTIONS
{
- .text : { *(.text) }
+ .text : { *(.text .pr) }
.data : { *(.data) }
__data_end = .;
+ .bss : { *(.bss) }
/DISCARD/ : { *(.*) }
}
SECTIONS
{
- .text 0x0000000: { *(.text) }
+ .text 0x0000000: { *(.text .pr) }
.data :
{
PROVIDE (__data_start = .);
*(.data)
}
__data_end = .;
+ .bss : { *(.bss) }
/DISCARD/ : { *(.*) }
}
SECTIONS
{
- .text 0x00000000: { *(.text) }
+ .text 0x00000000: { *(.text .pr) }
.data ALIGN(0x1000) + (. & (0x1000 - 1)):
{
*(.data)
}
__data_end = .;
+ .bss : { *(.bss) }
/DISCARD/ : { *(.*) }
}
SECTIONS
{
- .text 0x00000000: { *(.text) }
+ .text 0x00000000: { *(.text .pr) }
.data ALIGN(0x1000) + (. & (0x1000 - 1)):
{
PROVIDE (__data_start = .);
*(.data)
}
__data_end = .;
+ .bss : { *(.bss) }
/DISCARD/ : { *(.*) }
}
SECTIONS
{
- .text 0x00000000: { *(.text) }
+ .text 0x00000000: { *(.text .pr) }
.data ALIGN(0x1000) + (. & (0x1000 - 1)):
{
__data_start = .;
*(.data)
}
__data_end = .;
+ .bss : { *(.bss) }
/DISCARD/ : { *(.*) }
}
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
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
.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)
#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
-# 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
SECTIONS {
- .text : { *(.text) } >rom
+ .text : { *(.text .pr) } >rom
INCLUDE include-data.t
+ .bss : { *(.bss) }
/DISCARD/ : { *(*) }
}
- *(.data)
+ *(.data .rw)
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]]
x = ABSOLUTE(x);
SECTIONS
{
- .text : { *(.text) }
- .data : { *(.data) }
+ .text : { *(.text .pr) }
+ .data : { *(.data .rw) }
+ .bss : { *(.bss) }
/DISCARD/ : { *(*) }
}
# 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.
#...
LONG (foo)
LONG (bar)
. = ALIGN (0x10);
- *(.data)
+ *(.data .rw)
}
PROVIDE (foo = .);
PROVIDE (bar = .);
#nm: -B
#...
0+3 A baz
+#...
0+2000 D foo
#pass
PROVIDE (baz = 3);
.data 0x2000 :
{
- *(.data)
+ *(.data .rw)
}
}
{
LONG (foo)
LONG (bar)
- *(.data)
+ *(.data .rw)
}
foo = .;
bar = .;
#map: provide-4.map
#...
0+3 A baz
+#...
0+2000 D foo
+#...
0+2010 D loc2
+#...
0+2030 A loc4
+#pass
PROVIDE (baz = 3);
.data 0x2000 :
{
- *(.data)
+ *(.data .rw)
PROVIDE (loc1 = ALIGN (., 0x10));
PROVIDE (loc2 = ALIGN (., 0x10));
#map: provide-5.map
#...
0+10 A foo
+#pass
.data 0x1000 :
{
- *(.data)
+ *(.data .rw)
}
}
#...
0+1000 D foo
+#...
0+1000 D foo_2
#...
{
.data 0x1000 :
{
- *(.data)
+ *(.data .rw)
}
foo = ADDR (.data);
#...
0+10 A foo
+#...
0+10 A foo_2
#...
{
.data 0x1000 :
{
- *(.data)
+ *(.data .rw)
}
foo = 0x10;
{
.data 0x1000 :
{
- *(.data)
+ *(.data .rw)
QUAD (__FOO);
}
# 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
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]]
# 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
s4 = ABSOLUTE (d1) - 2;
s5 = ABSOLUTE (d2) % 5;
s6 = ABSOLUTE (d2) / 5;
- *(.data)
+ *(.data .rw)
}
+ .text : { *(.text) }
+ .bss : { *(.bss) }
/DISCARD/ : {*(*)}
diff = d2 - d1;
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"] {
#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.
. = . + SIZEOF(.text);
data_end = .;
}
-}
+ .bss :
+ {
+ . = 8;
+ *(.bss)
+ }
+}
sizeof_text = SIZEOF(.text);
sizeof_data = SIZEOF(.data);