mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD.
PR: 30494 llvm-svn: 282451
This commit is contained in:
parent
5722b8c65d
commit
836f9d2e4e
@ -50,6 +50,8 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
|
||||
return make_unique<TargetLoweringObjectFileMachO>();
|
||||
}
|
||||
|
||||
if (TT.isOSFreeBSD())
|
||||
return make_unique<X86FreeBSDTargetObjectFile>();
|
||||
if (TT.isOSLinux() || TT.isOSNaCl())
|
||||
return make_unique<X86LinuxNaClTargetObjectFile>();
|
||||
if (TT.isOSBinFormatELF())
|
||||
|
@ -65,6 +65,13 @@ const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
|
||||
return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
|
||||
}
|
||||
|
||||
void
|
||||
X86FreeBSDTargetObjectFile::Initialize(MCContext &Ctx,
|
||||
const TargetMachine &TM) {
|
||||
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
||||
InitializeELF(TM.Options.UseInitArray);
|
||||
}
|
||||
|
||||
void
|
||||
X86LinuxNaClTargetObjectFile::Initialize(MCContext &Ctx,
|
||||
const TargetMachine &TM) {
|
||||
|
@ -49,6 +49,12 @@ namespace llvm {
|
||||
const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
|
||||
};
|
||||
|
||||
/// X86FreeBSDTargetObjectFile - This implementation is used for FreeBSD
|
||||
/// on x86 and x86-64.
|
||||
class X86FreeBSDTargetObjectFile : public X86ELFTargetObjectFile {
|
||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||
};
|
||||
|
||||
/// X86LinuxNaClTargetObjectFile - This implementation is used for linux and
|
||||
/// Native Client on x86 and x86-64.
|
||||
class X86LinuxNaClTargetObjectFile : public X86ELFTargetObjectFile {
|
||||
|
@ -1,5 +1,7 @@
|
||||
; RUN: llc -mtriple x86_64-pc-linux -use-ctors < %s | FileCheck --check-prefix=CTOR %s
|
||||
; RUN: llc -mtriple x86_64-unknown-freebsd -use-ctors < %s | FileCheck --check-prefix=CTOR %s
|
||||
; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck --check-prefix=INIT-ARRAY %s
|
||||
; RUN: llc -mtriple x86_64-unknown-freebsd < %s | FileCheck --check-prefix=INIT-ARRAY %s
|
||||
; RUN: llc -mtriple x86_64-unknown-nacl < %s | FileCheck --check-prefix=NACL %s
|
||||
@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null}, { i32, void ()*, i8* } { i32 15, void ()* @g, i8* @v }]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user