Referencing a function's address on PowerPC64 ELFv2
ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object. It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data. Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.
bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
needed plt entries when taking the address of functions for
abiversion == 0 (ie. unknown) as well as abiversion == 2.
Move opd setup and abiversion checks to..
(ppc64_elf_before_check_relocs): ..here. Renamed from
ppc64_elf_process_dot_syms. Set output abiversion from input and
input abiversion from output, if either is not set.
(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
(elf_backend_check_directives): Update.
ld/testsuite/
* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
* ld-powerpc/powerpc.exp: Run new tests.
2014-03-25 04:42:48 +00:00
|
|
|
#source: startv2.s
|
|
|
|
#source: funref.s
|
|
|
|
#as: -a64
|
2014-07-02 05:37:18 +00:00
|
|
|
#ld: -melf64ppc --emit-stub-syms
|
Referencing a function's address on PowerPC64 ELFv2
ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object. It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data. Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.
bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
needed plt entries when taking the address of functions for
abiversion == 0 (ie. unknown) as well as abiversion == 2.
Move opd setup and abiversion checks to..
(ppc64_elf_before_check_relocs): ..here. Renamed from
ppc64_elf_process_dot_syms. Set output abiversion from input and
input abiversion from output, if either is not set.
(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
(elf_backend_check_directives): Update.
ld/testsuite/
* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
* ld-powerpc/powerpc.exp: Run new tests.
2014-03-25 04:42:48 +00:00
|
|
|
#ld_after_inputfiles: tmpdir/funv2.so
|
2014-07-02 05:37:18 +00:00
|
|
|
#readelf: -rs --wide
|
|
|
|
# Check that we do the right thing with funref.s that doesn't have
|
|
|
|
# anything to mark it as ELFv1 or ELFv2. We should get a dynamic
|
|
|
|
# reloc on the function address, not have a global entry stub, and
|
|
|
|
# my_func should be undefined dynamic with value zero.
|
|
|
|
# FIXME someday: No need for a plt entry.
|
Referencing a function's address on PowerPC64 ELFv2
ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object. It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data. Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.
bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
needed plt entries when taking the address of functions for
abiversion == 0 (ie. unknown) as well as abiversion == 2.
Move opd setup and abiversion checks to..
(ppc64_elf_before_check_relocs): ..here. Renamed from
ppc64_elf_process_dot_syms. Set output abiversion from input and
input abiversion from output, if either is not set.
(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
(elf_backend_check_directives): Update.
ld/testsuite/
* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
* ld-powerpc/powerpc.exp: Run new tests.
2014-03-25 04:42:48 +00:00
|
|
|
|
2014-07-02 05:37:18 +00:00
|
|
|
Relocation section .* contains 1 entries:
|
|
|
|
.*
|
|
|
|
.* R_PPC64_ADDR64 .* my_func \+ 0
|
|
|
|
|
|
|
|
Relocation section .* contains 1 entries:
|
Referencing a function's address on PowerPC64 ELFv2
ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object. It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data. Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.
bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
needed plt entries when taking the address of functions for
abiversion == 0 (ie. unknown) as well as abiversion == 2.
Move opd setup and abiversion checks to..
(ppc64_elf_before_check_relocs): ..here. Renamed from
ppc64_elf_process_dot_syms. Set output abiversion from input and
input abiversion from output, if either is not set.
(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
(elf_backend_check_directives): Update.
ld/testsuite/
* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
* ld-powerpc/powerpc.exp: Run new tests.
2014-03-25 04:42:48 +00:00
|
|
|
.*
|
|
|
|
.* R_PPC64_JMP_SLOT .* my_func \+ 0
|
2014-07-02 05:37:18 +00:00
|
|
|
|
|
|
|
Symbol table '\.dynsym' contains 5 entries:
|
|
|
|
.*
|
|
|
|
0: .*
|
|
|
|
1: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func
|
|
|
|
2: 0+10010438 0 NOTYPE GLOBAL DEFAULT 12 __bss_start
|
|
|
|
3: 0+10010438 0 NOTYPE GLOBAL DEFAULT 11 _edata
|
|
|
|
4: 0+10010450 0 NOTYPE GLOBAL DEFAULT 12 _end
|
|
|
|
|
|
|
|
Symbol table '\.symtab' contains 21 entries:
|
|
|
|
.*
|
|
|
|
0: .*
|
|
|
|
1: 0+10000158 0 SECTION LOCAL DEFAULT 1
|
|
|
|
2: 0+10000170 0 SECTION LOCAL DEFAULT 2
|
|
|
|
3: 0+10000198 0 SECTION LOCAL DEFAULT 3
|
|
|
|
4: 0+10000210 0 SECTION LOCAL DEFAULT 4
|
|
|
|
5: 0+10000248 0 SECTION LOCAL DEFAULT 5
|
|
|
|
6: 0+10000260 0 SECTION LOCAL DEFAULT 6
|
|
|
|
7: 0+10000278 0 SECTION LOCAL DEFAULT 7
|
|
|
|
8: 0+100002c4 0 SECTION LOCAL DEFAULT 8
|
|
|
|
9: 0+100102c8 0 SECTION LOCAL DEFAULT 9
|
|
|
|
10: 0+10010428 0 SECTION LOCAL DEFAULT 10
|
|
|
|
11: 0+10010430 0 SECTION LOCAL DEFAULT 11
|
|
|
|
12: 0+10010438 0 SECTION LOCAL DEFAULT 12
|
|
|
|
13: 0+100102c8 0 OBJECT LOCAL DEFAULT 9 _DYNAMIC
|
|
|
|
14: 0+10000288 0 NOTYPE LOCAL DEFAULT 7 __glink_PLTresolve
|
|
|
|
15: 0+10010428 0 NOTYPE GLOBAL DEFAULT 10 func_tab
|
|
|
|
16: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func
|
|
|
|
17: 0+10000278 0 NOTYPE GLOBAL DEFAULT 7 _start
|
|
|
|
18: 0+10010438 0 NOTYPE GLOBAL DEFAULT 12 __bss_start
|
|
|
|
19: 0+10010438 0 NOTYPE GLOBAL DEFAULT 11 _edata
|
|
|
|
20: 0+10010450 0 NOTYPE GLOBAL DEFAULT 12 _end
|