[all-commits] [llvm/llvm-project] 7f0e6c: [LLD] [COFF] Add options for disabling auto import...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu May 14 03:05:42 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f0e6c31c25530352aa6e4cd9e2bdc4381368eba
      https://github.com/llvm/llvm-project/commit/7f0e6c31c25530352aa6e4cd9e2bdc4381368eba
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-05-14 (Thu, 14 May 2020)

  Changed paths:
    M lld/COFF/Config.h
    M lld/COFF/Driver.cpp
    M lld/COFF/Options.td
    M lld/COFF/SymbolTable.cpp
    M lld/COFF/Writer.cpp
    M lld/MinGW/Driver.cpp
    M lld/MinGW/Options.td
    M lld/test/COFF/autoimport-refptr.s
    M lld/test/COFF/autoimport-x86.s
    M lld/test/MinGW/driver.test

  Log Message:
  -----------
  [LLD] [COFF] Add options for disabling auto import and runtime pseudo relocs

Allow disabling either the full auto import feature, or just
forbidding the cases that require runtime fixups.

As long as all auto imported variables are referenced from separate
.refptr$<name> sections, we can alias them on top of the IAT entries
and don't actually need any runtime fixups via pseudo relocations.
LLVM generates references to variables in .refptr stubs, if it
isn't known that the variable for sure is defined in the same object
module. Runtime pseudo relocs are needed if the addresses of auto
imported variables are used in constant initializers though.

Fixing up runtime pseudo relocations requires the use of
VirtualProtect (which is disallowed in WinStore/UWP apps) or
VirtualProtectFromApp. To allow any risk of ambiguity, allow
rejecting cases that would require this at the linker stage.

This adds support for the --disable-runtime-pseudo-reloc and
--disable-auto-import options in the MinGW driver (matching GNU ld.bfd)
with corresponding lld private options in the COFF driver.

Differential Revision: https://reviews.llvm.org/D78923




More information about the All-commits mailing list