This is an archive of the discontinued LLVM Phabricator instance.

[RFC] [LLD] [COFF] Support options for enabling/disabling autoimport and pseudo relocs in .drectve sections
AbandonedPublic

Authored by mstorsjo on May 14 2020, 3:35 AM.

Details

Reviewers
rnk
ruiu
Summary

This is the other bit I split out from D78923 as mentioned there. However since I wrote this, I'm less convinced that it's a good idea.

Firstly, it makes the lld private option (used on the lld-link interface - the one on the mingw driver interface is public) essentially public, if projects would be to start embedding it in .drectve sections.

Secondly, placing such an option in an object file is tricky, because it's essentially impossible to override it by linker options, as the linker options are read first and the object file is parsed later, overriding it.

Thirdly, after remembering more of the details about this, it turned out that the full pseudo reloc mechanism should be usable even in restricted UWP mode, as long as VirtualProtect is remapped to VirtualProtectFromApp (which already is done in https://sourceforge.net/p/mingw-w64/mingw-w64/ci/8f078a256769c84a021f5512ba0400f1eb8d0c05/), and as long as all places needing fixup is in data sections. If the executable code is generated with LLVM, it should avoid placing any such references within code sections, but always use .refptr stubs - so then this shouldn't really be an issue.

In any case, posting this for discussion as it was mentioned in D78923 - but I'm less convinced about its necessity now. Or what does @jacek think?

Diff Detail

Event Timeline

mstorsjo created this revision.May 14 2020, 3:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2020, 3:35 AM
jacek added a comment.May 14 2020, 3:57 AM

With the solution for UWP, we don't have a use case .drectve change, so dropping that part sounds reasonable.

rnk added a comment.May 21 2020, 12:34 PM

I guess I would prefer not to add .drectve support for this unless there is a use case for it. It is a somewhat fragile interface.

mstorsjo abandoned this revision.May 21 2020, 1:03 PM

Yeah, let's shelve this one for now.