diff options
author | Nick Clifton <nickc@redhat.com> | 2013-04-03 14:21:18 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2013-04-03 14:21:18 +0000 |
commit | cb8af559c12b9a85acb429fed4d59e858574a43c (patch) | |
tree | a16f6f77f0ca2c24cb5dbed5492bc9d1be678f3b /ld | |
parent | 203f0950a35c87f17016045f1cd5a0460b445532 (diff) | |
download | gdb-cb8af559c12b9a85acb429fed4d59e858574a43c.zip gdb-cb8af559c12b9a85acb429fed4d59e858574a43c.tar.gz gdb-cb8af559c12b9a85acb429fed4d59e858574a43c.tar.bz2 |
* elf64-aarch64.c (elf64_aarch64_gc_sweep_hook): Use
elf64_aarch64_locals to get local GOT reference counts.
* ld-aarch64/gc-relocs-tlsle.s: New gc section test.
* ld-aarch64/gc-relocs-tlsle.s: Likewise
* ld-aarch64/gc-relocs-tlsgd.s: Likewise
* ld-aarch64/gc-relocs-tlsdesc.s: Likewise
* ld-aarch64/gc-relocs-312.s: Likewise
* ld-aarch64/gc-relocs-311.s: Likewise
* ld-aarch64/gc-relocs-309.s: Likewise
* ld-aarch64/gc-start.s: Likewise
* ld-aarch64/gc-got-relocs.d: Update expected objdump
* ld-aarch64/gc-tls-relocs.d: Likewise
* ld-aarch64/aarch64-elf.exp: add test
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-aarch64/aarch64-elf.exp | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-got-relocs.d | 32 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-309.s | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-311.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-312.s | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-tlsdesc.s | 38 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-tlsgd.s | 30 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-tlsie.s | 29 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-relocs-tlsle.s | 36 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-start.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/gc-tls-relocs.d | 34 |
11 files changed, 225 insertions, 1 deletions
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index d4f6235..f913fe6 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -1,5 +1,5 @@ # Expect script for various AARCH64 ELF tests. -# Copyright 2009-2012 Free Software Foundation, Inc. +# Copyright 2009-2013 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -109,3 +109,5 @@ run_dump_test "tls-relax-gdesc-le-2" run_dump_test "tls-relax-ie-le-2" run_dump_test "tls-relax-ie-le-3" run_dump_test "tlsle-symbol-offset" +run_dump_test "gc-got-relocs" +run_dump_test "gc-tls-relocs" diff --git a/ld/testsuite/ld-aarch64/gc-got-relocs.d b/ld/testsuite/ld-aarch64/gc-got-relocs.d new file mode 100644 index 0000000..c636fbf --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-got-relocs.d @@ -0,0 +1,32 @@ +#source: gc-start.s +#source: gc-relocs-309.s +#source: gc-relocs-311.s +#source: gc-relocs-312.s +#ld: --gc-sections -T aarch64.ld +#objdump: -s -t -d + +# Executable with got related relocs against global sysmbol gced. +# After gc-section removal we are cheking that symbol does not exit +# got section is empty and text section contains only start function. + +.*: file format elf64-littleaarch64 + +SYMBOL TABLE: +0+8000 l d \.text 0+ \.text +0+9000 l d \.got 0+ \.got +0+0000 l df \*ABS\* 0+ .* +0+0000 l df \*ABS\* 0+ +0+9000 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +0+8000 g \.text 0+ _start + +Contents of section .text: + 8000 1f2003d5 .* +Contents of section .got: + 9000 0+ 0+ 0+ 0+ .* + 9010 0+ 0+ .* + +Disassembly of section .text: + +0+8000 \<_start>: + 8000: d503201f nop + diff --git a/ld/testsuite/ld-aarch64/gc-relocs-309.s b/ld/testsuite/ld-aarch64/gc-relocs-309.s new file mode 100644 index 0000000..06901bf --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-309.s @@ -0,0 +1,7 @@ +#R_AARCH64_GOT_LD_PREL19 + .comm sym309_notused,1,8 +.text +_test_gc_rel309: + nop + ldr x1, :got_prel19:sym309_notused + diff --git a/ld/testsuite/ld-aarch64/gc-relocs-311.s b/ld/testsuite/ld-aarch64/gc-relocs-311.s new file mode 100644 index 0000000..46df7d7 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-311.s @@ -0,0 +1,5 @@ +#R_AARCH64_ADR_GOT_PAGE +.comm gempy,4,4 +.text +_test_gc_rel311: + adrp x3,:got:gempy diff --git a/ld/testsuite/ld-aarch64/gc-relocs-312.s b/ld/testsuite/ld-aarch64/gc-relocs-312.s new file mode 100644 index 0000000..7a2f370 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-312.s @@ -0,0 +1,7 @@ +#R_AARCH64_GOT_LD_PREL19 + .comm sym312_notused,4 +.text +_test_gc_rel312: + nop + ldr x3, [x2, #:got_lo12:sym312_notused] + diff --git a/ld/testsuite/ld-aarch64/gc-relocs-tlsdesc.s b/ld/testsuite/ld-aarch64/gc-relocs-tlsdesc.s new file mode 100644 index 0000000..413c513 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-tlsdesc.s @@ -0,0 +1,38 @@ + .global tlsdescvar + .section .tbss,"awT",%nobits + .align 2 + .type tlsdescvar, %object + .size tlsdescvar, 4 +tlsdescvar: + .zero 4 + + .align 2 + .type l_tlsdescvar, %object + .size l_tlsdescvar, 4 +l_tlsdescvar: + .zero 4 +.text +_test_tls_desc: + + // R_AARCH64_TLSDESC_ADR_PAGE tlsdescvar + adrp x0, :tlsdesc:tlsdescvar + // R_AARCH64_TLSDESC_LD64_LO12 tlsdescvar + ldr x1, [x0, :tlsdesc_lo12:tlsdescvar] + // R_AARCH64_TLSDESC_ADD_LO12 tlsdescvar + add x0, x0, :tlsdesc_lo12:tlsdescvar + // R_AARCH64_TLSDESC_CALL tlsdescvar + .tlsdesccall tlsdescvar + blr x1 + +_test_tls_desc_local: + + // R_AARCH64_TLSDESC_ADR_PAGE l_tlsdescvar + adrp x0, :tlsdesc:l_tlsdescvar + // R_AARCH64_TLSDESC_LD64_LO12 l_tlsdescvar + ldr x1, [x0, :tlsdesc_lo12:l_tlsdescvar] + // R_AARCH64_TLSDESC_ADD_LO12 l_tlsdescvar + add x0, x0, :tlsdesc_lo12:l_tlsdescvar + // R_AARCH64_TLSDESC_CALL l_tlsdescvar + .tlsdesccall l_tlsdescvar + blr x1 + diff --git a/ld/testsuite/ld-aarch64/gc-relocs-tlsgd.s b/ld/testsuite/ld-aarch64/gc-relocs-tlsgd.s new file mode 100644 index 0000000..ac90475 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-tlsgd.s @@ -0,0 +1,30 @@ + .global tlsgdvar + .section .tbss,"awT",%nobits + .align 2 + .type tlsgdvar, %object + .size tlsgdvar, 4 +tlsgdvar: + .zero 4 + .align 2 + .type l_tlsgdvar, %object + .size l_tlsgdvar, 4 +l_tlsgdvar: + .zero 4 + +.text +_test_tls_gd: + // R_AARCH64_TLSGD_ADR_PAGE21 tldgdvar + adrp x0, :tlsgd:tlsgdvar + // R_AARCH64_TLSGD_ADD_LO12_NC tlsgdvar + add x0, x0, :tlsgd_lo12:tlsgdvar + // R_AARCH64_CALL26 + bl __tls_get_addr + +_test_tls_gd_local: + // R_AARCH64_TLSGD_ADR_PAGE21 l_tldgdvar + adrp x0, :tlsgd:l_tlsgdvar + // R_AARCH64_TLSGD_ADD_LO12_NC l_tlsgdvar + add x0, x0, :tlsgd_lo12:l_tlsgdvar + // R_AARCH64_CALL26 + bl __tls_get_addr + diff --git a/ld/testsuite/ld-aarch64/gc-relocs-tlsie.s b/ld/testsuite/ld-aarch64/gc-relocs-tlsie.s new file mode 100644 index 0000000..e647b89 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-tlsie.s @@ -0,0 +1,29 @@ + .global tlsievar + .section .tbss,"awT",%nobits + .align 2 + .type tlsievar, %object + .size tlsievar, 4 +tlsievar: + .zero 4 + + .align 2 + .type l_tlsievar, %object + .size l_tlsievar, 4 +l_tlsievar: + .zero 4 + +.text +_test_tls_IE: + + // R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 tlsievar + adrp x0, :gottprel:tlsievar + // R_AARCH64_TLSIE_GOTTPREL_LO12_NC tlsievar + ldr x0, [x0, :gottprel_lo12:tlsievar] + +_test_tls_IE_local: + + // R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 l_tlsievar + adrp x0, :gottprel:l_tlsievar + // R_AARCH64_TLSIE_GOTTPREL_LO12_NC l_tlsievar + ldr x0, [x0, :gottprel_lo12:l_tlsievar] + diff --git a/ld/testsuite/ld-aarch64/gc-relocs-tlsle.s b/ld/testsuite/ld-aarch64/gc-relocs-tlsle.s new file mode 100644 index 0000000..cca7ef0 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-relocs-tlsle.s @@ -0,0 +1,36 @@ + .global tlslevar + .section .tbss,"awT",%nobits + .align 2 + .type tlslevar, %object + .size tlslevar, 4 +tlslevar: + .zero 4 + + .align 2 + .type l_tlslevar, %object + .size l_tlslevar, 4 +l_tlslevar: + .zero 4 + +.text +l_test_tls_le: + + // R_AARCH64_TLSLE_ADD_TPREL_LO12 tlslevar + add x0, x1, :tprel_lo12:tlslevar + // R_AARCH64_TLSLE_ADD_TPREL_HI12 tlslevar + add x0, x1, :tprel_hi12:tlslevar + // R_AARCH64_TLSLE_ADD_TPREL_HI12 tlslevar + add x0, x1, :tprel_hi12:tlslevar, lsl #12 + // R_AARCH64_TLSLE_ADD_TPREL_LO12_NC tlslevar + add x0, x1, :tprel_lo12_nc:tlslevar + +l_test_tls_le_local: + + // R_AARCH64_TLSLE_ADD_TPREL_LO12 l_tlslevar + add x0, x1, :tprel_lo12:l_tlslevar + // R_AARCH64_TLSLE_ADD_TPREL_HI12 l_tlslevar + add x0, x1, :tprel_hi12:l_tlslevar + // R_AARCH64_TLSLE_ADD_TPREL_HI12 l_tlslevar + add x0, x1, :tprel_hi12:l_tlslevar, lsl #12 + // R_AARCH64_TLSLE_ADD_TPREL_LO12_NC l_tlslevar + add x0, x1, :tprel_lo12_nc:l_tlslevar diff --git a/ld/testsuite/ld-aarch64/gc-start.s b/ld/testsuite/ld-aarch64/gc-start.s new file mode 100644 index 0000000..58d42a6 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-start.s @@ -0,0 +1,4 @@ + .global _start + .text +_start: + nop diff --git a/ld/testsuite/ld-aarch64/gc-tls-relocs.d b/ld/testsuite/ld-aarch64/gc-tls-relocs.d new file mode 100644 index 0000000..50d23e5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/gc-tls-relocs.d @@ -0,0 +1,34 @@ +#source: gc-start.s +#source: gc-relocs-tlsgd.s +#source: gc-relocs-tlsdesc.s +#source: gc-relocs-tlsie.s +#source: gc-relocs-tlsle.s +#ld: --gc-sections -T aarch64.ld +#objdump: -s -t -d + +# Executable with tls related relocs against global and local symbol gced. +# After gc-section removal we are cheking that symbols does not exit +# got section is empty and text section contains only start function. + +.*: file format elf64-littleaarch64 + +SYMBOL TABLE: +0+8000 l d \.text 0+ \.text +0+9000 l d \.got 0+ \.got +0+0000 l df \*ABS\* 0+ .* +0+0000 l \*UND\* 0+ __tls_get_addr +0+0000 l df \*ABS\* 0+ +0+9000 l O \.got 0+ _GLOBAL_OFFSET_TABLE_ +0+8000 g \.text 0+ _start + +Contents of section .text: + 8000 1f2003d5 .* +Contents of section .got: + 9000 0+ 0+ 0+ 0+ .* + 9010 0+ 0+ .* + +Disassembly of section .text: + +0+8000 \<_start>: + 8000: d503201f nop + |