aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ChangeLog4
-rw-r--r--include/elf/arc-reloc.def2
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/emulparams/arcelf.sh2
-rw-r--r--ld/testsuite/ld-arc/arc.exp8
-rw-r--r--ld/testsuite/ld-arc/sda-relocs.dd23
-rw-r--r--ld/testsuite/ld-arc/sda-relocs.ld20
-rw-r--r--ld/testsuite/ld-arc/sda-relocs.rd15
-rw-r--r--ld/testsuite/ld-arc/sda-relocs.s32
9 files changed, 113 insertions, 2 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 7e8cd9f..23b8a07 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2016-07-14 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * elf/arc-reloc.def (ARC_SDA32): Don't use ME transformation.
+
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com>
* include/elf/arm.h (SHF_ARM_NOREAD): Rename to ...
diff --git a/include/elf/arc-reloc.def b/include/elf/arc-reloc.def
index a995056..17c2429 100644
--- a/include/elf/arc-reloc.def
+++ b/include/elf/arc-reloc.def
@@ -139,7 +139,7 @@ ARC_RELOC_HOWTO(ARC_SDA32, 18, \
32, \
replace_word32, \
signed, \
- ( ME ( ( ( S + A ) - _SDA_BASE_ ) ) ))
+ ( ( ( S + A ) - _SDA_BASE_ ) ))
ARC_RELOC_HOWTO(ARC_SDA_LDST, 19, \
2, \
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