[PATCH] x86-64: Check relocations with -z nocopyreloc
H.J. Lu
hjl.tools@gmail.com
Thu Aug 24 15:03:00 GMT 2017
On Thu, Aug 24, 2017 at 5:14 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> On x86-64, when -z nocopyreloc is used to build executable, relocations
> may overflow at run-time or may not be resolved without PIC. This patch
> checks these conditions and issues an error with suggestion for -fPIC.
>
> bfd/
>
> PR ld/22001
> * elf64-x86-64.c (elf_x86_64_relocate_section): Check for
> R_X86_64_PC32 relocation run-time overflow and unresolvable
> R_X86_64_32S relocation with -z nocopyreloc.
>
> ld/
>
> PR ld/22001
> * testsuite/ld-i386/i386.exp: Run -z nocopyreloc tests.
> * testsuite/ld-x86-64/x86-64.exp: Likewise.
> * ld/testsuite/ld-i386/pr22001-1a.c: New file.
> * ld/testsuite/ld-i386/pr22001-1b.c: Likewise.
> * ld/testsuite/ld-i386/pr22001-1c.S: Likewise.
> * ld/testsuite/ld-x86-64/pr22001-1a.c: Likewise.
> * ld/testsuite/ld-x86-64/pr22001-1a.err: Likewise.
> * ld/testsuite/ld-x86-64/pr22001-1b.c: Likewise.
> * ld/testsuite/ld-x86-64/pr22001-1b.err: Likewise.
> * ld/testsuite/ld-x86-64/pr22001-1c.c: Likewise.
I checked in this patch to run pr22001-1b on x32 since R_X86_64_32S
relocation can be turned into dynamic R_X86_64_32 relocation which
won't overflow on x32.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-64-Run-pr22001-1b-on-x32.patch
Type: text/x-patch
Size: 1617 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170824/25178622/attachment.bin>
More information about the Binutils
mailing list