Forgot to set should_relocate to TRUE in case of GOT and TLS relocations of
undefined symbols for shared libraries.
In dynamic libraries if symbol is not known the instruction relocation would
not be resolved to point to the respective .got entry.
A test was created to detect similar future mistakes.
bfd/ChangeLog:
Cupertino Miranda <
[email protected]>
* elf32-arc.c (elf_arc_relocate_section): Changed. Set should_relocate
to TRUE for GOT and TLS relocs.
ld/ChangeLog:
Cupertino Miranda <
[email protected]>
* ld/testsuite/ld-arc/tls_gd-01.s: Added a testcase for this patch.
* ld/testsuite/ld-arc/tls_gd-01.d: Likewise.
+
+ * elf32-arc.c (elf_arc_relocate_section): Changed. Set should_relocate
+ to TRUE for GOT and TLS relocs.
+
* elf32-arc.c (elf_arc_finish_dynamic_sections): Changed.
if ((is_reloc_for_GOT (howto)
|| is_reloc_for_TLS (howto)))
{
+ reloc_data.should_relocate = TRUE;
+
struct got_entry **list
= get_got_entry_list_for_symbol (output_bfd, r_symndx, h);
+
+ * ld/testsuite/ld-arc/tls_gd-01.s: Added a testcase for this patch.
+ * ld/testsuite/ld-arc/tls_gd-01.d: Likewise.
+
* testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
--- /dev/null
+#source: tls_gd-01.s
+#as: -mcpu=arc700
+#ld: -shared
+#objdump: -d
+
+[^:]+: file format elf32-littlearc
+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <__start>:
+ [0-9a-f]+: 2700 7f80 0000 2080 add r0,pcl,0x2080
+ [0-9a-f]+: 2700 7f80 0000 2080 add r0,pcl,0x2080
--- /dev/null
+ .text
+ .align 4
+
+ .global __start
+__start:
+ add r0, pcl, @baz@tlsgd
+ add r0, pcl, @bar@tlsgd