diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-03-15 11:07:06 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-03-15 11:07:54 -0700 |
commit | 4c10bbaa0912742322f10d9d5bb630ba4e15dfa7 (patch) | |
tree | 4da4677185d00b755043d03f5781dd316029926c /bfd | |
parent | 1eb2dbb8d73c344e199fd04531ec3f649e2835b2 (diff) | |
download | gdb-4c10bbaa0912742322f10d9d5bb630ba4e15dfa7.zip gdb-4c10bbaa0912742322f10d9d5bb630ba4e15dfa7.tar.gz gdb-4c10bbaa0912742322f10d9d5bb630ba4e15dfa7.tar.bz2 |
Add -z noreloc-overflow option to x86-64 ld
Add -z noreloc-overflow command-line option to the x86-64 ELF linker to
disable relocation overflow check. This can be used to avoid relocation
overflow check if there will be no dynamic relocation overflow at
run-time.
bfd/
PR ld/19807
* elf64-x86-64.c (elf_x86_64_relocate_section): Check
no_reloc_overflow_check to diable R_X86_64_32/R_X86_64_32S
relocation overflow check.
include/
PR ld/19807
* bfdlink.h (bfd_link_info): Add no_reloc_overflow_check.
ld/
PR ld/19807
* Makefile.am (ELF_X86_DEPS): Add
$(srcdir)/emulparams/reloc_overflow.sh.
* Makefile.in: Regenerated.
* NEWS: Mention -z noreloc-overflow.
* ld.texinfo: Document -z noreloc-overflow.
* emulparams/elf32_x86_64.sh: Source
${srcdir}/emulparams/reloc_overflow.sh.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/reloc_overflow.sh: New file.
* testsuite/ld-x86-64/pr19807-1.s: New file.
* testsuite/ld-x86-64/pr19807-1a.d: Likewise.
* testsuite/ld-x86-64/pr19807-1b.d: Likewise.
* testsuite/ld-x86-64/pr19807-2.s: Likewise.
* testsuite/ld-x86-64/pr19807-2a.d: Likewise.
* testsuite/ld-x86-64/pr19807-2b.d: Likewise.
* testsuite/ld-x86-64/pr19807-2c.d: Likewise.
* testsuite/ld-x86-64/pr19807-2d.d: Likewise.
* testsuite/ld-x86-64/pr19807-2e.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/19807 tests.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 89180cb..2bb0cc1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2016-03-15 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/19807 + * elf64-x86-64.c (elf_x86_64_relocate_section): Check + no_reloc_overflow_check to diable R_X86_64_32/R_X86_64_32S + relocation overflow check. + 2016-03-14 H.J. Lu <hongjiu.lu@intel.com> * bfd-in2.h: Regenerated. diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 380376d..31b1f87 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1973,8 +1973,10 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Let's help debug shared library creation. These relocs cannot be used in shared libs. Don't error out for sections we don't care about, such as debug sections or - non-constant sections. */ - if (bfd_link_pic (info) + non-constant sections, or when relocation overflow check + is disabled. */ + if (!info->no_reloc_overflow_check + && bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0 && (sec->flags & SEC_READONLY) != 0) { @@ -4842,8 +4844,12 @@ direct: } else { - /* This symbol is local, or marked to become local. */ - if (r_type == htab->pointer_r_type) + /* This symbol is local, or marked to become local. + When relocation overflow check is disabled, we + convert R_X86_64_32 to dynamic R_X86_64_RELATIVE. */ + if (r_type == htab->pointer_r_type + || (r_type == R_X86_64_32 + && info->no_reloc_overflow_check)) { relocate = TRUE; outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE); |