diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-03-13 16:20:26 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-03-14 05:38:24 -0700 |
commit | 2159c3f1e6c191b1f80b8160caa92bccae2eb8f0 (patch) | |
tree | fa0aa19a00067422940586ae0c595903c88fbfcc /gdb/filesystem.h | |
parent | d834e6355eedb87abc1473c5039232fe93c98cb2 (diff) | |
download | gdb-users/hjl/pr19818.zip gdb-users/hjl/pr19818.tar.gz gdb-users/hjl/pr19818.tar.bz2 |
Properly handle relocs against absolute symbolsusers/hjl/pr19818
Relocations against absolute symbols in shared object should be resolved
at link-time if symbols are bounded locally. For PC-relative relocation
against absolute symbols, they should be converted to non-PC-relative
relocation in target backend. If conversion can't be performed, target
backend should detect it and issue an error. This patch only fixes x86
backends.
bfd/
PR ld/19818
* bfd-in.h (bfd_elf_record_link_assignment): Add a bfd_boolean.
* bfd-in2.h: Regenerated.
* elf-bfd.h (elf_link_hash_entry): Add def_linker and
def_linker_abs.
(RESOLVED_TO_ABS_IN_PIC): New macro.
* elf32-i386.c (RESOLVED_TO_ZERO_OR_ABS): New macro.
(elf_i386_allocate_dynrelocs): Replace
UNDEFINED_WEAK_RESOLVED_TO_ZERO with RESOLVED_TO_ZERO_OR_ABS.
Discard space for non-pc-relative relocs against symbols which
are always resolved at link-time.
(elf_i386_convert_load): Replace UNDEFINED_WEAK_RESOLVED_TO_ZERO
with RESOLVED_TO_ZERO_OR_ABS.
(elf_i386_relocate_section): Replace
UNDEFINED_WEAK_RESOLVED_TO_ZERO with RESOLVED_TO_ZERO_OR_ABS.
Properly handle R_386_32 relocation against absolute symbol.
* elf64-x86-64.c (RESOLVED_TO_ZERO_OR_ABS): New macro.
(elf_x86_64_need_pic): Updated to check absolute symbol.
(elf_x86_64_check_relocs): Don't check R_X86_64_32 nor
R_X86_64_32S in shared object here. Use elf_x86_64_need_pic.
(elf_x86_64_allocate_dynrelocs): Replace
UNDEFINED_WEAK_RESOLVED_TO_ZERO with RESOLVED_TO_ZERO_OR_ABS.
Discard space for non-pc-relative relocs against symbols which
are always resolved at link-time.
(elf_x86_64_convert_load): Replace UNDEFINED_WEAK_RESOLVED_TO_ZERO
with RESOLVED_TO_ZERO_OR_ABS. Check def_linker for linker
defined symbol.
(elf_x86_64_relocate_section): Replace
UNDEFINED_WEAK_RESOLVED_TO_ZERO with RESOLVED_TO_ZERO_OR_ABS.
Properly handle R_X86_64_PC32, R_X86_64_32, R_X86_64_32S amd
R_X86_64_64 relocations against absolute symbol.
* elflink.c (bfd_elf_record_link_assignment): Updated. Set
def_linker and defsym.
ld/
PR ld/19818
* emultempl/elf32.em (gld${EMULATION_NAME}_find_exp_assignment):
Pass "exp->assign.defsym || !expld.rel_from_abs" to
bfd_elf_record_link_assignment.
(gld${EMULATION_NAME}_before_allocation): Set def_linker for
"__ehdr_start".
* testsuite/ld-i386/i386.exp: Run PR ld/19818 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-elf/pr19818a.d: New file.
* testsuite/ld-elf/pr19818a.s: Likewise.
* testsuite/ld-elf/pr19818b.d: Likewise.
* testsuite/ld-elf/pr19818b.s: Likewise.
* testsuite/ld-i386/pr19818-1.t: Likewise.
* testsuite/ld-i386/pr19818-1a.d: Likewise.
* testsuite/ld-i386/pr19818-1a.s: Likewise.
* testsuite/ld-i386/pr19818-1b.d: Likewise.
* testsuite/ld-i386/pr19818-1b.s: Likewise.
* testsuite/ld-i386/pr19818-1c.d: Likewise.
* testsuite/ld-i386/pr19818-1c.s: Likewise.
* testsuite/ld-i386/pr19818-1d.d: Likewise.
* testsuite/ld-i386/pr19818-1e.d: Likewise.
* testsuite/ld-i386/pr19818-1f.d: Likewise.
* testsuite/ld-i386/pr19818-1g.d: Likewise.
* testsuite/ld-i386/pr19818-1h.d: Likewise.
* testsuite/ld-i386/pr19818-1i.d: Likewise.
* testsuite/ld-i386/pr19818-1j.d: Likewise.
* testsuite/ld-i386/pr19818-1k.d: Likewise.
* testsuite/ld-i386/pr19818-1l.d: Likewise.
* testsuite/ld-i386/pr19818-2.s: Likewise.
* testsuite/ld-i386/pr19818-2a.d: Likewise.
* testsuite/ld-i386/pr19818-2b.d: Likewise.
* testsuite/ld-i386/pr19818-2c.d: Likewise.
* testsuite/ld-i386/pr19818-2d.d: Likewise.
* testsuite/ld-i386/pr19818-2e.d: Likewise.
* testsuite/ld-i386/pr19818-2f.d: Likewise.
* testsuite/ld-i386/pr19818-2g.d: Likewise.
* testsuite/ld-i386/pr19818-2h.d: Likewise.
* testsuite/ld-x86-64/pr19818-1.t: Likewise.
* testsuite/ld-x86-64/pr19818-1a.d: Likewise.
* testsuite/ld-x86-64/pr19818-1a.s: Likewise.
* testsuite/ld-x86-64/pr19818-1b.d: Likewise.
* testsuite/ld-x86-64/pr19818-1b.s: Likewise.
* testsuite/ld-x86-64/pr19818-1c.d: Likewise.
* testsuite/ld-x86-64/pr19818-1c.s: Likewise.
* testsuite/ld-x86-64/pr19818-1d.d: Likewise.
* testsuite/ld-x86-64/pr19818-1e.d: Likewise.
* testsuite/ld-x86-64/pr19818-1f.d: Likewise.
* testsuite/ld-x86-64/pr19818-1g.d: Likewise.
* testsuite/ld-x86-64/pr19818-1h.d: Likewise.
* testsuite/ld-x86-64/pr19818-1i.d: Likewise.
* testsuite/ld-x86-64/pr19818-1j.d: Likewise.
* testsuite/ld-x86-64/pr19818-1k.d: Likewise.
* testsuite/ld-x86-64/pr19818-1l.d: Likewise.
* testsuite/ld-x86-64/pr19818-1m.d: Likewise.
* testsuite/ld-x86-64/pr19818-1n.d: Likewise.
* testsuite/ld-x86-64/pr19818-1o.d: Likewise.
* testsuite/ld-x86-64/pr19818-1p.d: Likewise.
* testsuite/ld-x86-64/pr19818-1q.d: Likewise.
* testsuite/ld-x86-64/pr19818-1r.d: Likewise.
* testsuite/ld-x86-64/pr19818-1s.d: Likewise.
* testsuite/ld-x86-64/pr19818-1t.d: Likewise.
* testsuite/ld-x86-64/pr19818-1u.d: Likewise.
* testsuite/ld-x86-64/pr19818-1v.d: Likewise.
* testsuite/ld-x86-64/pr19818-1w.d: Likewise.
* testsuite/ld-x86-64/pr19818-1x.d: Likewise.
* testsuite/ld-x86-64/pr19818-1y.d: Likewise.
* testsuite/ld-x86-64/pr19818-2.s: Likewise.
* testsuite/ld-x86-64/pr19818-2a.d: Likewise.
* testsuite/ld-x86-64/pr19818-2b.d: Likewise.
* testsuite/ld-x86-64/pr19818-2c.d: Likewise.
* testsuite/ld-x86-64/pr19818-2d.d: Likewise.
* testsuite/ld-x86-64/pr19818-3.s: Likewise.
* testsuite/ld-x86-64/pr19818-3a.d: Likewise.
* testsuite/ld-x86-64/pr19818-3b.d: Likewise.
* testsuite/ld-x86-64/pr19818-3c.d: Likewise.
* testsuite/ld-x86-64/pr19818-3d.d: Likewise.
* testsuite/ld-x86-64/pr19818-4.s: Likewise.
* testsuite/ld-x86-64/pr19818-4a.d: Likewise.
* testsuite/ld-x86-64/pr19818-4b.d: Likewise.
* testsuite/ld-x86-64/pr19818-5.s: Likewise.
* testsuite/ld-x86-64/pr19818-5a.d: Likewise.
* testsuite/ld-x86-64/pr19818-5b.d: Likewise.
Diffstat (limited to 'gdb/filesystem.h')
0 files changed, 0 insertions, 0 deletions