diff options
author | Claudiu Zissulescu <claziss@synopsys.com> | 2016-07-08 11:55:49 +0200 |
---|---|---|
committer | Claudiu Zissulescu <claziss@synopsys.com> | 2016-07-14 10:08:57 +0200 |
commit | fa1c0170176a5e4820f43824cffe80ffc4e7a717 (patch) | |
tree | 2e32657a3199223084212b5464a66b2b25d7a6c4 /ld | |
parent | efc67f64c94bddd81f1d9dc00390d3790bfd80bd (diff) | |
download | gdb-fa1c0170176a5e4820f43824cffe80ffc4e7a717.zip gdb-fa1c0170176a5e4820f43824cffe80ffc4e7a717.tar.gz gdb-fa1c0170176a5e4820f43824cffe80ffc4e7a717.tar.bz2 |
[ARC] Fix/improve small data support.
The R_ARC_SDA32 is wrongly described as a ME relocation, fix it. Offset the
__SDATA_BEGIN__ to take advantage of the signed 9-bit field of the
load/store instructions.
include/
2016-07-08 Claudiu Zissulescu <claziss@synopsys.com>
* elf/arc-reloc.def (ARC_SDA32): Don't use ME transformation.
ld/
2016-07-08 Claudiu Zissulescu <claziss@synopsys.com>
* emulparams/arcelf.sh (SDATA_START_SYMBOLS): Add offset.
* testsuite/ld-arc/sda-relocs.dd: New file.
* testsuite/ld-arc/sda-relocs.ld: Likewise.
* testsuite/ld-arc/sda-relocs.rd: Likewise.
* testsuite/ld-arc/sda-relocs.s: Likewise.
* testsuite/ld-arc/arc.exp: Add SDA tests.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 9 | ||||
-rw-r--r-- | ld/emulparams/arcelf.sh | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-arc/arc.exp | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-arc/sda-relocs.dd | 23 | ||||
-rw-r--r-- | ld/testsuite/ld-arc/sda-relocs.ld | 20 | ||||
-rw-r--r-- | ld/testsuite/ld-arc/sda-relocs.rd | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-arc/sda-relocs.s | 32 |
7 files changed, 108 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 98de1fb..035db91 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2016-07-14 Claudiu Zissulescu <claziss@synopsys.com> + + * emulparams/arcelf.sh (SDATA_START_SYMBOLS): Add offset. + * testsuite/ld-arc/sda-relocs.dd: New file. + * testsuite/ld-arc/sda-relocs.ld: Likewise. + * testsuite/ld-arc/sda-relocs.rd: Likewise. + * testsuite/ld-arc/sda-relocs.s: Likewise. + * testsuite/ld-arc/arc.exp: Add SDA tests. + 2016-07-11 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/ld-arc/nps-1b.err: Update test to handle more diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh index 7777f9b..9b52e2c 100644 --- a/ld/emulparams/arcelf.sh +++ b/ld/emulparams/arcelf.sh @@ -15,7 +15,7 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=arc MACHINE= ENTRY=__start -SDATA_START_SYMBOLS='__SDATA_BEGIN__ = .;' +SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;' OTHER_SECTIONS="/DISCARD/ : { *(.__arc_profile_*) }" EMBEDDED=yes diff --git a/ld/testsuite/ld-arc/arc.exp b/ld/testsuite/ld-arc/arc.exp index 0cf6228..f8838cc 100644 --- a/ld/testsuite/ld-arc/arc.exp +++ b/ld/testsuite/ld-arc/arc.exp @@ -28,3 +28,11 @@ foreach arc_test $arc_test_list { run_dump_test [file rootname $arc_test] } +set arccommon_tests { + { "SDA relocs" + "-q -T sda-relocs.ld" "" "-mcpu=archs" {sda-relocs.s} + {{objdump -fdw sda-relocs.dd} {readelf --relocs sda-relocs.rd}} + "sda-relocs.so" } +} + +run_ld_link_tests $arccommon_tests diff --git a/ld/testsuite/ld-arc/sda-relocs.dd b/ld/testsuite/ld-arc/sda-relocs.dd new file mode 100644 index 0000000..c4a3ff6 --- /dev/null +++ b/ld/testsuite/ld-arc/sda-relocs.dd @@ -0,0 +1,23 @@ + +.*: file format .* +architecture: ARCv2, flags 0x00000113: +HAS_RELOC, EXEC_P, HAS_SYMS, D_PAGED +start address 0x00010000 + + +Disassembly of section .text: + +[0-9a-f]+ <__SDATA_BEGIN__>: + [0-9a-f]+: c8[0-9a-f]+ ld_s r0,\[gp,[0-9]+\] + [0-9a-f]+: cc[0-9a-f]+ ld(h|w)_s r0,\[gp,[0-9]+\] + [0-9a-f]+: ca[0-9a-f]+ ldb_s r0,\[gp,[0-9]+\] + [0-9a-f]+: 12[0-9a-f]+ 3600 ld.as r0,\[gp,[0-9]+\] + [0-9a-f]+: 1a[0-9a-f]+ 3018 st.as r0,\[gp,[0-9]+\] + [0-9a-f]+: 12[0-9a-f]+ 3000 ld r0,\[gp,[0-9]+\] + [0-9a-f]+: 12[0-9a-f]+ 3080 ldb r0,\[gp,[0-9]+\] + [0-9a-f]+: 12[0-9a-f]+ 3100 ld(h|w) r0,\[gp,[0-9]+\] + [0-9a-f]+: 1a[0-9a-f]+ 301c sth.as r0,\[gp,[0-9]+\] + [0-9a-f]+: 50[0-9a-f]+ ld_s r1,\[gp,[0-9]+\] + [0-9a-f]+: 50[0-9a-f]+ st_s r0,\[gp,[0-9]+\] + [0-9a-f]+: 2200 3f82 0000 002c add r2,gp,0x[0-9a-f]+ + [0-9a-f]+: 78e0 nop_s diff --git a/ld/testsuite/ld-arc/sda-relocs.ld b/ld/testsuite/ld-arc/sda-relocs.ld new file mode 100644 index 0000000..80dbbb5 --- /dev/null +++ b/ld/testsuite/ld-arc/sda-relocs.ld @@ -0,0 +1,20 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", + "elf32-littlearc") + +OUTPUT_ARCH(arc) +ENTRY(__start) + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__start = 0x10000); + . = 0x10000 + SIZEOF_HEADERS; + + .text : {__SDATA_BEGIN__ = .; *(.text .stub .text.*)} =0 + .sdata : {*(.sdata .sdata.*)} + .sbss : {*(.sbss .sbss.*)} + + /DISCARD/ : { *(.__arc_profile_*) } + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/ld/testsuite/ld-arc/sda-relocs.rd b/ld/testsuite/ld-arc/sda-relocs.rd new file mode 100644 index 0000000..6a52eac --- /dev/null +++ b/ld/testsuite/ld-arc/sda-relocs.rd @@ -0,0 +1,15 @@ + +Relocation section '\.rela\.text' .*: + Offset +Info +Type +Sym.Value +Sym. Name \+ Addend +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA16_LD2 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA16_LD1 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA16_LD [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA_LDST2 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA_LDST2 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA_LDST [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA_LDST [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA_LDST [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA_LDST1 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA16_ST2 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA16_ST2 [0-9a-f]+ a \+ 0 +[0-9a-f]+ [0-9a-f]+ R_ARC_SDA32_ME [0-9a-f]+ a \+ 0 diff --git a/ld/testsuite/ld-arc/sda-relocs.s b/ld/testsuite/ld-arc/sda-relocs.s new file mode 100644 index 0000000..40ff37d --- /dev/null +++ b/ld/testsuite/ld-arc/sda-relocs.s @@ -0,0 +1,32 @@ + .section .text + .align 4 +;;; all the ops should have the same offset. + ld_s r0,[gp,@a@sda] + ;; BFD_RELOC_ARC_SDA16_LD2 + ldh_s r0,[gp,@a@sda] + ;; BFD_RELOC_ARC_SDA16_LD1 + ldb_s r0,[gp,@a@sda] + ;; BFD_RELOC_ARC_SDA16_LD + ld.as r0,[gp,@a@sda] + st.as r0,[gp,@a@sda] + ;; BFD_RELOC_ARC_SDA_LDST2 + ld r0,[gp,@a@sda] + ldb r0,[gp,@a@sda] + ldh r0,[gp,@a@sda] + ;; ldd r0,[gp,@a@sda] + ;; BFD_RELOC_ARC_SDA_LDST + sth.as r0,[gp,@a@sda] + ;; BFD_RELOC_ARC_SDA_LDST1 + ld_s r1,[gp,@a@sda] + st_s r0,[gp,@a@sda] + ;; BFD_ARC_SDA16_ST2 + add r2, gp, @a@sda + ;; BFD_ARC_SDA32_ME + + .global a + .section .sbss,"aw",@nobits + .align 4 + .type a, @object + .size a, 4 +a: + .zero 4 |