diff options
author | Daniel Jacobowitz <drow@false.org> | 2005-03-29 16:54:22 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2005-03-29 16:54:22 +0000 |
commit | ba93b8aced8f39a02c47731e89278fe6f217d929 (patch) | |
tree | 10d828c846f4224226a06d2d2bd4e31283b9d289 /ld/testsuite/ld-arm | |
parent | 71a976dd82f4a544374e4f40b9a1d6ec1f5525ad (diff) | |
download | gdb-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 'ld/testsuite/ld-arm')
-rw-r--r-- | ld/testsuite/ld-arm/arm-dyn.ld | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-elf.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-lib.ld | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/tls-app.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/tls-app.r | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/tls-app.s | 34 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/tls-lib.d | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/tls-lib.r | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/tls-lib.s | 22 |
9 files changed, 119 insertions, 2 deletions
diff --git a/ld/testsuite/ld-arm/arm-dyn.ld b/ld/testsuite/ld-arm/arm-dyn.ld index 20b9613..96bc10c 100644 --- a/ld/testsuite/ld-arm/arm-dyn.ld +++ b/ld/testsuite/ld-arm/arm-dyn.ld @@ -76,7 +76,7 @@ SECTIONS .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ - . = ALIGN(256) + (. & (256 - 1)); + . = ALIGN (0x8000) - ((0x8000 - .) & (0x8000 - 1)); . = DATA_SEGMENT_ALIGN (0x8000, 0x1000); /* Exception handling */ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 3e747ca..1a0e5b9 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -75,6 +75,12 @@ set armelftests { {"arm-rel31" "-static -T arm.ld" "" {arm-rel31.s} {{objdump -s arm-rel31.d}} "arm-rel31"} + {"TLS shared library" "-shared -T arm-lib.ld" "" {tls-lib.s} + {{objdump -fdw tls-lib.d} {objdump -Rw tls-lib.r}} + "tls-lib.so"} + {"TLS dynamic application" "-T arm-dyn.ld tmpdir/tls-lib.so" "" {tls-app.s} + {{objdump -fdw tls-app.d} {objdump -Rw tls-app.r}} + "tls-app"} } run_ld_link_tests $armelftests diff --git a/ld/testsuite/ld-arm/arm-lib.ld b/ld/testsuite/ld-arm/arm-lib.ld index 075eaa4..0415d20 100644 --- a/ld/testsuite/ld-arm/arm-lib.ld +++ b/ld/testsuite/ld-arm/arm-lib.ld @@ -75,7 +75,7 @@ SECTIONS .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ - . = ALIGN(256) + (. & (256 - 1)); + . = ALIGN (0x8000) - ((0x8000 - .) & (0x8000 - 1)); . = DATA_SEGMENT_ALIGN (0x8000, 0x1000); /* Exception handling */ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } diff --git a/ld/testsuite/ld-arm/tls-app.d b/ld/testsuite/ld-arm/tls-app.d new file mode 100644 index 0000000..7f486ef --- /dev/null +++ b/ld/testsuite/ld-arm/tls-app.d @@ -0,0 +1,18 @@ + +.*: file format elf32-.*arm +architecture: arm, flags 0x00000112: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x00008274 + +Disassembly of section .text: + +00008274 <foo>: + 8274: e1a00000 nop \(mov r0,r0\) + 8278: e1a00000 nop \(mov r0,r0\) + 827c: e1a0f00e mov pc, lr + 8280: 000080bc streqh r8, \[r0\], -ip + 8284: 000080b4 streqh r8, \[r0\], -r4 + 8288: 000080ac andeq r8, r0, ip, lsr #1 + 828c: 00000004 andeq r0, r0, r4 + 8290: 000080c4 andeq r8, r0, r4, asr #1 + 8294: 00000014 andeq r0, r0, r4, lsl r0 diff --git a/ld/testsuite/ld-arm/tls-app.r b/ld/testsuite/ld-arm/tls-app.r new file mode 100644 index 0000000..3f02397 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-app.r @@ -0,0 +1,12 @@ + +.*: file format elf32-.*arm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +00010334 R_ARM_TLS_DTPMOD32 app_gd +00010338 R_ARM_TLS_DTPOFF32 app_gd +0001033c R_ARM_TLS_DTPMOD32 lib_gd +00010340 R_ARM_TLS_DTPOFF32 lib_gd +00010344 R_ARM_TLS_TPOFF32 app_ie + + diff --git a/ld/testsuite/ld-arm/tls-app.s b/ld/testsuite/ld-arm/tls-app.s new file mode 100644 index 0000000..d505295 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-app.s @@ -0,0 +1,34 @@ + .text + .globl foo + .type foo, %function +foo: + nop +.L2: + nop + mov pc, lr + +.Lpool: + .word lib_gd(tlsgd) + (. - .L2 - 8) + .word app_gd(tlsgd) + (. - .L2 - 8) + .word app_ld(tlsldm) + (. - .L2 - 8) + .word app_ld(tlsldo) + .word app_ie(gottpoff) + (. - .L2 - 8) + .word app_le(tpoff) + + .section .tdata,"awT" + .global app_gd +app_gd: + .space 4 + + .global app_ld +app_ld: + .space 4 + + .section .tbss,"awT",%nobits + .global app_ie +app_ie: + .space 4 + + .global app_le +app_le: + .space 4 diff --git a/ld/testsuite/ld-arm/tls-lib.d b/ld/testsuite/ld-arm/tls-lib.d new file mode 100644 index 0000000..0492877 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-lib.d @@ -0,0 +1,15 @@ + +.*: file format elf32-.*arm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .text: + +00000328 <foo>: + 328: e1a00000 nop \(mov r0,r0\) + 32c: e1a00000 nop \(mov r0,r0\) + 330: e1a0f00e mov pc, lr + 334: 00008098 muleq r0, r8, r0 + 338: 0000808c andeq r8, r0, ip, lsl #1 + 33c: 00000004 andeq r0, r0, r4 diff --git a/ld/testsuite/ld-arm/tls-lib.r b/ld/testsuite/ld-arm/tls-lib.r new file mode 100644 index 0000000..c0bf4bf --- /dev/null +++ b/ld/testsuite/ld-arm/tls-lib.r @@ -0,0 +1,10 @@ + +.*: file format elf32-.*arm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +000083c4 R_ARM_TLS_DTPMOD32 \*ABS\* +000083cc R_ARM_TLS_DTPMOD32 lib_gd +000083d0 R_ARM_TLS_DTPOFF32 lib_gd + + diff --git a/ld/testsuite/ld-arm/tls-lib.s b/ld/testsuite/ld-arm/tls-lib.s new file mode 100644 index 0000000..fa928c0 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-lib.s @@ -0,0 +1,22 @@ + .text + .globl foo + .type foo, %function +foo: + nop +.L2: + nop + mov pc, lr + +.Lpool: + .word lib_gd(tlsgd) + (. - .L2 - 8) + .word lib_ld(tlsldm) + (. - .L2 - 8) + .word lib_ld(tlsldo) + + .section .tdata,"awT" + .global lib_gd +lib_gd: + .space 4 + + .global lib_ld +lib_ld: + .space 4 |