aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-03-29 16:54:22 +0000
committerDaniel Jacobowitz <drow@false.org>2005-03-29 16:54:22 +0000
commitba93b8aced8f39a02c47731e89278fe6f217d929 (patch)
tree10d828c846f4224226a06d2d2bd4e31283b9d289 /gas
parent71a976dd82f4a544374e4f40b9a1d6ec1f5525ad (diff)
downloadgdb-ba93b8aced8f39a02c47731e89278fe6f217d929.zip
gdb-ba93b8aced8f39a02c47731e89278fe6f217d929.tar.gz
gdb-ba93b8aced8f39a02c47731e89278fe6f217d929.tar.bz2
bfd/
* bfd-in2.h, libbfd.h: Regenerated. * reloc.c: Add ARM TLS relocations. * elf32-arm.c (elf32_arm_howto_table): Add dynamic TLS relocations. (elf32_arm_tls_gd32_howto, elf32_arm_tls_ldo32_howto) (elf32_arm_tls_ldm32_howto, elf32_arm_tls_le32_howto) (elf32_arm_tls_ie32_howto): New. (elf32_arm_howto_from_type): Support TLS relocations. (elf32_arm_reloc_map): Likewise. (elf32_arm_reloc_type_lookup): Likewise. (TCB_SIZE): Define. (struct elf32_arm_obj_tdata): New. (elf32_arm_tdata, elf32_arm_local_got_tls_type): Define. (elf32_arm_mkobject): New function. (struct elf32_arm_relocs_copied): Add pc_count. (elf32_arm_hash_entry, GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD) (GOT_TLS_IE): Define. (struct elf32_arm_link_hash_table): Add tls_ldm_got. (elf32_arm_link_hash_newfunc): Initialize tls_type. (elf32_arm_copy_indirect_symbol): Copy pc_count and tls_type. (elf32_arm_link_hash_table_create): Initialize tls_ldm_got. (dtpoff_base, tpoff): New functions. (elf32_arm_final_link_relocate): Handle TLS relocations. (IS_ARM_TLS_RELOC): Define. (elf32_arm_relocate_section): Warn about TLS mismatches. (elf32_arm_gc_sweep_hook): Handle TLS relocations and pc_count. (elf32_arm_check_relocs): Detect invalid symbol indexes. Handle TLS relocations and pc_count. (elf32_arm_adjust_dynamic_symbol): Check non_got_ref. (allocate_dynrelocs): Handle TLS. Bind REL32 relocs to local calls. (elf32_arm_size_dynamic_sections): Handle TLS. (elf32_arm_finish_dynamic_symbol): Likewise. (bfd_elf32_mkobject): Define. gas/ * config/tc-arm.c (arm_parse_reloc): Add TLS relocations. (md_apply_fix3): Mark TLS symbols. (tc_gen_reloc): Handle TLS relocations. (arm_fix_adjustable): Ignore TLS relocations. (s_arm_elf_cons): Support expressions after decorated symbols. gas/testuite/ * gas/arm/tls.s, gas/arm/tls.d: New files. * gas/arm/arm.exp: Run TLS test. include/elf/ * arm.h: Add TLS relocations. ld/testsuite/ * ld-arm/tls-lib.s, ld-arm/tls-lib.d, ld-arm/tls-lib.r, ld-arm/tls-app.s, ld-arm/tls-app.d, ld-arm/tls-app.r: New files. * ld-arm/arm-lib.ld, ld-arm/arm-dyn.ld: Increase data segment alignment. * ld-arm/arm-elf.exp: Run TLS tests.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-arm.c51
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/arm/arm.exp2
-rw-r--r--gas/testsuite/gas/arm/tls.d21
-rw-r--r--gas/testsuite/gas/arm/tls.s14
6 files changed, 100 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 2cc9445..d6263e6 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2005-03-29 Daniel Jacobowitz <dan@codesourcery.com>
+ Phil Blundell <philb@gnu.org>
+
+ * config/tc-arm.c (arm_parse_reloc): Add TLS relocations.
+ (md_apply_fix3): Mark TLS symbols.
+ (tc_gen_reloc): Handle TLS relocations.
+ (arm_fix_adjustable): Ignore TLS relocations.
+ (s_arm_elf_cons): Support expressions after decorated symbols.
+
2005-03-29 Julian Brown <julian@codesourcery.com>
* config/tc-arm.c (marked_pr_dependency): New bitmap, bit N indicates
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 9baf888..78d126c 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -4881,6 +4881,11 @@ arm_parse_reloc (void)
MAP ("(target1)", BFD_RELOC_ARM_TARGET1),
MAP ("(sbrel)", BFD_RELOC_ARM_SBREL32),
MAP ("(target2)", BFD_RELOC_ARM_TARGET2),
+ MAP ("(tlsgd)", BFD_RELOC_ARM_TLS_GD32),
+ MAP ("(tlsldm)", BFD_RELOC_ARM_TLS_LDM32),
+ MAP ("(tlsldo)", BFD_RELOC_ARM_TLS_LDO32),
+ MAP ("(gottpoff)", BFD_RELOC_ARM_TLS_IE32),
+ MAP ("(tpoff)", BFD_RELOC_ARM_TLS_LE32),
{ NULL, 0, BFD_RELOC_UNUSED }
#undef MAP
};
@@ -12224,6 +12229,14 @@ md_apply_fix3 (fixS * fixP,
break;
#ifdef OBJ_ELF
+ case BFD_RELOC_ARM_TLS_GD32:
+ case BFD_RELOC_ARM_TLS_LE32:
+ case BFD_RELOC_ARM_TLS_IE32:
+ case BFD_RELOC_ARM_TLS_LDM32:
+ case BFD_RELOC_ARM_TLS_LDO32:
+ S_SET_THREAD_LOCAL (fixP->fx_addsy);
+ /* fall through */
+
case BFD_RELOC_ARM_GOT32:
case BFD_RELOC_ARM_GOTOFF:
case BFD_RELOC_ARM_TARGET2:
@@ -12547,6 +12560,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED,
case BFD_RELOC_ARM_SBREL32:
case BFD_RELOC_ARM_PREL31:
case BFD_RELOC_ARM_TARGET2:
+ case BFD_RELOC_ARM_TLS_LE32:
+ case BFD_RELOC_ARM_TLS_LDO32:
+ code = fixp->fx_r_type;
+ break;
+
+ case BFD_RELOC_ARM_TLS_GD32:
+ case BFD_RELOC_ARM_TLS_IE32:
+ case BFD_RELOC_ARM_TLS_LDM32:
+ /* BFD will include the symbol's address in the addend.
+ But we don't want that, so subtract it out again here. */
+ if (!S_IS_COMMON (fixp->fx_addsy))
+ reloc->addend -= (*reloc->sym_ptr_ptr)->value;
code = fixp->fx_r_type;
break;
#endif
@@ -13843,6 +13868,11 @@ arm_fix_adjustable (fixS * fixP)
if (fixP->fx_r_type == BFD_RELOC_ARM_PLT32
|| fixP->fx_r_type == BFD_RELOC_ARM_GOT32
|| fixP->fx_r_type == BFD_RELOC_ARM_GOTOFF
+ || fixP->fx_r_type == BFD_RELOC_ARM_TLS_GD32
+ || fixP->fx_r_type == BFD_RELOC_ARM_TLS_LE32
+ || fixP->fx_r_type == BFD_RELOC_ARM_TLS_IE32
+ || fixP->fx_r_type == BFD_RELOC_ARM_TLS_LDM32
+ || fixP->fx_r_type == BFD_RELOC_ARM_TLS_LDO32
|| fixP->fx_r_type == BFD_RELOC_ARM_TARGET2)
return 0;
@@ -13898,8 +13928,12 @@ s_arm_elf_cons (int nbytes)
do
{
bfd_reloc_code_real_type reloc;
+ char *sym_start;
+ int sym_len;
+ sym_start = input_line_pointer;
expression (& exp);
+ sym_len = input_line_pointer - sym_start;
if (exp.X_op == O_symbol
&& * input_line_pointer == '('
@@ -13913,9 +13947,22 @@ s_arm_elf_cons (int nbytes)
howto->name, nbytes);
else
{
- char *p = frag_more ((int) nbytes);
+ char *p;
int offset = nbytes - size;
-
+ char *saved_buf = alloca (sym_len), *saved_input;
+
+ /* We've parsed an expression stopping at O_symbol. But there
+ may be more expression left now that we have parsed the
+ relocation marker. Parse it again. */
+ saved_input = input_line_pointer - sym_len;
+ memcpy (saved_buf, saved_input, sym_len);
+ memmove (saved_input, sym_start, sym_len);
+ input_line_pointer = saved_input;
+ expression (& exp);
+ memcpy (saved_input, saved_buf, sym_len);
+ assert (input_line_pointer >= saved_input + sym_len);
+
+ p = frag_more ((int) nbytes);
fix_new_exp (frag_now, p - frag_now->fr_literal + offset, size,
&exp, 0, reloc);
}
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index bef8501..5559174 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-29 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gas/arm/tls.s, gas/arm/tls.d: New files.
+ * gas/arm/arm.exp: Run TLS test.
+
2005-03-28 H.J. Lu <hongjiu.lu@intel.com>
PR 803
diff --git a/gas/testsuite/gas/arm/arm.exp b/gas/testsuite/gas/arm/arm.exp
index 4ea6454..7cd5630 100644
--- a/gas/testsuite/gas/arm/arm.exp
+++ b/gas/testsuite/gas/arm/arm.exp
@@ -72,6 +72,8 @@ if {[istarget *arm*-*-*] || [istarget "xscale-*-*"]} then {
run_dump_test "mapping"
gas_test "bignum1.s" "" $stdoptlist "bignums"
run_dump_test "unwind"
+
+ run_dump_test "tls"
}
if {! [istarget arm*-*-aout] && ![istarget arm-*-pe]} then {
diff --git a/gas/testsuite/gas/arm/tls.d b/gas/testsuite/gas/arm/tls.d
new file mode 100644
index 0000000..71a1a6f
--- /dev/null
+++ b/gas/testsuite/gas/arm/tls.d
@@ -0,0 +1,21 @@
+#objdump: -dr
+#name: TLS
+
+# Test generation of TLS relocations
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+
+00+0 <main>:
+ 0: e1a00000 nop \(mov r0,r0\)
+ 4: e1a00000 nop \(mov r0,r0\)
+ 8: e1a0f00e mov pc, lr
+ c: 00000000 andeq r0, r0, r0
+ c: R_ARM_TLS_GD32 a
+ 10: 00000004 andeq r0, r0, r4
+ 10: R_ARM_TLS_LDM32 b
+ 14: 00000008 andeq r0, r0, r8
+ 14: R_ARM_TLS_IE32 c
+ 18: 00000000 andeq r0, r0, r0
+ 18: R_ARM_TLS_LE32 d
diff --git a/gas/testsuite/gas/arm/tls.s b/gas/testsuite/gas/arm/tls.s
new file mode 100644
index 0000000..48722a4
--- /dev/null
+++ b/gas/testsuite/gas/arm/tls.s
@@ -0,0 +1,14 @@
+ .text
+ .globl main
+ .type main, %function
+main:
+ nop
+.L2:
+ nop
+ mov pc, lr
+
+.Lpool:
+ .word a(tlsgd) + (. - .L2 - 8)
+ .word b(tlsldm) + (. - .L2 - 8)
+ .word c(gottpoff) + (. - .L2 - 8)
+ .word d(tpoff)