From babe22427090edc47fdda29fc0e67755de425519 Mon Sep 17 00:00:00 2001 From: dim Date: Fri, 5 Apr 2019 16:09:23 +0000 Subject: [PATCH] MFC r345806: 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 --- contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp b/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp index 622c8bfb500..fdafb434ce2 100644 --- a/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp @@ -1508,7 +1508,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); -- 2.45.0