llvm.org GIT mirror llvm / 1f8fa31
[X86][ELF] Correct relocation for DWARF TLS references Previously we had only Linux using DTPOFF for these; all X86 ELF targets should. Fixes a side issue mentioned in PR21077. Differential Revision: http://reviews.llvm.org/D8011 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231130 91177308-0d34-0410-b5e6-96231b3b80d8 Paul Robinson 5 years ago
4 changed file(s) with 20 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
3939 if (TT.isOSLinux())
4040 return make_unique();
4141 if (TT.isOSBinFormatELF())
42 return make_unique<TargetLoweringObjectFileELF>();
42 return make_unique<X86ELFTargetObjectFile>();
4343 if (TT.isKnownWindowsMSVCEnvironment())
4444 return make_unique();
4545 if (TT.isOSBinFormatCOFF())
6161 return MCBinaryExpr::CreateAdd(Res, Off, getContext());
6262 }
6363
64 const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
65 const MCSymbol *Sym) const {
66 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
67 }
68
6469 void
6570 X86LinuxTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM) {
6671 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
6772 InitializeELF(TM.Options.UseInitArray);
68 }
69
70 const MCExpr *
71 X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
72 const MCSymbol *Sym) const {
73 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
7473 }
7574
7675 const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
3737 int64_t Offset) const override;
3838 };
3939
40 /// \brief This implemenatation is used for X86 ELF targets that don't
41 /// have a further specialization.
42 class X86ELFTargetObjectFile : public TargetLoweringObjectFileELF {
43 /// \brief Describe a TLS variable address within debug info.
44 const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
45 };
46
4047 /// X86LinuxTargetObjectFile - This implementation is used for linux x86
4148 /// and x86-64.
42 class X86LinuxTargetObjectFile : public TargetLoweringObjectFileELF {
49 class X86LinuxTargetObjectFile : public X86ELFTargetObjectFile {
4350 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
44
45 /// \brief Describe a TLS variable address within debug info.
46 const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
4751 };
4852
4953 /// \brief This implementation is used for Windows targets on x86 and x86-64.
55
66 ; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu -split-dwarf=Enable \
77 ; RUN: | FileCheck --check-prefix=CHECK --check-prefix=FISSION %s
8
9 ; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-scei-ps4 \
10 ; RUN: | FileCheck --check-prefix=CHECK --check-prefix=SINGLE --check-prefix=SINGLE-64 %s
11
12 ; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-freebsd \
13 ; RUN: | FileCheck --check-prefix=CHECK --check-prefix=SINGLE --check-prefix=SINGLE-64 %s
814
915 ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
1016 ; that here instead of raw assembly printing