From d31f89ebc16fc9e1ba26acad741e62d38890ad4c Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Mon, 2 Mar 2015 17:44:52 +0000 Subject: [PATCH] [PS4] Correct relocation for DWARF TLS references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230979 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86TargetMachine.cpp | 2 ++ lib/Target/X86/X86TargetObjectFile.cpp | 5 +++++ lib/Target/X86/X86TargetObjectFile.h | 6 ++++++ test/DebugInfo/X86/tls.ll | 3 +++ 4 files changed, 16 insertions(+) diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 4bde05306ce..f56d6bab157 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -37,6 +37,8 @@ static std::unique_ptr createTLOF(const Triple &TT) { return make_unique(); } + if (TT.isPS4CPU()) + return make_unique(); if (TT.isOSLinux()) return make_unique(); if (TT.isOSBinFormatELF()) diff --git a/lib/Target/X86/X86TargetObjectFile.cpp b/lib/Target/X86/X86TargetObjectFile.cpp index 1d1c32eb2cb..a298ca88ed7 100644 --- a/lib/Target/X86/X86TargetObjectFile.cpp +++ b/lib/Target/X86/X86TargetObjectFile.cpp @@ -74,6 +74,11 @@ X86LinuxTargetObjectFile::getDebugThreadLocalSymbol( return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext()); } +const MCExpr *PS4TargetObjectFile::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 diff --git a/lib/Target/X86/X86TargetObjectFile.h b/lib/Target/X86/X86TargetObjectFile.h index f7455382098..1cecf0b4819 100644 --- a/lib/Target/X86/X86TargetObjectFile.h +++ b/lib/Target/X86/X86TargetObjectFile.h @@ -47,6 +47,12 @@ namespace llvm { const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override; }; + /// \brief This TLOF implementation is used for PS4. + class PS4TargetObjectFile : public TargetLoweringObjectFileELF { + /// \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. class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF { const MCExpr * diff --git a/test/DebugInfo/X86/tls.ll b/test/DebugInfo/X86/tls.ll index 6f673dd378b..8c6ae9e0cb2 100644 --- a/test/DebugInfo/X86/tls.ll +++ b/test/DebugInfo/X86/tls.ll @@ -7,6 +7,9 @@ ; 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 + ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use ; that here instead of raw assembly printing -- 2.34.1