[PATCH] D33868: [Solaris] emit .init_array instead of .ctors on Solaris (Sparc/x86)
Fedor Sergeev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 3 11:45:59 PDT 2017
fedor.sergeev created this revision.
Herald added a subscriber: jyknight.
Honor Options.UseInitArray on Solaris targets.
Addressing PR33293.
https://reviews.llvm.org/D33868
Files:
lib/Target/Sparc/SparcTargetObjectFile.cpp
lib/Target/Sparc/SparcTargetObjectFile.h
lib/Target/X86/X86TargetMachine.cpp
lib/Target/X86/X86TargetObjectFile.cpp
lib/Target/X86/X86TargetObjectFile.h
Index: lib/Target/X86/X86TargetObjectFile.h
===================================================================
--- lib/Target/X86/X86TargetObjectFile.h
+++ lib/Target/X86/X86TargetObjectFile.h
@@ -66,6 +66,11 @@
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
};
+ /// \brief This implementation is used for Solaris on x86/x86-64.
+ class X86SolarisTargetObjectFile : public X86ELFTargetObjectFile {
+ void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
+ };
+
/// \brief This implementation is used for Windows targets on x86 and x86-64.
class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
const MCExpr *
Index: lib/Target/X86/X86TargetObjectFile.cpp
===================================================================
--- lib/Target/X86/X86TargetObjectFile.cpp
+++ lib/Target/X86/X86TargetObjectFile.cpp
@@ -86,6 +86,13 @@
InitializeELF(TM.Options.UseInitArray);
}
+void
+X86SolarisTargetObjectFile::Initialize(MCContext &Ctx,
+ const TargetMachine &TM) {
+ TargetLoweringObjectFileELF::Initialize(Ctx, TM);
+ InitializeELF(TM.Options.UseInitArray);
+}
+
const MCExpr *X86WindowsTargetObjectFile::lowerRelativeReference(
const GlobalValue *LHS, const GlobalValue *RHS,
const TargetMachine &TM) const {
Index: lib/Target/X86/X86TargetMachine.cpp
===================================================================
--- lib/Target/X86/X86TargetMachine.cpp
+++ lib/Target/X86/X86TargetMachine.cpp
@@ -91,6 +91,8 @@
return llvm::make_unique<X86FreeBSDTargetObjectFile>();
if (TT.isOSLinux() || TT.isOSNaCl() || TT.isOSIAMCU())
return llvm::make_unique<X86LinuxNaClTargetObjectFile>();
+ if (TT.isOSSolaris())
+ return llvm::make_unique<X86SolarisTargetObjectFile>();
if (TT.isOSFuchsia())
return llvm::make_unique<X86FuchsiaTargetObjectFile>();
if (TT.isOSBinFormatELF())
Index: lib/Target/Sparc/SparcTargetObjectFile.h
===================================================================
--- lib/Target/Sparc/SparcTargetObjectFile.h
+++ lib/Target/Sparc/SparcTargetObjectFile.h
@@ -23,6 +23,8 @@
TargetLoweringObjectFileELF()
{}
+ void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
+
const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
unsigned Encoding,
const TargetMachine &TM,
Index: lib/Target/Sparc/SparcTargetObjectFile.cpp
===================================================================
--- lib/Target/Sparc/SparcTargetObjectFile.cpp
+++ lib/Target/Sparc/SparcTargetObjectFile.cpp
@@ -15,6 +15,13 @@
using namespace llvm;
+void
+SparcELFTargetObjectFile::Initialize(MCContext &Ctx,
+ const TargetMachine &TM) {
+ TargetLoweringObjectFileELF::Initialize(Ctx, TM);
+ InitializeELF(TM.Options.UseInitArray);
+}
+
const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33868.101326.patch
Type: text/x-patch
Size: 3147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170603/d655ea72/attachment.bin>
More information about the llvm-commits
mailing list