diff options
author | David Chisnall <csdavec@swan.ac.uk> | 2019-03-31 11:22:19 +0000 |
---|---|---|
committer | David Chisnall <csdavec@swan.ac.uk> | 2019-03-31 11:22:19 +0000 |
commit | 0e9e02cd723ebd9f0dadc7a995329eb505e35d45 (patch) | |
tree | fc793937c0e2cedf74eddd9d07071a06dc43f723 /clang/lib/CodeGen/CGObjCGNU.cpp | |
parent | a2ed448bf24fe22e9a1149c6fcb583c139079b22 (diff) | |
download | bcm5719-llvm-0e9e02cd723ebd9f0dadc7a995329eb505e35d45.tar.gz bcm5719-llvm-0e9e02cd723ebd9f0dadc7a995329eb505e35d45.zip |
[objc-gnustep] Use .init_array not .ctors when requested.
This doesn't make a difference most of the time but FreeBSD/ARM doesn't
run anything in the .ctors array.
llvm-svn: 357362
Diffstat (limited to 'clang/lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index ccf73cbfc89..2957a893904 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -1514,7 +1514,12 @@ class CGObjCGNUstep2 : public CGObjCGNUstep { if (CGM.getTriple().isOSBinFormatCOFF()) InitVar->setSection(".CRT$XCLz"); else - InitVar->setSection(".ctors"); + { + if (CGM.getCodeGenOpts().UseInitArray) + InitVar->setSection(".init_array"); + else + InitVar->setSection(".ctors"); + } InitVar->setVisibility(llvm::GlobalValue::HiddenVisibility); InitVar->setComdat(TheModule.getOrInsertComdat(".objc_ctor")); CGM.addUsedGlobal(InitVar); |