On Mon, Mar 30, 2020 at 11:18 PM Fangrui Song 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. -- H.J.