V6 [PATCH] x86: Only allow S - A relocations against absolute symbol

H.J. Lu hjl.tools@gmail.com
Wed Apr 1 21:28:41 GMT 2020


On Wed, Apr 1, 2020 at 7:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Mar 31, 2020 at 8:30 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Tue, Mar 31, 2020 at 4:25 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Tue, Mar 31, 2020 at 7:31 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > >
> > > > On Mon, Mar 30, 2020 at 11:18 PM Fangrui Song <i@maskray.me> wrote:
> > > > >
> > > > > On 2020-03-30, H.J. Lu via Binutils wrote:
> > > > > >Since value of non-preemptible absolute symbol (SHN_ABS) won't change,
> > > > > >only S - A relocations against non-preemptible absolute symbol are
> > > > > >allowed in PIE and shared library.
> > > > >
> > > > > Thanks for the patch. At some point we should define some generic
> > > > > relocation categories (https://reviews.llvm.org/rL266158). For example,
> > > > >
> > > > > - R_ABS: R_X86_64_8, R_X86_64_16, R_X86_64_32, R_X86_64_64
> > > > >           R_AARCH64_ABS16, R_AARCH64_ABS32, R_AARCH64_ABS64
> > > > >           R_PPC64_ADDR16, R_PPC64_ADDR16_DS, R_PPC64_ADDR16_HA, ...
> > > > > - R_PCREL: R_X86_64_PC8, R_X86_64_PC16, R_X86_64_PC32, R_X86_64_PC64
> > > > >           R_AARCH64_PREL16, R_AARCH64_PREL32, R_AARCH64_PREL64
> > > > > - R_PLT_PCREL: R_X86_64_PLT32, R_AARCH64_CALL26
> > > > > - R_GOT_PCREL: R_X86_64_GOTPCREL, R_X86_64_GOTPCRELX
> > > > >
> > > > > Define a property is_preemptible as a more appropriate level of
> > > > > abstraction for GENERATE_DYNAMIC_RELOCATION_P and some use cases of bfd_link_pic and bfd_link_executable...
> > > >
> > > > Current BFD linker delegates most, if not all, of relocation to each backend.
> > > > There are many similar codes in backends.  I am sharing as much codes
> > > > between i386 and x86-64 backends as I can.
> > > >
> > > > This is the patch I am checking in.
> > >
> > > Here is the updated patch to include the fix for
> > >
> > > https://sourceware.org/bugzilla/show_bug.cgi?id=25754
> > >
> >
> > Another update to allow GOTPCREL relocations.
>
> Update to detect R_X86_64_32S/R_X86_64_32 overflow.
>

This is the final version I am checking in.  It allows PC relocation
against absolute
symbols defined by linker script.  Tested with GCC, glibc and Linux
x86-64 kernel.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Only-allow-S-A-relocations-against-absolute-symb.patch
Type: application/x-patch
Size: 41066 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20200401/8f41da79/attachment.bin>


More information about the Binutils mailing list