forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2005-03-29 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2005-03-28 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR 803
|
||||
|
||||
@@ -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.*) }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.*) }
|
||||
|
||||
18
ld/testsuite/ld-arm/tls-app.d
Normal file
18
ld/testsuite/ld-arm/tls-app.d
Normal file
@@ -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
|
||||
12
ld/testsuite/ld-arm/tls-app.r
Normal file
12
ld/testsuite/ld-arm/tls-app.r
Normal file
@@ -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
|
||||
|
||||
|
||||
34
ld/testsuite/ld-arm/tls-app.s
Normal file
34
ld/testsuite/ld-arm/tls-app.s
Normal file
@@ -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
|
||||
15
ld/testsuite/ld-arm/tls-lib.d
Normal file
15
ld/testsuite/ld-arm/tls-lib.d
Normal file
@@ -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
|
||||
10
ld/testsuite/ld-arm/tls-lib.r
Normal file
10
ld/testsuite/ld-arm/tls-lib.r
Normal file
@@ -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
|
||||
|
||||
|
||||
22
ld/testsuite/ld-arm/tls-lib.s
Normal file
22
ld/testsuite/ld-arm/tls-lib.s
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user