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)Allow disabling either the full auto import feature, the simplest solution isor just to avoid the whole feature (automatic dllimport of variables without that attribute)forbidding the cases that require runtime fixups.
This adds support for the --disable-runtime-pseudo-reloc option to the MinGW driver (matching GNU ld.bfd),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. with a corresponding lld private optionLLVM generates references to variables in the COFF driver..refptr stubs, (I can split that part of the change to a separate commit after review.)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.
As an optional feature, this also allows the lld private option in .drectve sections,Fixing up runtime pseudo relocations requires the use of VirtualProtect (which is disallowed in WinStore/UWP apps) or VirtualProtectFromApp. as it would be convenient to have object files in WinStore/UWP specific libraries disable this feature in the linker.To allow any risk of ambiguity, Not sure if it's something we want to do, to expose the lld private option name in such an interface though...
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.