Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] [MinGW] Explicitly always pass the -fno-use-init-array (#68571)
On MinGW targets, the .ctors section is always used for constructors. When using the .ctors section, the constructors need to be emitted in reverse order to get them execute in the right order. (Constructors with a specific priority are sorted separately by the linker later.) In LLVM, in CodeGen/AsmPrinter/AsmPrinter.cpp, there's code that reverses them before writing them out, executed when using the .ctors section. This logic is done whenever TM.Options.UseInitArray is set to false. Thus, make sure to set UseInitArray to false for this target. This fixes llvm/llvm-project#55938. (cherry picked from commit a2b8c49c1839076b540c542c024fcfe2361a3e47)
- Loading branch information