diff options
author | Alan Modra <amodra@gmail.com> | 2014-10-18 21:46:48 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-10-18 23:07:08 +1030 |
commit | b53dfeb26ed06e97fff1e8f469e33637ebdf6624 (patch) | |
tree | 0da1a3f19278a36c87035ff5fa4e17db6d4918dc /gdb/testsuite/gdb.guile | |
parent | a841bdf5d3bfb9c687f938be7388597db2e461de (diff) | |
download | gdb-b53dfeb26ed06e97fff1e8f469e33637ebdf6624.zip gdb-b53dfeb26ed06e97fff1e8f469e33637ebdf6624.tar.gz gdb-b53dfeb26ed06e97fff1e8f469e33637ebdf6624.tar.bz2 |
PowerPC64 ELFv1 function symbol definition vs LTO and discarded sections
When functions are emitted in comdat groups, global symbols defined in
duplicates of the group are treated as if they were undefined. That
prevents the symbols in the discarded sections from affecting the
linker's global symbol hash table or causing duplicate symbol errors.
Annoyingly, when gcc emits a function to a comdat group, it does not
put *all* of a function's code and data in the comdat group.
Typically, constant tables, exception handling info, and debug info
are emitted to normal sections outside of the group, which is a
perennial source of linker problems due to the special handling needed
to deal with the extra-group pieces that ought to be discarded. In
the case of powerpc64-gcc, the OPD entry for a function is not put in
the group. Since the function symbol is defined on the OPD entry this
means we need to handle symbols in .opd specially.
To see how this affects LTO in particular, consider the linker
testcase PR ld/12942 (1). This testcase links an LTO object file
pr12942a.o with a normal (non-LTO) object pr12942b.o. Both objects
contain a definition for _Z4testv in a comdat group. On loading
pr12942a.o, the linker sees a comdat group (actually linkonce section)
for _Z4testv and a weak _Z4testv defined in the IR. On loading
pr12942b.o, the linker sees the same comdat group, and thus discards
it. However, _Z4testv is a weak symbol defined in .opd, not part of
the group, so this weak symbol overrides the weak IR symbol. On
(re)loading the LTO version of pr12942a.o, the linker sees another
weak _Z4testv, but this one does not override the value we have from
pr12942b.o. The result is a linker complaint about "`_Z4testv'
... defined in discarded section `.group' of tmpdir/pr12942b.o".
* elf64-ppc.c (ppc64_elf_add_symbol_hook): If function code
section for function symbols defined in .opd is discarded, let
the symbol appear to be undefined.
(opd_entry_value): Ensure the result section is that for the
function code section in the same object as the OPD entry.
Diffstat (limited to 'gdb/testsuite/gdb.guile')
0 files changed, 0 insertions, 0 deletions