llvm.org GIT mirror llvm / e41f2a1
[CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD. PR: 30494 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282451 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 4 years ago
4 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4949 return make_unique();
5050 }
5151
52 if (TT.isOSFreeBSD())
53 return make_unique();
5254 if (TT.isOSLinux() || TT.isOSNaCl())
5355 return make_unique();
5456 if (TT.isOSBinFormatELF())
6262 const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
6363 const MCSymbol *Sym) const {
6464 return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
65 }
66
67 void
68 X86FreeBSDTargetObjectFile::Initialize(MCContext &Ctx,
69 const TargetMachine &TM) {
70 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
71 InitializeELF(TM.Options.UseInitArray);
6572 }
6673
6774 void
4848 const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
4949 };
5050
51 /// X86FreeBSDTargetObjectFile - This implementation is used for FreeBSD
52 /// on x86 and x86-64.
53 class X86FreeBSDTargetObjectFile : public X86ELFTargetObjectFile {
54 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
55 };
56
5157 /// X86LinuxNaClTargetObjectFile - This implementation is used for linux and
5258 /// Native Client on x86 and x86-64.
5359 class X86LinuxNaClTargetObjectFile : public X86ELFTargetObjectFile {
0 ; RUN: llc -mtriple x86_64-pc-linux -use-ctors < %s | FileCheck --check-prefix=CTOR %s
1 ; RUN: llc -mtriple x86_64-unknown-freebsd -use-ctors < %s | FileCheck --check-prefix=CTOR %s
12 ; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck --check-prefix=INIT-ARRAY %s
3 ; RUN: llc -mtriple x86_64-unknown-freebsd < %s | FileCheck --check-prefix=INIT-ARRAY %s
24 ; RUN: llc -mtriple x86_64-unknown-nacl < %s | FileCheck --check-prefix=NACL %s
35 @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 }]
46