[PATCH] D78923: [LLD] [COFF] Add an option for disabling runtime pseudo relocs
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 06:25:12 PDT 2020
mstorsjo created this revision.
mstorsjo added reviewers: rnk, ruiu.
Herald added a project: LLVM.
mstorsjo marked an inline comment as done.
mstorsjo added inline comments.
================
Comment at: lld/COFF/Options.td:187
// LLD extensions
+defm runtime_pseudo_reloc : B<"runtime-pseudo-reloc", "", "">;
def end_lib : F<"end-lib">,
----------------
It would be nice to be able to omit the HelpText for the two options here (to hide the option from the help listing), when using `B<>` style options for private options, but the current form of `multiclass B<...` doesn't allow omitting those strings and unconditionally adds HelpText, which includes it in the listing. I'm not nearly familiar enough with tablegen to know what's possible to do, though.
This feature relies on the mingw runtime doing fixups of relocations after being loaded, requiring the use of VirtualProtect for making sections writable. As this function isn't allowed in WinStore/UWP apps and the less capable VirtualProtectFromApp requires a JIT capability), the simplest solution is just to avoid the whole feature (automatic dllimport of variables without that attribute).
This adds support for the --disable-runtime-pseudo-reloc option to the MinGW driver (matching GNU ld.bfd), with a corresponding lld private option in the COFF driver. (I can split that part of the change to a separate commit after review.)
As an optional feature, this also allows the lld private option in .drectve sections, as it would be convenient to have object files in WinStore/UWP specific libraries disable this feature in the linker. Not sure if it's something we want to do, to expose the lld private option name in such an interface though...
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78923
Files:
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/Options.td
lld/COFF/SymbolTable.cpp
lld/COFF/Writer.cpp
lld/MinGW/Driver.cpp
lld/MinGW/Options.td
lld/test/COFF/autoimport-drectve.s
lld/test/COFF/autoimport-x86.s
lld/test/MinGW/driver.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78923.260298.patch
Type: text/x-patch
Size: 7716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200427/6eaa5986/attachment.bin>
More information about the llvm-commits
mailing list