diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2009-06-14 01:39:46 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2009-06-14 01:39:46 +0000 |
commit | c25bc9fc0d99cdc97211346362b677428747eabd (patch) | |
tree | f046e10a8fe03df0645dde4411601f3395df9aea /ld/testsuite/ld-ifunc | |
parent | 46ebc6b5903b50c862e924b5885b7120b25487f9 (diff) | |
download | gdb-c25bc9fc0d99cdc97211346362b677428747eabd.zip gdb-c25bc9fc0d99cdc97211346362b677428747eabd.tar.gz gdb-c25bc9fc0d99cdc97211346362b677428747eabd.tar.bz2 |
bfd/
2009-06-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10269
* elf32-i386.c: Include "objalloc.h" and "hashtab.h".
(elf_i386_link_hash_table): Add loc_hash_table and
loc_hash_memory.
(elf_i386_local_hash): New.
(elf_i386_local_htab_hash): Likewise.
(elf_i386_local_htab_eq): Likewise.
(elf_i386_get_local_sym_hash): Likewise.
(elf_i386_link_hash_table_free): Likewise.
(elf_i386_allocate_local_dynrelocs): Likewise.
(elf_i386_finish_local_dynamic_symbol): Likewise.
(bfd_elf64_bfd_link_hash_table_free): Likewise.
(elf_i386_link_hash_table_create): Create loc_hash_table and
loc_hash_memory.
(elf_i386_check_relocs): Handle local STT_GNU_IFUNC symbols.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_sections): Likewise.
(elf_i386_finish_dynamic_symbol): Check _DYNAMIC only if sym
isn't NULL.
* elf64-x86-64.c: Include "objalloc.h" and "hashtab.h".
(elf64_x86_64_link_hash_table): Add loc_hash_table and
loc_hash_memory.
(elf64_x86_64_local_hash): New.
(elf64_x86_64_local_htab_hash): Likewise.
(elf64_x86_64_local_htab_eq): Likewise.
(elf64_x86_64_get_local_sym_hash): Likewise.
(elf64_x86_64_link_hash_table_free): Likewise.
(elf64_x86_64_allocate_local_dynrelocs): Likewise.
(elf64_x86_64_finish_local_dynamic_symbol): Likewise.
(bfd_elf64_bfd_link_hash_table_free): Likewise.
(elf64_x86_64_link_hash_table_create): Create loc_hash_table
and loc_hash_memory.
(elf64_x86_64_check_relocs): Handle local STT_GNU_IFUNC
symbols.
(elf64_x86_64_size_dynamic_sections): Likewise.
(elf64_x86_64_relocate_section): Likewise.
(elf64_x86_64_finish_dynamic_sections): Likewise.
(elf64_x86_64_finish_dynamic_symbol): Check _DYNAMIC only if
sym isn't NULL.
gas/
2009-06-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10269
* config/tc-i386.c (md_apply_fix): Use TC_FORCE_RELOCATION
instead of generic_force_reloc.
* config/tc-i386.h (TC_FORCE_RELOCATION): New.
ld/testsuite/
2009-06-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10269
*: ld-ifunc/ifunc-1-local-x86.d: New.
*: ld-ifunc/ifunc-1-local-x86.s: Likewise.
*: ld-ifunc/ifunc-2-local-i386.d: Likewise.
*: ld-ifunc/ifunc-2-local-i386.s: Likewise.
*: ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
*: ld-ifunc/ifunc-2-local-x86-64.s: Likewise.
*: ld-ifunc/ifunc-4-local-x86.d: Likewise.
*: ld-ifunc/ifunc-4-local-x86.s: Likewise.
*: ld-ifunc/ifunc-5-local-i386.s: Likewise.
*: ld-ifunc/ifunc-5-local-x86-64.s: Likewise.
*: ld-ifunc/ifunc-5a-local-i386.d: Likewise.
*: ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
*: ld-ifunc/ifunc-5b-local-i386.d: Likewise.
*: ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-ifunc')
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-1-local-x86.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-1-local-x86.s | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-2-local-i386.d | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-2-local-i386.s | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.s | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-4-local-x86.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-4-local-x86.s | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-5-local-i386.s | 22 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-5-local-x86-64.s | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-5a-local-i386.d | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-5a-local-x86-64.d | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-5b-local-i386.d | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc-5b-local-x86-64.d | 9 |
14 files changed, 173 insertions, 0 deletions
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d new file mode 100644 index 0000000..ee043b1207 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d @@ -0,0 +1,7 @@ +#ld: -shared +#objdump: -dw +#target: x86_64-*-* i?86-*-* + +#... +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*@plt> +#pass diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.s b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.s new file mode 100644 index 0000000..bd2b5bb --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.s @@ -0,0 +1,13 @@ + .type foo, %gnu_indirect_function + .set __GI_foo, foo + .text + .type foo, @function +foo: + ret + .size foo, .-foo +.globl bar + .type bar, @function +bar: + call __GI_foo@PLT + ret + .size bar, .-bar diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386.d new file mode 100644 index 0000000..7dfc1fe --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386.d @@ -0,0 +1,8 @@ +#ld: -m elf_i386 -shared +#as: --32 +#objdump: -dw +#target: x86_64-*-* i?86-*-* + +#... +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-f]+<\*ABS\*@plt> +#pass diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s b/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s new file mode 100644 index 0000000..4e0b6ae --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386.s @@ -0,0 +1,18 @@ + .type foo, %gnu_indirect_function + .set __GI_foo, foo + .text + .type foo, @function +foo: + ret + .size foo, .-foo +.globl bar + .type bar, @function +bar: + call .L6 +.L6: + popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx + call __GI_foo + leal __GI_foo@GOTOFF(%ebx), %eax + ret + .size bar, .-bar diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d new file mode 100644 index 0000000..fa87102 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d @@ -0,0 +1,9 @@ +#as: --64 +#ld: -shared -melf_x86_64 +#objdump: -dw +#target: x86_64-*-* + +#... +[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*@plt> +[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*@plt> +#pass diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.s b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.s new file mode 100644 index 0000000..4137ff1 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.s @@ -0,0 +1,17 @@ + .type foo, %gnu_indirect_function + .global __GI_foo + .hidden __GI_foo + .set __GI_foo, foo + .text +.globl foo + .type foo, @function +foo: + ret + .size foo, .-foo +.globl bar + .type bar, @function +bar: + call __GI_foo + leaq __GI_foo(%rip), %rax + ret + .size bar, .-bar diff --git a/ld/testsuite/ld-ifunc/ifunc-4-local-x86.d b/ld/testsuite/ld-ifunc/ifunc-4-local-x86.d new file mode 100644 index 0000000..5fe66e0 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-4-local-x86.d @@ -0,0 +1,7 @@ +#ld: +#readelf: -r --wide +#target: x86_64-*-* i?86-*-* + +#... +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_[_0-9A-Z]+_IRELATIVE[ ]*[0-9a-f]* +#pass diff --git a/ld/testsuite/ld-ifunc/ifunc-4-local-x86.s b/ld/testsuite/ld-ifunc/ifunc-4-local-x86.s new file mode 100644 index 0000000..4f72d7f --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-4-local-x86.s @@ -0,0 +1,18 @@ + .text + .type foo, %gnu_indirect_function + .type foo, @function +foo: + ret + .size foo, .-foo + .type start,"function" + .global start +start: + .type _start,"function" + .global _start +_start: + .type __start,"function" + .global __start +__start: + .type __start,"function" + call foo + movl $foo,%eax diff --git a/ld/testsuite/ld-ifunc/ifunc-5-local-i386.s b/ld/testsuite/ld-ifunc/ifunc-5-local-i386.s new file mode 100644 index 0000000..d7bb5cf --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-5-local-i386.s @@ -0,0 +1,22 @@ + .text + .type foo, %gnu_indirect_function + .type foo, @function +foo: + ret + .size foo, .-foo + .type start,"function" + .global start +start: + .type _start,"function" + .global _start +_start: + .type __start,"function" + .global __start +__start: + .type __start,"function" + call .L6 +.L6: + popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L6], %ebx + call foo@PLT + leal foo@GOT(%ebx), %eax diff --git a/ld/testsuite/ld-ifunc/ifunc-5-local-x86-64.s b/ld/testsuite/ld-ifunc/ifunc-5-local-x86-64.s new file mode 100644 index 0000000..5469747 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-5-local-x86-64.s @@ -0,0 +1,18 @@ + .text + .type foo, %gnu_indirect_function + .type foo, @function +foo: + ret + .size foo, .-foo + .type start,"function" + .global start +start: + .type _start,"function" + .global _start +_start: + .type __start,"function" + .global __start +__start: + .type __start,"function" + call foo@PLT + movq foo@GOTPCREL(%rip), %rax diff --git a/ld/testsuite/ld-ifunc/ifunc-5a-local-i386.d b/ld/testsuite/ld-ifunc/ifunc-5a-local-i386.d new file mode 100644 index 0000000..88814f7 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-5a-local-i386.d @@ -0,0 +1,9 @@ +#source: ifunc-5-local-i386.s +#ld: -m elf_i386 +#as: --32 +#readelf: -r --wide +#target: x86_64-*-* i?86-*-* + +Relocation section '.rel.plt' at .* +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_IRELATIVE[ ]* diff --git a/ld/testsuite/ld-ifunc/ifunc-5a-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-5a-local-x86-64.d new file mode 100644 index 0000000..73a822d --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-5a-local-x86-64.d @@ -0,0 +1,9 @@ +#source: ifunc-5-local-x86-64.s +#as: --64 +#ld: -melf_x86_64 +#readelf: -r --wide +#target: x86_64-*-* + +Relocation section '.rela.plt' at .* +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_IRELATIVE[ ]+[0-9a-f]* diff --git a/ld/testsuite/ld-ifunc/ifunc-5b-local-i386.d b/ld/testsuite/ld-ifunc/ifunc-5b-local-i386.d new file mode 100644 index 0000000..75cb7d9 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-5b-local-i386.d @@ -0,0 +1,9 @@ +#source: ifunc-5-local-i386.s +#ld: -shared -m elf_i386 -z nocombreloc +#as: --32 +#readelf: -r --wide +#target: x86_64-*-* i?86-*-* + +Relocation section '.rel.plt' at .* +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_IRELATIVE[ ]* diff --git a/ld/testsuite/ld-ifunc/ifunc-5b-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-5b-local-x86-64.d new file mode 100644 index 0000000..3913dd6 --- /dev/null +++ b/ld/testsuite/ld-ifunc/ifunc-5b-local-x86-64.d @@ -0,0 +1,9 @@ +#source: ifunc-5-local-x86-64.s +#as: --64 +#ld: -melf_x86_64 -shared -z nocombreloc +#readelf: -r --wide +#target: x86_64-*-* + +Relocation section '.rela.plt' at .* +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_IRELATIVE[ ]+[0-9a-f]* |