This is an archive of the discontinued LLVM Phabricator instance.

[clang][MinGW] Explicitly ignore `-fPIC` & friends
ClosedPublic

Authored by zero9178 on Jan 1 2022, 4:08 PM.

Details

Summary

GCC on Windows ignores this flag completely [0] which some build systems sadly rely on when compiling for Windows using MinGW. The current behaviour of clang however is to error out as -fPIC & friends has no effect on Windows.

This patch instead changes the behaviour for MinGW to ignore the option for the sake of compatibility

Fixes https://github.com/llvm/llvm-project/issues/52947

[0] https://gcc.gnu.org/legacy-ml/gcc-patches/2015-08/msg00836.html

Diff Detail

Event Timeline

zero9178 requested review of this revision.Jan 1 2022, 4:08 PM
zero9178 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 1 2022, 4:08 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
mstorsjo accepted this revision.Jan 2 2022, 12:27 AM

LGTM, thanks. The fact that GCC used to emit a non-fatal warning for this option, but no longer does, probably is the key deciding factor here.

This revision is now accepted and ready to land.Jan 2 2022, 12:27 AM
This revision was landed with ongoing or failed builds.Jan 2 2022, 3:07 AM
This revision was automatically updated to reflect the committed changes.