[clang] [clang] [MinGW] Explicitly always pass the -fno-use-init-array (PR #68571)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 9 23:49:30 PDT 2023
mstorsjo wrote:
> Whatever we decide to do on the LLVM side, this seems fine for the clang side.
Yes, this bit should be fine in any case.
> It looks like clang uses the value of UseInitArray for some ObjC stuff, in addition to passing it to the backend, so we need the right value in clang in any case.
Indeed, having the correct picture is good, if there's logic that depends on it. For the ObjC case, the code actually looks like this:
```cpp
if (CGM.getTriple().isOSBinFormatCOFF())
InitVar->setSection(".CRT$XCLz");
else
{
if (CGM.getCodeGenOpts().UseInitArray)
InitVar->setSection(".init_array");
else
InitVar->setSection(".ctors");
}
```
So in that sense, it doesn't really matter here. (The `.CRT$...` sections do work on mingw too, even if `.ctors` normally is used.)
https://github.com/llvm/llvm-project/pull/68571
More information about the cfe-commits
mailing list