[PATCH] [X86][ELF] Correct relocation for DWARF TLS references
Paul Robinson
Paul_Robinson at playstation.sony.com
Tue Mar 3 13:03:55 PST 2015
REPOSITORY
rL LLVM
http://reviews.llvm.org/D8011
Files:
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
llvm/trunk/test/DebugInfo/X86/tls.ll
Index: llvm/trunk/test/DebugInfo/X86/tls.ll
===================================================================
--- llvm/trunk/test/DebugInfo/X86/tls.ll
+++ llvm/trunk/test/DebugInfo/X86/tls.ll
@@ -7,6 +7,12 @@
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu -split-dwarf=Enable \
; RUN: | FileCheck --check-prefix=CHECK --check-prefix=FISSION %s
+; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-scei-ps4 \
+; RUN: | FileCheck --check-prefix=CHECK --check-prefix=SINGLE --check-prefix=SINGLE-64 %s
+
+; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-freebsd \
+; RUN: | FileCheck --check-prefix=CHECK --check-prefix=SINGLE --check-prefix=SINGLE-64 %s
+
; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
; that here instead of raw assembly printing
Index: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
@@ -62,18 +62,17 @@
return MCBinaryExpr::CreateAdd(Res, Off, getContext());
}
+const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
+ const MCSymbol *Sym) const {
+ return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
+}
+
void
X86LinuxTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
-const MCExpr *
-X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
- const MCSymbol *Sym) const {
- return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
-}
-
const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const {
// We are looking for the difference of two symbols, need a subtraction
Index: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
@@ -40,7 +40,7 @@
if (TT.isOSLinux())
return make_unique<X86LinuxTargetObjectFile>();
if (TT.isOSBinFormatELF())
- return make_unique<TargetLoweringObjectFileELF>();
+ return make_unique<X86ELFTargetObjectFile>();
if (TT.isKnownWindowsMSVCEnvironment())
return make_unique<X86WindowsTargetObjectFile>();
if (TT.isOSBinFormatCOFF())
Index: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
===================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
@@ -38,13 +38,17 @@
int64_t Offset) const override;
};
+ /// \brief This implemenatation is used for X86 ELF targets that don't
+ /// have a further specialization.
+ class X86ELFTargetObjectFile : public TargetLoweringObjectFileELF {
+ /// \brief Describe a TLS variable address within debug info.
+ const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
+ };
+
/// X86LinuxTargetObjectFile - This implementation is used for linux x86
/// and x86-64.
- class X86LinuxTargetObjectFile : public TargetLoweringObjectFileELF {
+ class X86LinuxTargetObjectFile : public X86ELFTargetObjectFile {
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
-
- /// \brief Describe a TLS variable address within debug info.
- const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
};
/// \brief This implementation is used for Windows targets on x86 and x86-64.
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8011.21132.patch
Type: text/x-patch
Size: 3728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150303/1571b8dc/attachment.bin>
More information about the llvm-commits
mailing list