aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/clang/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-04-02 17:51:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-04-02 17:51:28 +0000
commitd705ee60a29efec758001781f664dec656e8239e (patch)
tree02b14ab8acf846b8b321e682876607abc1df2533 /contrib/llvm/tools/clang/lib
parent99bad9ca9a4b1a3302fd3a7b71561189a4bab4c3 (diff)
Pull in r357362 from upstream clang trunk (by David Chisnall):
[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. This should help with updating the libobjc2 port for armv7. Requested by: theraven Upstream PR: https://github.com/gnustep/libobjc2/issues/83 MFC after: 3 days
Notes
Notes: svn path=/head/; revision=345806
Diffstat (limited to 'contrib/llvm/tools/clang/lib')
-rw-r--r--contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp b/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp
index 548bd6b3fd72..17f08115ec4c 100644
--- a/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1519,7 +1519,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);