diff options
author | Dimitar Dimitrov <dimitar@dinux.eu> | 2016-12-30 12:39:49 +0200 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-12-31 12:04:11 +1030 |
commit | 0220170b4d87ce940d40ac98387ff2d7fbed3ab2 (patch) | |
tree | 7b2208add3316c08c6e087b37f648690861c1f68 /ld/testsuite | |
parent | 93f11b16ec1f5775c7f6c32b4a39d6dd0fb0c92a (diff) | |
download | gdb-0220170b4d87ce940d40ac98387ff2d7fbed3ab2.zip gdb-0220170b4d87ce940d40ac98387ff2d7fbed3ab2.tar.gz gdb-0220170b4d87ce940d40ac98387ff2d7fbed3ab2.tar.bz2 |
PRU LD Port
* NEWS: Mention new PRU target.
* Makefile.am: Add PRU target.
* configure.tgt: Ditto.
* emulparams/pruelf.sh: New file.
* emultempl/pruelf.em: New file.
* scripttempl/pru.sc: New file.
* Makefile.in: Regenerate.
* testsuite/ld-pru/emit-relocs-1.d: New PRU testcase file.
* testsuite/ld-pru/emit-relocs-1.ld: Ditto.
* testsuite/ld-pru/emit-relocs-1a.s: Ditto.
* testsuite/ld-pru/emit-relocs-1b.s
* testsuite/ld-pru/ldi32.d: Ditto.
* testsuite/ld-pru/ldi32.s: Ditto.
* testsuite/ld-pru/ldi32_symbol.s: Ditto.
* testsuite/ld-pru/norelax_ldi32-data.d: Ditto.
* testsuite/ld-pru/norelax_ldi32-dis.d: Ditto.
* testsuite/ld-pru/pcrel_s10.d: Ditto.
* testsuite/ld-pru/pcrel_s10.s: Ditto.
* testsuite/ld-pru/pcrel_s10_label.s: Ditto.
* testsuite/ld-pru/pcrel_u8-illegal.d: Ditto.
* testsuite/ld-pru/pcrel_u8-illegal.s: Ditto.
* testsuite/ld-pru/pcrel_u8-illegal2.d: Ditto.
* testsuite/ld-pru/pcrel_u8-illegal2.s: Ditto.
* testsuite/ld-pru/pcrel_u8-illegal3.d: Ditto.
* testsuite/ld-pru/pcrel_u8-illegal3.s: Ditto.
* testsuite/ld-pru/pcrel_u8.d: Ditto.
* testsuite/ld-pru/pcrel_u8.s: Ditto.
* testsuite/ld-pru/pcrel_u8_label.s: Ditto.
* testsuite/ld-pru/pmem.d: Ditto.
* testsuite/ld-pru/pmem.s: Ditto.
* testsuite/ld-pru/pmem_symbol.s: Ditto.
* testsuite/ld-pru/pru.exp: Ditto.
* testsuite/ld-pru/relax_ldi32-data.d: Ditto.
* testsuite/ld-pru/relax_ldi32-dis.d: Ditto.
* testsuite/ld-pru/relax_ldi32.s: Ditto.
* testsuite/ld-pru/relax_ldi32_symbol.s: Ditto.
* testsuite/ld-pru/reloc.d: Ditto.
* testsuite/ld-pru/reloc.s: Ditto.
* testsuite/ld-pru/reloc_symbol.s: Ditto.
* testsuite/ld-pru/u16.d: Ditto.
* testsuite/ld-pru/u16.s: Ditto.
* testsuite/ld-pru/u16_symbol.s: Ditto.
PRU does not export __end symbol because it is ambiguous for it.
Users are expected to use instead the section markers __text_end,
__data_end, __bss_end or __noinit_end.
* testsuite/lib/ld-lib.exp (check_shared_lib_support): No shared
libraries are supported for PRU.
(check_gc_sections_available): Mark PRU as not supported.
* testsuite/ld-elf/eh-frame-hdr.d: Disable for PRU.
* testsuite/ld-elf/endsym.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr14926.d: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* testsuite/ld-elf/sec64k.exp: Mark sec64k case as too big for PRU.
* testsuite/ld-srec/srec.exp (run_srec_test): Add setup for PRU.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'ld/testsuite')
48 files changed, 489 insertions, 9 deletions
diff --git a/ld/testsuite/ld-elf/eh-frame-hdr.d b/ld/testsuite/ld-elf/eh-frame-hdr.d index f73d0e5..a76ac73 100644 --- a/ld/testsuite/ld-elf/eh-frame-hdr.d +++ b/ld/testsuite/ld-elf/eh-frame-hdr.d @@ -2,7 +2,7 @@ #ld: -e _start --eh-frame-hdr #objdump: -hw #target: cfi -#xfail: avr*-*-* or1k*-*-elf or1k*-*-rtems* visium-*-* +#xfail: avr*-*-* or1k*-*-elf or1k*-*-rtems* pru-*-* visium-*-* # These targets support CFI generation but not shared libraries. #... [0-9] .eh_frame_hdr 0*[12][048c] .* diff --git a/ld/testsuite/ld-elf/endsym.d b/ld/testsuite/ld-elf/endsym.d index eefdd43..3472154 100644 --- a/ld/testsuite/ld-elf/endsym.d +++ b/ld/testsuite/ld-elf/endsym.d @@ -4,6 +4,7 @@ #nm: -n #notarget: hppa*-*-hpux* #xfail: m68hc1*-* xgate-* cr16-*-* crx-*-* dlx-*-* nds32*-*-* visium-*-* +#xfail: pru-*-* #... .* end diff --git a/ld/testsuite/ld-elf/group8a.d b/ld/testsuite/ld-elf/group8a.d index 45955ba..52112e9 100644 --- a/ld/testsuite/ld-elf/group8a.d +++ b/ld/testsuite/ld-elf/group8a.d @@ -1,7 +1,7 @@ #source: group8.s #ld: -r --gc-sections --entry foo #readelf: -g --wide -#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* +#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* pru-*-* #notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* #xfail: cr16-*-* crx-*-* # generic linker targets don't support --gc-sections, nor do a bunch of others diff --git a/ld/testsuite/ld-elf/group8b.d b/ld/testsuite/ld-elf/group8b.d index 0175c7f..879cd13 100644 --- a/ld/testsuite/ld-elf/group8b.d +++ b/ld/testsuite/ld-elf/group8b.d @@ -1,7 +1,7 @@ #source: group8.s #ld: -r --gc-sections --entry bar #readelf: -g --wide -#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* +#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* pru-*-* #notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* #xfail: cr16-*-* crx-*-* # generic linker targets don't support --gc-sections, nor do a bunch of others diff --git a/ld/testsuite/ld-elf/group9a.d b/ld/testsuite/ld-elf/group9a.d index 44fe606..346254b 100644 --- a/ld/testsuite/ld-elf/group9a.d +++ b/ld/testsuite/ld-elf/group9a.d @@ -1,7 +1,7 @@ #source: group9.s #ld: -r --gc-sections --entry foo #readelf: -g --wide -#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* +#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* pru-*-* #notarget: alpha-*-* hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* #xfail: cr16-*-* crx-*-* # generic linker targets don't support --gc-sections, nor do a bunch of others diff --git a/ld/testsuite/ld-elf/group9b.d b/ld/testsuite/ld-elf/group9b.d index 4ab2ba6..3005f8f 100644 --- a/ld/testsuite/ld-elf/group9b.d +++ b/ld/testsuite/ld-elf/group9b.d @@ -1,7 +1,7 @@ #source: group9.s #ld: -r --gc-sections --entry bar #readelf: -g --wide -#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* +#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* pru-*-* #notarget: alpha-*-* hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* #xfail: cr16-*-* crx-*-* # generic linker targets don't support --gc-sections, nor do a bunch of others diff --git a/ld/testsuite/ld-elf/merge.d b/ld/testsuite/ld-elf/merge.d index 818959d..d46acb6 100644 --- a/ld/testsuite/ld-elf/merge.d +++ b/ld/testsuite/ld-elf/merge.d @@ -6,7 +6,7 @@ #xfail: "i370-*-*" "i860-*-*" "i960-*-*" "ip2k-*-*" "iq2000-*-*" "lm32-*-*" #xfail: "mcore-*-*" "mn102*-*-*" "ms1-*-*" "mep-*-*" "m68hc11-*-*" #xfail: "or32-*-*" "pj-*-*" "sparc*-*-*" "tic6x-*-*" "vax-*-*" "xstormy16-*-*" -#xfail: "xtensa*-*-*" "metag-*-*" "ft32-*-*" +#xfail: "xtensa*-*-*" "metag-*-*" "ft32-*-*" "pru-*-*" .*: file format .*elf.* diff --git a/ld/testsuite/ld-elf/pr12851.d b/ld/testsuite/ld-elf/pr12851.d index 48ecb09..61c224d 100644 --- a/ld/testsuite/ld-elf/pr12851.d +++ b/ld/testsuite/ld-elf/pr12851.d @@ -2,7 +2,7 @@ #source: start.s #ld: --gc-sections #readelf: -s --wide -#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* +#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-* pru-*-* #notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* # generic linker targets don't support --gc-sections, nor do a bunch of others diff --git a/ld/testsuite/ld-elf/pr14926.d b/ld/testsuite/ld-elf/pr14926.d index 88c521c..8fc8e64 100644 --- a/ld/testsuite/ld-elf/pr14926.d +++ b/ld/testsuite/ld-elf/pr14926.d @@ -1,6 +1,6 @@ #ld: -Ttext=0x60 #readelf: -S --wide -#notarget: d10v-* m68hc1*-* msp*-* visium-* xgate-* xstormy*-* +#notarget: d10v-* m68hc1*-* msp*-* visium-* xgate-* xstormy*-* pru-*-* # the above targets use memory regions that don't allow 0x60 for .text #... diff --git a/ld/testsuite/ld-elf/sec-to-seg.exp b/ld/testsuite/ld-elf/sec-to-seg.exp index 8847318..af3d604 100644 --- a/ld/testsuite/ld-elf/sec-to-seg.exp +++ b/ld/testsuite/ld-elf/sec-to-seg.exp @@ -87,6 +87,7 @@ if { [istarget avr-*-*] || [istarget moxie-*-*] || [istarget msp430-*-*] || [istarget mt-*-*] + || [istarget pru-*-*] || [istarget visium-*-*] } { set B_test_same_seg 0 diff --git a/ld/testsuite/ld-elf/sec64k.exp b/ld/testsuite/ld-elf/sec64k.exp index 7f7a9f3..283d779 100644 --- a/ld/testsuite/ld-elf/sec64k.exp +++ b/ld/testsuite/ld-elf/sec64k.exp @@ -170,7 +170,8 @@ if { ![istarget "d10v-*-*"] && ![istarget "avr-*-*"] && ![istarget "msp*-*-*"] && ![istarget "fr30-*-*"] - && ![istarget "iq2000-*-*"] } { + && ![istarget "iq2000-*-*"] + && ![istarget "pru-*-*"] } { foreach sfile $sfiles { puts $ofd "#source: $sfile" } if { [istarget spu*-*-*] } { puts $ofd "#ld: --local-store 0:0" diff --git a/ld/testsuite/ld-pru/emit-relocs-1.d b/ld/testsuite/ld-pru/emit-relocs-1.d new file mode 100644 index 0000000..414234f --- /dev/null +++ b/ld/testsuite/ld-pru/emit-relocs-1.d @@ -0,0 +1,37 @@ +#name: Emit relocs 1 +#source: emit-relocs-1a.s +#source: emit-relocs-1b.s +#ld: -q -T emit-relocs-1.ld +#objdump: -sr + +.*: file format .* + +RELOCATION RECORDS FOR \[\.data\]: +OFFSET TYPE VALUE * +00000000 R_PRU_BFD_RELOC32 \.data +00000004 R_PRU_BFD_RELOC32 \.data\+0x00001000 +00000008 R_PRU_BFD_RELOC32 \.merge1\+0x00000002 +0000000c R_PRU_BFD_RELOC32 \.merge2 +00000010 R_PRU_BFD_RELOC32 \.merge3 +00000014 R_PRU_BFD_RELOC32 \.merge3\+0x00000004 +00000020 R_PRU_BFD_RELOC32 \.data\+0x00000020 +00000024 R_PRU_BFD_RELOC32 \.data\+0x00001020 +00000028 R_PRU_BFD_RELOC32 \.merge1 +0000002c R_PRU_BFD_RELOC32 \.merge2\+0x00000002 +00000030 R_PRU_BFD_RELOC32 \.merge3\+0x00000008 +00000034 R_PRU_BFD_RELOC32 \.merge3\+0x00000004 + + +Contents of section \.text: + 80000 e0e0e012 00000000 00000000 00000000 .* +Contents of section \.merge1: + 80400 666c7574 74657200 flutter.* +Contents of section \.merge2: + 80800 74617374 696e6700 tasting.* +Contents of section \.merge3: + 80c00 00010000 00020000 00030000 .* +Contents of section \.data: + 81000 00100800 00200800 02040800 00080800 .* + 81010 000c0800 040c0800 00000000 00000000 .* + 81020 20100800 20200800 00040800 02080800 .* + 81030 080c0800 040c0800 .* diff --git a/ld/testsuite/ld-pru/emit-relocs-1.ld b/ld/testsuite/ld-pru/emit-relocs-1.ld new file mode 100644 index 0000000..1879ef4 --- /dev/null +++ b/ld/testsuite/ld-pru/emit-relocs-1.ld @@ -0,0 +1,20 @@ +ENTRY(_start) +SECTIONS +{ + . = 0x80000; + .text : { *(.text) } + + . = ALIGN (0x400); + .merge1 : { *(.merge1) } + + . = ALIGN (0x400); + .merge2 : { *(.merge2) } + + . = ALIGN (0x400); + .merge3 : { *(.merge3) } + + . = ALIGN (0x400); + .data : { *(.data) } + + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-pru/emit-relocs-1a.s b/ld/testsuite/ld-pru/emit-relocs-1a.s new file mode 100644 index 0000000..bf0a8a1 --- /dev/null +++ b/ld/testsuite/ld-pru/emit-relocs-1a.s @@ -0,0 +1,24 @@ + .text + .align 4 + .globl _start +_start: + nop + + .section .merge1,"aMS",@progbits,1 +A: .string "utter" + + .section .merge2,"aMS",@progbits,1 +B: .string "tasting" + + .section .merge3,"aM",@progbits,4 +C: .4byte 0x100 +D: .4byte 0x200 + + .data + .align 4 +E: .4byte E + .4byte E + 0x1000 + .4byte A + .4byte B + .4byte C + .4byte D diff --git a/ld/testsuite/ld-pru/emit-relocs-1b.s b/ld/testsuite/ld-pru/emit-relocs-1b.s new file mode 100644 index 0000000..82229c1 --- /dev/null +++ b/ld/testsuite/ld-pru/emit-relocs-1b.s @@ -0,0 +1,18 @@ + .section .merge1,"aMS",@progbits,1 +A: .string "flutter" + + .section .merge2,"aMS",@progbits,1 +B: .string "sting" + + .section .merge3,"aM",@progbits,4 +C: .4byte 0x300 +D: .4byte 0x200 + + .data + .align 4 +E: .4byte E + .4byte E + 0x1000 + .4byte A + .4byte B + .4byte C + .4byte D diff --git a/ld/testsuite/ld-pru/ldi32.d b/ld/testsuite/ld-pru/ldi32.d new file mode 100644 index 0000000..123ead3 --- /dev/null +++ b/ld/testsuite/ld-pru/ldi32.d @@ -0,0 +1,12 @@ +#name: PRU R_PRU_LDI32 +#source: ldi32.s +#source: ldi32_symbol.s +#ld: +#objdump: -dr --prefix-addresses + +# Test the ldi32 relocation +.*: +file format elf32-pru + +Disassembly of section .text: +[0-9a-f]+ <[^>]*> ldi r16, 48879 +[0-9a-f]+ <[^>]*> ldi r16.w2, 57005 diff --git a/ld/testsuite/ld-pru/ldi32.s b/ld/testsuite/ld-pru/ldi32.s new file mode 100644 index 0000000..1165fe6 --- /dev/null +++ b/ld/testsuite/ld-pru/ldi32.s @@ -0,0 +1,6 @@ +# Test the ldi32 relocation + + .text + .global _start +_start: + ldi32 r16, long_symbol diff --git a/ld/testsuite/ld-pru/ldi32_symbol.s b/ld/testsuite/ld-pru/ldi32_symbol.s new file mode 100644 index 0000000..2e16066 --- /dev/null +++ b/ld/testsuite/ld-pru/ldi32_symbol.s @@ -0,0 +1,2 @@ + .global long_symbol + .set long_symbol, 0xDEADBEEF diff --git a/ld/testsuite/ld-pru/norelax_ldi32-data.d b/ld/testsuite/ld-pru/norelax_ldi32-data.d new file mode 100644 index 0000000..47fc2c1 --- /dev/null +++ b/ld/testsuite/ld-pru/norelax_ldi32-data.d @@ -0,0 +1,20 @@ +#name: PRU LDI32 disabled-relaxation data +#source: relax_ldi32.s +#source: relax_ldi32_symbol.s +#as: --mlink-relax +#ld: --no-relax +#objdump: -s + +# Note: default linker script should put a guard at DRAM address 0 + +.*: +file format elf32-pru + +Contents of section .text: + [0-9a-f]+ f0efbe24 d0adde24 0f00f630 f0efbe24 .* + [0-9a-f]+ d0adde24 f0cace24 d0000024 e0cace24 .* + [0-9a-f]+ f0cace24 d0010024 f0efbe24 d0acde24 .* + [0-9a-f]+ f0785624 d0341224 f0785624 d0000024 .* + [0-9a-f]+ f0120024 f100007e .* +Contents of section .data: + 0000 00000000 48000020 40000000 12004000 .* + 0010 10000000 f0ffffff 100040aa .* diff --git a/ld/testsuite/ld-pru/norelax_ldi32-dis.d b/ld/testsuite/ld-pru/norelax_ldi32-dis.d new file mode 100644 index 0000000..072de5f --- /dev/null +++ b/ld/testsuite/ld-pru/norelax_ldi32-dis.d @@ -0,0 +1,29 @@ +#name: PRU LDI32 disabled-relaxation +#source: relax_ldi32.s +#source: relax_ldi32_symbol.s +#as: --mlink-relax +#ld: --no-relax +#objdump: -dr --prefix-addresses + +# Test the LDI32 relaxation +.*: +file format elf32-pru + +Disassembly of section .text: +..000000 <[^>]*> ldi r16, 48879 +..000004 <[^>]*> ldi r16.w2, 57005 +..000008 <[^>]*> loop ..000044 <__end_loop>, r22 +..00000c <[^>]*> ldi r16, 48879 +..000010 <[^>]*> ldi r16.w2, 57005 +..000014 <[^>]*> ldi r16, 52938 +..000018 <[^>]*> ldi r16.w2, 0 +..00001c <[^>]*> ldi r0, 52938 +..000020 <[^>]*> ldi r16, 52938 +..000024 <[^>]*> ldi r16.w2, 1 +..000028 <[^>]*> ldi r16, 48879 +..00002c <[^>]*> ldi r16.w2, 57004 +..000030 <[^>]*> ldi r16, 22136 +..000034 <[^>]*> ldi r16.w2, 4660 +..000038 <[^>]*> ldi r16, 22136 +..00003c <[^>]*> ldi r16.w2, 0 +..000040 <[^>]*> ldi r16, 18 +..000044 <[^>]*> qba ..000008 <__intermediate> diff --git a/ld/testsuite/ld-pru/pcrel_s10.d b/ld/testsuite/ld-pru/pcrel_s10.d new file mode 100644 index 0000000..95602c5 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_s10.d @@ -0,0 +1,18 @@ +#name: PRU R_PRU_S10_PCREL +#source: pcrel_s10.s +#source: pcrel_s10_label.s +#ld: +#objdump: -dr --prefix-addresses + +# Test the relative quick branch relocations. +.*: +file format elf32-pru + +Disassembly of section .text: +[0-9a-f]+ <[^>]*> qba [0-9a-f]+ <ext_label> +[0-9a-f]+ <[^>]*> qba [0-9a-f]+ <ext_label\+0x10> +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop diff --git a/ld/testsuite/ld-pru/pcrel_s10.s b/ld/testsuite/ld-pru/pcrel_s10.s new file mode 100644 index 0000000..2a55773 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_s10.s @@ -0,0 +1,7 @@ +# Test for pc-relative relocations + .text + .section .init0, "x" + .global _start +_start: + qba ext_label + qba ext_label + 16 diff --git a/ld/testsuite/ld-pru/pcrel_s10_label.s b/ld/testsuite/ld-pru/pcrel_s10_label.s new file mode 100644 index 0000000..2dc424c --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_s10_label.s @@ -0,0 +1,9 @@ + .text +ext_label: + nop + nop + nop + nop + nop + nop + .global ext_label diff --git a/ld/testsuite/ld-pru/pcrel_u8-illegal.d b/ld/testsuite/ld-pru/pcrel_u8-illegal.d new file mode 100644 index 0000000..a885237 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8-illegal.d @@ -0,0 +1,7 @@ +#name: PRU R_PRU_U8_PCREL illegal +#source: pcrel_u8-illegal.s +#source: pcrel_u8_label.s +#ld: +#error: [^\n]*: relocation truncated to fit: R_PRU_U8_PCREL against `.init0' + +# Check that LOOP cannot reference "prior" labels. diff --git a/ld/testsuite/ld-pru/pcrel_u8-illegal.s b/ld/testsuite/ld-pru/pcrel_u8-illegal.s new file mode 100644 index 0000000..e33bd80 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8-illegal.s @@ -0,0 +1,9 @@ +# Test for illegal pc-relative relocations + .text + .section .init0, "x" + .global _start +_start: +foo: +# Negative loop termination point + nop + loop foo, r20 diff --git a/ld/testsuite/ld-pru/pcrel_u8-illegal2.d b/ld/testsuite/ld-pru/pcrel_u8-illegal2.d new file mode 100644 index 0000000..604ea98 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8-illegal2.d @@ -0,0 +1,7 @@ +#name: PRU R_PRU_U8_PCREL illegal offset 0 +#source: pcrel_u8-illegal2.s +#source: pcrel_u8_label.s +#ld: +#error: [^\n]*: relocation out of range + +# Check that LOOP cannot reference "prior" labels. diff --git a/ld/testsuite/ld-pru/pcrel_u8-illegal2.s b/ld/testsuite/ld-pru/pcrel_u8-illegal2.s new file mode 100644 index 0000000..a4bcf97 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8-illegal2.s @@ -0,0 +1,7 @@ +# Test for illegal pc-relative relocations + .text + .section .init0, "x" + .global _start +_start: +L0: + loop L0, r0 diff --git a/ld/testsuite/ld-pru/pcrel_u8-illegal3.d b/ld/testsuite/ld-pru/pcrel_u8-illegal3.d new file mode 100644 index 0000000..604ea98 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8-illegal3.d @@ -0,0 +1,7 @@ +#name: PRU R_PRU_U8_PCREL illegal offset 0 +#source: pcrel_u8-illegal2.s +#source: pcrel_u8_label.s +#ld: +#error: [^\n]*: relocation out of range + +# Check that LOOP cannot reference "prior" labels. diff --git a/ld/testsuite/ld-pru/pcrel_u8-illegal3.s b/ld/testsuite/ld-pru/pcrel_u8-illegal3.s new file mode 100644 index 0000000..8eb71f5 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8-illegal3.s @@ -0,0 +1,7 @@ +# Test for illegal pc-relative relocations + .text + .section .init0, "x" + .global _start +_start: + loop L1, r0 +L1: diff --git a/ld/testsuite/ld-pru/pcrel_u8.d b/ld/testsuite/ld-pru/pcrel_u8.d new file mode 100644 index 0000000..60ff058 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8.d @@ -0,0 +1,15 @@ +#name: PRU R_PRU_U8_PCREL +#source: pcrel_u8.s +#source: pcrel_u8_label.s +#ld: +#objdump: -dr --prefix-addresses + +# Test the relative quick branch relocations. +.*: +file format elf32-pru + +Disassembly of section .text: +[0-9a-f]+ <[^>]*> loop [0-9a-f]+ <end_loop>, 5 +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop +[0-9a-f]+ <[^>]*> nop diff --git a/ld/testsuite/ld-pru/pcrel_u8.s b/ld/testsuite/ld-pru/pcrel_u8.s new file mode 100644 index 0000000..948e5a5 --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8.s @@ -0,0 +1,9 @@ +# Test for pc-relative relocations + .text + .section .init0, "x" + .global _start +_start: + loop end_loop, 5 + nop + nop + nop diff --git a/ld/testsuite/ld-pru/pcrel_u8_label.s b/ld/testsuite/ld-pru/pcrel_u8_label.s new file mode 100644 index 0000000..e4652fa --- /dev/null +++ b/ld/testsuite/ld-pru/pcrel_u8_label.s @@ -0,0 +1,4 @@ + .text +end_loop: + nop + .global end_loop diff --git a/ld/testsuite/ld-pru/pmem.d b/ld/testsuite/ld-pru/pmem.d new file mode 100644 index 0000000..b5747de --- /dev/null +++ b/ld/testsuite/ld-pru/pmem.d @@ -0,0 +1,15 @@ +#name: PRU R_PRU_BFD_*_PMEM +#source: pmem.s +#source: pmem_symbol.s +#ld: +#objdump: -s + +# Note: default linker script should put a guard at DRAM address 0 + +.*: +file format elf32-pru + +Contents of section .text: + [0-9a-f]+ e0050024 e0070024 05000000 05000600 .* + [0-9a-f]+ e0e0e012 e0e0e012 .* +Contents of section .data: + 0000 00000000 .* diff --git a/ld/testsuite/ld-pru/pmem.s b/ld/testsuite/ld-pru/pmem.s new file mode 100644 index 0000000..4c67ae3 --- /dev/null +++ b/ld/testsuite/ld-pru/pmem.s @@ -0,0 +1,15 @@ +# Test for PRU pmem relocations + + .global byte_sym + .global short_sym + .global long_sym + + .set byte_sym, 0xFA + .set short_sym, 0xFACE + .set long_sym, 0xDEADBEEF + + .text + .global _text_label + nop +_text_label: + nop diff --git a/ld/testsuite/ld-pru/pmem_symbol.s b/ld/testsuite/ld-pru/pmem_symbol.s new file mode 100644 index 0000000..d3eb386 --- /dev/null +++ b/ld/testsuite/ld-pru/pmem_symbol.s @@ -0,0 +1,13 @@ + .text + .section .init0, "x" + .global _start +_start: + + # U16_PMEMIMM + ldi r0, %pmem(_text_label) + ldi r0, %pmem(_text_label + 8) + +# Try 32/16_PMEM + .4byte %pmem(_text_label) + .2byte %pmem(_text_label) + .2byte %pmem(_text_label + 4) diff --git a/ld/testsuite/ld-pru/pru.exp b/ld/testsuite/ld-pru/pru.exp new file mode 100644 index 0000000..ac01a3c --- /dev/null +++ b/ld/testsuite/ld-pru/pru.exp @@ -0,0 +1,8 @@ +if { ! [istarget pru-*-*] } { + return +} + +foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] { + verbose [file rootname $test] + run_dump_test [file rootname $test] +} diff --git a/ld/testsuite/ld-pru/relax_ldi32-data.d b/ld/testsuite/ld-pru/relax_ldi32-data.d new file mode 100644 index 0000000..2c24fe4 --- /dev/null +++ b/ld/testsuite/ld-pru/relax_ldi32-data.d @@ -0,0 +1,19 @@ +#name: PRU LDI32 relaxation data +#source: relax_ldi32.s +#source: relax_ldi32_symbol.s +#as: --mlink-relax +#ld: --relax +#objdump: -s + +# Note: default linker script should put a guard at DRAM address 0 + +.*: +file format elf32-pru + +Contents of section .text: + [0-9a-f]+ f0efbe24 d0adde24 0d00f630 f0efbe24 .* + [0-9a-f]+ d0adde24 f0cace24 e0cace24 f0cace24 .* + [0-9a-f]+ d0010024 f0efbe24 d0acde24 f0785624 .* + [0-9a-f]+ d0341224 f0785624 f0100024 f300007e .* +Contents of section .data: + 0000 00000000 40000020 38000000 10003800 .* + 0010 0e000000 f2ffffff 0e0038aa .* diff --git a/ld/testsuite/ld-pru/relax_ldi32-dis.d b/ld/testsuite/ld-pru/relax_ldi32-dis.d new file mode 100644 index 0000000..1371f1c --- /dev/null +++ b/ld/testsuite/ld-pru/relax_ldi32-dis.d @@ -0,0 +1,27 @@ +#name: PRU LDI32 relaxation +#source: relax_ldi32.s +#source: relax_ldi32_symbol.s +#as: --mlink-relax +#ld: --relax +#objdump: -dr --prefix-addresses + +# Test the LDI32 relaxation +.*: +file format elf32-pru + +Disassembly of section .text: +..000000 <[^>]*> ldi r16, 48879 +..000004 <[^>]*> ldi r16.w2, 57005 +..000008 <[^>]*> loop ..00003c <__end_loop>, r22 +..00000c <[^>]*> ldi r16, 48879 +..000010 <[^>]*> ldi r16.w2, 57005 +..000014 <[^>]*> ldi r16, 52938 +..000018 <[^>]*> ldi r0, 52938 +..00001c <[^>]*> ldi r16, 52938 +..000020 <[^>]*> ldi r16.w2, 1 +..000024 <[^>]*> ldi r16, 48879 +..000028 <[^>]*> ldi r16.w2, 57004 +..00002c <[^>]*> ldi r16, 22136 +..000030 <[^>]*> ldi r16.w2, 4660 +..000034 <[^>]*> ldi r16, 22136 +..000038 <[^>]*> ldi r16, 16 +..00003c <[^>]*> qba ..000008 <__intermediate> diff --git a/ld/testsuite/ld-pru/relax_ldi32.s b/ld/testsuite/ld-pru/relax_ldi32.s new file mode 100644 index 0000000..18fb57f --- /dev/null +++ b/ld/testsuite/ld-pru/relax_ldi32.s @@ -0,0 +1,30 @@ +# Test LDI32 relaxation + + .text + .global _start +_start: + ldi32 r16, long_symbol +__intermediate: + loop __end_loop, r22 + ldi32 r16, long_symbol + ldi32 r16, short_symbol + ldi r0, short_symbol + ldi32 r16, short_symbol + 0x10000 + ldi32 r16, long_symbol - 0x10000 + ldi32 r16, 0x12345678 + ldi32 r16, 0x5678 + ldi r16, %pmem(__end) +__end_loop: + qba __intermediate +__end: + + .data + .4byte __end + .4byte (__end - __intermediate) + .2byte %pmem(__end) + .2byte (__end - __intermediate) + .4byte %pmem(__end - __intermediate) + .4byte %pmem(__intermediate - __end) + .2byte %pmem(__end - __intermediate) + .byte (__end - __intermediate) + .byte 0xaa diff --git a/ld/testsuite/ld-pru/relax_ldi32_symbol.s b/ld/testsuite/ld-pru/relax_ldi32_symbol.s new file mode 100644 index 0000000..c2cf554 --- /dev/null +++ b/ld/testsuite/ld-pru/relax_ldi32_symbol.s @@ -0,0 +1,5 @@ + .global long_symbol + .global short_symbol + + .set long_symbol, 0xDEADBEEF + .set short_symbol, 0xceca diff --git a/ld/testsuite/ld-pru/reloc.d b/ld/testsuite/ld-pru/reloc.d new file mode 100644 index 0000000..8bd1cec --- /dev/null +++ b/ld/testsuite/ld-pru/reloc.d @@ -0,0 +1,14 @@ +#name: PRU R_PRU_BFD_RELOC_XX +#source: reloc.s +#source: reloc_symbol.s +#ld: +#objdump: -s + +# Note: default linker script should put a guard at DRAM address 0 + +.*: +file format elf32-pru + +Contents of section .text: + [0-9a-f]+ fa00cefa efbeadde facefaef beadde00 .* +Contents of section .data: + 0000 00000000 .* diff --git a/ld/testsuite/ld-pru/reloc.s b/ld/testsuite/ld-pru/reloc.s new file mode 100644 index 0000000..3d40c2e --- /dev/null +++ b/ld/testsuite/ld-pru/reloc.s @@ -0,0 +1,9 @@ +# Test for PRU 32-bit, 16 and 8-bit relocations + + .global byte_sym + .global short_sym + .global long_sym + + .set byte_sym, 0xFA + .set short_sym, 0xFACE + .set long_sym, 0xDEADBEEF diff --git a/ld/testsuite/ld-pru/reloc_symbol.s b/ld/testsuite/ld-pru/reloc_symbol.s new file mode 100644 index 0000000..160a824 --- /dev/null +++ b/ld/testsuite/ld-pru/reloc_symbol.s @@ -0,0 +1,24 @@ + .text + .section .init0, "x" + .global _start +_start: + +# byte aligned + .align 0 + .byte byte_sym + +# short aligned + .align 1 + .short short_sym + +# word aligned + .align 2 + .long long_sym + +# now lets try some unaligned words and halfwords + .byte byte_sym + .2byte short_sym + .4byte long_sym + +# .align 2 +# nop diff --git a/ld/testsuite/ld-pru/u16.d b/ld/testsuite/ld-pru/u16.d new file mode 100644 index 0000000..9cc6482 --- /dev/null +++ b/ld/testsuite/ld-pru/u16.d @@ -0,0 +1,11 @@ +#name: PRU R_PRU_U16 +#source: u16.s +#source: u16_symbol.s +#ld: +#objdump: -dr --prefix-addresses + +# Test the regulard LDI relocation +.*: +file format elf32-pru + +Disassembly of section .text: +[0-9a-f]+ <[^>]*> ldi r16, 54321 diff --git a/ld/testsuite/ld-pru/u16.s b/ld/testsuite/ld-pru/u16.s new file mode 100644 index 0000000..4527b8f --- /dev/null +++ b/ld/testsuite/ld-pru/u16.s @@ -0,0 +1,4 @@ + .text + .global _start +_start: + ldi r16, short_symbol diff --git a/ld/testsuite/ld-pru/u16_symbol.s b/ld/testsuite/ld-pru/u16_symbol.s new file mode 100644 index 0000000..5e4e79d --- /dev/null +++ b/ld/testsuite/ld-pru/u16_symbol.s @@ -0,0 +1,2 @@ + .global short_symbol + .set short_symbol, 54321 diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp index 9fcf07a..10b0a51 100644 --- a/ld/testsuite/ld-srec/srec.exp +++ b/ld/testsuite/ld-srec/srec.exp @@ -300,6 +300,11 @@ proc run_srec_test { test objs } { set flags "$flags -no-relax" } + # PRU ELF target relaxes by default; S-Record linker does not + if [istarget pru*-*-*] { + set flags "$flags -no-relax" + } + if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \ || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } { fail $test diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index de0848a..5049b12 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1705,6 +1705,7 @@ proc check_gc_sections_available { } { || [istarget dlx-*-*] || [istarget i960-*-*] || [istarget pj*-*-*] + || [istarget pru*-*-*] || [istarget alpha-*-*] || [istarget hppa*64-*-*] || [istarget i370-*-*] @@ -1777,6 +1778,7 @@ proc check_shared_lib_support { } { && ![istarget nds32*-*-*] && ![istarget or1k*-*-*] && ![istarget pj-*-*] + && ![istarget pru-*-*] && ![istarget rl78-*-*] && ![istarget rx-*-*] && ![istarget spu-*-*] |