diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index dd17dc93a4..1e447f15ac 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2004-11-04 Hans-Peter Nilsson + + * ld-elf/merge.d: xfail crisv32-*-*. + * ld-cris/dsov32-1.s, ld-cris/dsov32-2.s, ld-cris/dsov32-3.s, + ld-cris/dsov32-4.s, ld-cris/libdso-10.d, ld-cris/libdso-11.d, + ld-cris/libdso-12.d, ld-cris/libdso-13.d, ld-cris/libdso-14.d, + ld-cris/move-1.s, ld-cris/pv32-1.d, ld-cris/pv32.s, + ld-cris/start1.s, ld-cris/v10-v32.d, ld-cris/v10-va.d, + ld-cris/v32-ba-1.d, ld-cris/v32-ba-1.s, ld-cris/v32-bin-1.d, + ld-cris/v32-bin-1.s, ld-cris/v32-v10.d, ld-cris/v32-va.d, + ld-cris/va-v10.d, ld-cris/va-v32.d: New tests. + * ld-cris/ldsym1.d: Adjust for change in linker script. + 2004-11-02 Hans-Peter Nilsson * ld-cris/expdyn1.d, ld-cris/expdyn5.d, ld-cris/expdyn6.d, diff --git a/ld/testsuite/ld-cris/dsov32-1.s b/ld/testsuite/ld-cris/dsov32-1.s new file mode 100644 index 0000000000..07a3e9c48a --- /dev/null +++ b/ld/testsuite/ld-cris/dsov32-1.s @@ -0,0 +1,8 @@ + .text + .global dsofn3 + .type dsofn3,@function +dsofn3: + bsr dsofn:PLT + nop +.Lfe1: + .size dsofn3,.Lfe1-dsofn3 diff --git a/ld/testsuite/ld-cris/dsov32-2.s b/ld/testsuite/ld-cris/dsov32-2.s new file mode 100644 index 0000000000..672f273090 --- /dev/null +++ b/ld/testsuite/ld-cris/dsov32-2.s @@ -0,0 +1,10 @@ + .text + .global dsofn4 + .type dsofn4,@function +dsofn4: + lapc _GLOBAL_OFFSET_TABLE_,$r0 + addo.w expobj:GOT16,$r0,$acr + bsr dsofn4:PLT + nop +.Lfe1: + .size dsofn4,.Lfe1-dsofn4 diff --git a/ld/testsuite/ld-cris/dsov32-3.s b/ld/testsuite/ld-cris/dsov32-3.s new file mode 100644 index 0000000000..768b06c63a --- /dev/null +++ b/ld/testsuite/ld-cris/dsov32-3.s @@ -0,0 +1,8 @@ + .text + .global dsofn5 + .type dsofn5,@function +dsofn5: + bsr dsofn + nop +.Lfe1: + .size dsofn5,.Lfe1-dsofn5 diff --git a/ld/testsuite/ld-cris/dsov32-4.s b/ld/testsuite/ld-cris/dsov32-4.s new file mode 100644 index 0000000000..d06768ae2c --- /dev/null +++ b/ld/testsuite/ld-cris/dsov32-4.s @@ -0,0 +1,14 @@ + .text + .global dsofn5 + .type dsofn5,@function +dsofn5: + bsr localfn + nop +.Lfe: + .size dsofn5,.Lfe-dsofn5 + + .type localfn,@function +localfn: + nop +.Lfe1: + .size localfn,.Lfe1-localfn diff --git a/ld/testsuite/ld-cris/ldsym1.d b/ld/testsuite/ld-cris/ldsym1.d index 558fc9caa9..1a2a61a994 100644 --- a/ld/testsuite/ld-cris/ldsym1.d +++ b/ld/testsuite/ld-cris/ldsym1.d @@ -13,8 +13,8 @@ Disassembly of section \.text: -0+6 <__start>: - 6: 0f05 nop +0+ <__start>: + 0: 0f05 nop -0+8 : - 8: 0f05 nop +0+2 : + 2: 0f05 nop diff --git a/ld/testsuite/ld-cris/libdso-10.d b/ld/testsuite/ld-cris/libdso-10.d new file mode 100644 index 0000000000..7b7171a43b --- /dev/null +++ b/ld/testsuite/ld-cris/libdso-10.d @@ -0,0 +1,41 @@ +#source: dso-1.s +#as: --pic --no-underscore --march=v32 +#ld: --shared -m crislinux +#objdump: -p -h + +# Sanity check; just an empty GOT. + +.*: file format elf32-cris + +Program Header: + LOAD off 0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13 + filesz 0x0+188 memsz 0x0+188 flags r-x + LOAD off 0x0+1a0 vaddr 0x0+21a0 paddr 0x0+21a0 align 2\*\*13 + filesz 0x0+64 memsz 0x0+80 flags rw- + DYNAMIC off 0x0+1a0 vaddr 0x0+21a0 paddr 0x0+21a0 align 2\*\*2 + filesz 0x0+58 memsz 0x0+58 flags rw- +Dynamic Section: + HASH 0x94 + STRTAB 0x15c + SYMTAB 0xcc + STRSZ 0x28 + SYMENT 0x10 +private flags = 2: \[v32\] +Sections: +Idx Name Size VMA LMA File off Algn + 0 \.hash 0+38 0+94 0+94 0+94 2\*\*2 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 1 \.dynsym 0+90 0+cc 0+cc 0+cc 2\*\*2 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 2 \.dynstr 0+28 0+15c 0+15c 0+15c 2\*\*0 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 3 \.text 0+4 0+184 0+184 0+184 2\*\*0 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 4 \.dynamic 0+58 0+21a0 0+21a0 0+1a0 2\*\*2 + CONTENTS, ALLOC, LOAD, DATA + 5 \.got 0+c 0+21f8 0+21f8 0+1f8 2\*\*2 + CONTENTS, ALLOC, LOAD, DATA + 6 \.data 0+ 0+2204 0+2204 0+204 2\*\*0 + CONTENTS, ALLOC, LOAD, DATA + 7 \.bss 0+1c 0+2204 0+2204 0+204 2\*\*0 + ALLOC diff --git a/ld/testsuite/ld-cris/libdso-11.d b/ld/testsuite/ld-cris/libdso-11.d new file mode 100644 index 0000000000..440bec3bff --- /dev/null +++ b/ld/testsuite/ld-cris/libdso-11.d @@ -0,0 +1,27 @@ +#source: dso-1.s +#source: dsov32-1.s +#as: --pic --no-underscore --march=v32 +#ld: --shared -m crislinux +#objdump: -s -T + +.*: file format elf32-cris + +DYNAMIC SYMBOL TABLE: +#... +0+1e4 g DF \.text 0+8 dsofn3 +#... +0+1e0 g DF \.text 0+ dsofn +#... +Contents of section \.rela\.plt: + 01a0 84220000 0b090000 00000000 .* +Contents of section \.plt: + 01ac 84e20401 7e7a3f7a 04f26ffa bf09b005 .* + 01bc 00000000 00000000 00006f0d 0c000000 .* + 01cc 6ffabf09 b0053f7e 00000000 bf0ed4ff .* + 01dc ffffb005 .* +Contents of section \.text: + 01e0 b0050000 bfbee2ff ffffb005 .* +Contents of section \.dynamic: +#... +Contents of section \.got: + 2278 00220000 00000000 00000000 d2010000 .* diff --git a/ld/testsuite/ld-cris/libdso-12.d b/ld/testsuite/ld-cris/libdso-12.d new file mode 100644 index 0000000000..f339ac22f2 --- /dev/null +++ b/ld/testsuite/ld-cris/libdso-12.d @@ -0,0 +1,51 @@ +#source: expdyn1.s +#source: dsov32-1.s +#source: dsov32-2.s +#as: --pic --no-underscore --march=v32 +#ld: --shared -m crislinux -z nocombreloc +#objdump: -s -T + +# Check for common DSO contents; load of GOT register, branch to +# function PLT, undefined symbol, GOT reloc. + +.*: file format elf32-cris + +DYNAMIC SYMBOL TABLE: +#... +0+282 g DF \.text 0+12 dsofn4 +0+278 g DF \.text 0+2 expfn +0+2348 g DO \.data 0+ expobj +#... +0+27a g DF \.text 0+8 dsofn3 +#... +0+ D \*UND\* 0+ dsofn +#... +Contents of section \.rela\.got: + 0204 44230000 0a070000 00000000 .* +Contents of section \.rela\.plt: + 0210 3c230000 0b050000 00000000 40230000 .* + 0220 0b0d0000 00000000 .* +Contents of section \.plt: + 0228 84e20401 7e7a3f7a 04f26ffa bf09b005 .* + 0238 00000000 00000000 00006f0d 0c000000 .* + 0248 6ffabf09 b0053f7e 00000000 bf0ed4ff .* + 0258 ffffb005 6f0d1000 00006ffa bf09b005 .* + 0268 3f7e0c00 0000bf0e baffffff b005 .* +Contents of section \.text: + 0276 b005b005 bfbee2ff ffffb005 7f0dae20 .* + 0286 00005f0d 1400bfbe b6ffffff b0050000 .* +Contents of section \.dynamic: + 22a0 04000000 94000000 05000000 c0010000 .* + 22b0 06000000 e0000000 0a000000 43000000 .* + 22c0 0b000000 10000000 03000000 30230000 .* + 22d0 02000000 18000000 14000000 07000000 .* + 22e0 17000000 10020000 07000000 04020000 .* + 22f0 08000000 0c000000 09000000 0c000000 .* + 2300 00000000 00000000 00000000 00000000 .* + 2310 00000000 00000000 00000000 00000000 .* + 2320 00000000 00000000 00000000 00000000 .* +Contents of section \.got: + 2330 a0220000 00000000 00000000 4e020000 .* + 2340 68020000 00000000 .* +Contents of section \.data: + 2348 00000000 .* diff --git a/ld/testsuite/ld-cris/libdso-13.d b/ld/testsuite/ld-cris/libdso-13.d new file mode 100644 index 0000000000..d86dae9e0c --- /dev/null +++ b/ld/testsuite/ld-cris/libdso-13.d @@ -0,0 +1,28 @@ +#source: dso-1.s +#source: dsov32-3.s +#as: --pic --no-underscore --march=v32 +#ld: --shared -m crislinux +#readelf: -d -r +#error: relocation R_CRIS_32_PCREL should not be used in a shared object; recompile with -fPIC + +# FIXME: Have a textrel-enabling linker option. Split out the +# expected readelf output into a separate test using that option. +# Check that a TEXTREL reloc is correctly generated for PCREL +# relocations. + +Dynamic segment at offset 0x240 contains 10 entries: + Tag[ ]+Type[ ]+Name/Value + 0x0+4 \(HASH\)[ ]+0x94 + 0x0+5 \(STRTAB\)[ ]+0x1e8 + 0x0+6 \(SYMTAB\)[ ]+0xe8 + 0x0+a \(STRSZ\)[ ]+47 \(bytes\) + 0x0+b \(SYMENT\)[ ]+16 \(bytes\) + 0x0+7 \(RELA\)[ ]+0x218 + 0x0+8 \(RELASZ\)[ ]+12 \(bytes\) + 0x0+9 \(RELAENT\)[ ]+12 \(bytes\) + 0x0+16 \(TEXTREL\)[ ]+0x0 + 0x0+ \(NULL\)[ ]+0x0 + +Relocation section '\.rela\.text' at offset 0x218 contains 1 entries: + Offset[ ]+Info[ ]+Type[ ]+Sym\.Value Sym\. Name \+ Addend +0+22a 0+f06 R_CRIS_32_PCREL[ ]+0+224[ ]+dsofn \+ 6 diff --git a/ld/testsuite/ld-cris/libdso-14.d b/ld/testsuite/ld-cris/libdso-14.d new file mode 100644 index 0000000000..2258927ab3 --- /dev/null +++ b/ld/testsuite/ld-cris/libdso-14.d @@ -0,0 +1,19 @@ +#source: dso-1.s +#source: dsov32-4.s +#as: --pic --no-underscore --march=v32 +#ld: --shared -m crislinux +#readelf: -d -r + +# Checking that a bsr to a non-PLT-decorated nonvisible function +# doesn't make the DSO textrel. + +Dynamic section at offset 0x1c0 contains 6 entries: + Tag[ ]+Type[ ]+Name/Value + 0x0+4 \(HASH\)[ ]+0x94 + 0x0+5 \(STRTAB\)[ ]+0x170 + 0x0+6 \(SYMTAB\)[ ]+0xd0 + 0x0+a \(STRSZ\)[ ]+47 \(bytes\) + 0x0+b \(SYMENT\)[ ]+16 \(bytes\) + 0x0+ \(NULL\)[ ]+0x0 + +There are no relocations in this file. diff --git a/ld/testsuite/ld-cris/move-1.s b/ld/testsuite/ld-cris/move-1.s new file mode 100644 index 0000000000..c0232858fd --- /dev/null +++ b/ld/testsuite/ld-cris/move-1.s @@ -0,0 +1,3 @@ + .text +localsym: + moveq 1,$r10 diff --git a/ld/testsuite/ld-cris/pv32-1.d b/ld/testsuite/ld-cris/pv32-1.d new file mode 100644 index 0000000000..177fc13769 --- /dev/null +++ b/ld/testsuite/ld-cris/pv32-1.d @@ -0,0 +1,41 @@ +#source: pv32.s +#as: --march=v32 --no-underscore +#ld: -e here -m crislinux tmpdir/libdso-12.so +#objdump: -s -T + +# Trivial test of linking a program to a v32 DSO. + +.*: file format elf32-cris + +DYNAMIC SYMBOL TABLE: +0+822a0 g DO \*ABS\* 0+ _DYNAMIC +0+8023a DF \*UND\* 0+2 expfn +0+82354 g DO \.bss 0+ expobj +0+82354 g D \*ABS\* 0+ __bss_start +0+80254 DF \*UND\* 0+8 dsofn3 +0+82354 g D \*ABS\* 0+ _edata +0+82360 g D \*ABS\* 0+ _end +0+80280 g DF \.text 0+8 dsofn + +Contents of section \.interp: + 800d4 2f6c6962 2f6c642e 736f2e31 00 .* +#... +Contents of section \.rela\.dyn: + 801fc 54230800 09030000 00000000 .* +Contents of section \.rela\.plt: + 80208 4c230800 0b020000 00000000 50230800 .* + 80218 0b050000 00000000 .* +Contents of section \.plt: + 80220 84e26ffe 44230800 7e7a3f7a 04f26ffa .* + 80230 bf09b005 00000000 00006ffe 4c230800 .* + 80240 6ffabf09 b0053f7e 00000000 bf0ed4ff .* + 80250 ffffb005 6ffe5023 08006ffa bf09b005 .* + 80260 3f7e0c00 0000bf0e baffffff b005 .* +Contents of section \.text: + 8026e b005bfbe caffffff b005bfbe dcffffff .* + 8027e b0056fae 54230800 b0050000 .* +Contents of section \.dynamic: +#... +Contents of section \.got: + 82340 a0220800 00000000 00000000 46020800 .* + 82350 60020800 .* diff --git a/ld/testsuite/ld-cris/pv32.s b/ld/testsuite/ld-cris/pv32.s new file mode 100644 index 0000000000..d5ef7c63f8 --- /dev/null +++ b/ld/testsuite/ld-cris/pv32.s @@ -0,0 +1,24 @@ + .global here + .type here,@function +here: + nop +.Lfe3: + .size here,.Lfe3-dsofn + + .type pfn,@function +pfn: + bsr expfn + nop + bsr dsofn3 + nop +.Lfe1: + .size pfn,.Lfe1-pfn + + .global dsofn + .type dsofn,@function +dsofn: + move.d expobj,$r10 + nop +.Lfe2: + .size dsofn,.Lfe2-dsofn + diff --git a/ld/testsuite/ld-cris/start1.s b/ld/testsuite/ld-cris/start1.s new file mode 100644 index 0000000000..ef09d37284 --- /dev/null +++ b/ld/testsuite/ld-cris/start1.s @@ -0,0 +1,5 @@ + .global _start +_start: +; This must be compilable with --march=common_v10_v32. + moveq 1,r11 + diff --git a/ld/testsuite/ld-cris/v10-v32.d b/ld/testsuite/ld-cris/v10-v32.d new file mode 100644 index 0000000000..259f60ba55 --- /dev/null +++ b/ld/testsuite/ld-cris/v10-v32.d @@ -0,0 +1,8 @@ +# source: start1.s --march=v32 +# source: move-1.s --march=v0_v10 +# ld: +# error: contains non-CRIS-v32 code + +# Test that linking a (classic) v10 object to a v32 object does +# not work. + diff --git a/ld/testsuite/ld-cris/v10-va.d b/ld/testsuite/ld-cris/v10-va.d new file mode 100644 index 0000000000..6dd7ca8f63 --- /dev/null +++ b/ld/testsuite/ld-cris/v10-va.d @@ -0,0 +1,11 @@ +# source: start1.s --march=common_v10_v32 +# source: move-1.s --march=v0_v10 +# ld: +# objdump: -p + +# Test that linking a v10 compatible object to a v10+v32 object +# does work and results in the output marked as a v10 object. + +#... +private flags = 1: \[symbols have a _ prefix\] +#pass diff --git a/ld/testsuite/ld-cris/v32-ba-1.d b/ld/testsuite/ld-cris/v32-ba-1.d new file mode 100644 index 0000000000..686b5342c4 --- /dev/null +++ b/ld/testsuite/ld-cris/v32-ba-1.d @@ -0,0 +1,18 @@ +# as: --march=v32 +# ld: +# objdump: -d + +# Check that 32-bit branches (PCREL:s) are relocated right. + +.*: file format elf32-us-cris + +Disassembly of section \.text: + +0+ : + 0: bf0e 0800 0000 ba 8 + 6: 5e82 moveq 30,r8 + +0+8 : + 8: 4312 moveq 3,r1 + a: bf0e f6ff ffff ba 0 <(a|___init__start)> + 10: 4db2 moveq 13,r11 diff --git a/ld/testsuite/ld-cris/v32-ba-1.s b/ld/testsuite/ld-cris/v32-ba-1.s new file mode 100644 index 0000000000..189769ea3f --- /dev/null +++ b/ld/testsuite/ld-cris/v32-ba-1.s @@ -0,0 +1,11 @@ + .global a +a: + ba b + moveq 30,r8 + + .section .text.2,"ax" + .global b +b: + moveq 3,r1 + ba a + moveq 13,r11 diff --git a/ld/testsuite/ld-cris/v32-bin-1.d b/ld/testsuite/ld-cris/v32-bin-1.d new file mode 100644 index 0000000000..ef2d39ab5d --- /dev/null +++ b/ld/testsuite/ld-cris/v32-bin-1.d @@ -0,0 +1,11 @@ +#as: --em=criself --march=v32 +#ld: --oformat binary --defsym ext1=0x4000 --defsym ext2=0x6000 +#objdump: -s -b binary + +# Test that pcrel relocs work with --oformat binary. + +.*: file format binary + +Contents of section \.data: + 0000 7f5d0020 0000bfbe fa7f0000 b0057f3d .* + 0010 f23f0000 bfbeec5f 0000b005 .* diff --git a/ld/testsuite/ld-cris/v32-bin-1.s b/ld/testsuite/ld-cris/v32-bin-1.s new file mode 100644 index 0000000000..1f021d8077 --- /dev/null +++ b/ld/testsuite/ld-cris/v32-bin-1.s @@ -0,0 +1,7 @@ +x: + lapc 0x2000,r5 + bsr 0x8000 + nop + lapc ext1,r3 + bsr ext2 + nop diff --git a/ld/testsuite/ld-cris/v32-v10.d b/ld/testsuite/ld-cris/v32-v10.d new file mode 100644 index 0000000000..27b477df2c --- /dev/null +++ b/ld/testsuite/ld-cris/v32-v10.d @@ -0,0 +1,7 @@ +# source: start1.s --march=v0_v10 +# source: move-1.s --march=v32 +# ld: +# error: contains CRIS v32 code + +# Test that linking a v32 object to a (classic) v10 object does +# not work. diff --git a/ld/testsuite/ld-cris/v32-va.d b/ld/testsuite/ld-cris/v32-va.d new file mode 100644 index 0000000000..4c516f6f72 --- /dev/null +++ b/ld/testsuite/ld-cris/v32-va.d @@ -0,0 +1,11 @@ +# source: start1.s --march=common_v10_v32 +# source: move-1.s --march=v32 +# ld: +# objdump: -p + +# Test that linking a v32 object to a v10+v32 object +# does work and results in the output marked as a v32 object. + +#... +private flags = 3: \[symbols have a _ prefix\] \[v32\] +#pass diff --git a/ld/testsuite/ld-cris/va-v10.d b/ld/testsuite/ld-cris/va-v10.d new file mode 100644 index 0000000000..8612b5828f --- /dev/null +++ b/ld/testsuite/ld-cris/va-v10.d @@ -0,0 +1,11 @@ +# source: start1.s --march=v0_v10 +# source: move-1.s --march=common_v10_v32 +# ld: +# objdump: -p + +# Test that linking a v10+v32 compatible object to a v10 object +# does work and results in the output marked as a v10 object. + +#... +private flags = 1: \[symbols have a _ prefix\] +#pass diff --git a/ld/testsuite/ld-cris/va-v32.d b/ld/testsuite/ld-cris/va-v32.d new file mode 100644 index 0000000000..81e86751d3 --- /dev/null +++ b/ld/testsuite/ld-cris/va-v32.d @@ -0,0 +1,11 @@ +# source: start1.s --march=v32 +# source: move-1.s --march=common_v10_v32 +# ld: +# objdump: -p + +# Test that linking a v10+v32 compatible object to a v32 object +# does work and results in the output marked as a v32 object. + +#... +private flags = 3: \[symbols have a _ prefix\] \[v32\] +#pass diff --git a/ld/testsuite/ld-elf/merge.d b/ld/testsuite/ld-elf/merge.d index 192e8a2e88..fc55c631ff 100644 --- a/ld/testsuite/ld-elf/merge.d +++ b/ld/testsuite/ld-elf/merge.d @@ -4,7 +4,7 @@ #xfail: "arc-*-*" "avr-*-*" "cris-*-*" "dlx-*-*" "fr30-*-*" "frv-*-*" #xfail: "hppa*-*-*" "h8300-*-*" "i960-*-*" "ip2k-*-*" "m32r-*-*" "mcore-*-*" #xfail: "mn10*-*-*" "mips*-*-*" "openrisc-*-*" "pj-*-*" "sparc*-*-*" -#xfail: "xtensa-*-*" +#xfail: "xtensa-*-*" "crisv32-*-*" .*: file format .*elf.*