[llvm] r185389 - PR16493: DebugInfo with TLS on PPC crashing due to invalid relocation

David Blaikie dblaikie at gmail.com
Mon Jul 1 14:45:26 PDT 2013


Author: dblaikie
Date: Mon Jul  1 16:45:25 2013
New Revision: 185389

URL: http://llvm.org/viewvc/llvm-project?rev=185389&view=rev
Log:
PR16493: DebugInfo with TLS on PPC crashing due to invalid relocation

Restrict the current TLS support to X86 ELF for now. Test that we don't
produce it on PPC & we can flesh that test case out with the right thing
once someone implements it.

Added:
    llvm/trunk/test/DebugInfo/PowerPC/
    llvm/trunk/test/DebugInfo/PowerPC/lit.local.cfg
    llvm/trunk/test/DebugInfo/PowerPC/tls.ll
      - copied, changed from r185369, llvm/trunk/test/DebugInfo/X86/tls.ll
Modified:
    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
    llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
    llvm/trunk/test/DebugInfo/X86/tls.ll

Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=185389&r1=185388&r2=185389&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Mon Jul  1 16:45:25 2013
@@ -72,9 +72,6 @@ public:
   getStaticCtorSection(unsigned Priority = 65535) const;
   virtual const MCSection *
   getStaticDtorSection(unsigned Priority = 65535) const;
-
-  /// \brief Describe a TLS variable address within debug info.
-  virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
 };
 
 

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=185389&r1=185388&r2=185389&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Jul  1 16:45:25 2013
@@ -401,10 +401,6 @@ TargetLoweringObjectFileELF::InitializeE
                                SectionKind::getDataRel());
 }
 
-const MCSymbolRefExpr *TargetLoweringObjectFileELF::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
-  return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
-}
-
 //===----------------------------------------------------------------------===//
 //                                 MachO
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=185389&r1=185388&r2=185389&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Mon Jul  1 16:45:25 2013
@@ -47,3 +47,9 @@ X86LinuxTargetObjectFile::Initialize(MCC
   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
   InitializeELF(TM.Options.UseInitArray);
 }
+
+const MCSymbolRefExpr *
+X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
+    const MCSymbol *Sym) const {
+  return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
+}

Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=185389&r1=185388&r2=185389&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Mon Jul  1 16:45:25 2013
@@ -36,6 +36,9 @@ namespace llvm {
   /// and x86-64.
   class X86LinuxTargetObjectFile : public TargetLoweringObjectFileELF {
     virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
+
+    /// \brief Describe a TLS variable address within debug info.
+    virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
   };
 
 } // end namespace llvm

Added: llvm/trunk/test/DebugInfo/PowerPC/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PowerPC/lit.local.cfg?rev=185389&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/PowerPC/lit.local.cfg (added)
+++ llvm/trunk/test/DebugInfo/PowerPC/lit.local.cfg Mon Jul  1 16:45:25 2013
@@ -0,0 +1,5 @@
+config.suffixes = ['.ll', '.s']
+
+targets = set(config.root.targets_to_build.split())
+if not 'PowerPC' in targets:
+    config.unsupported = True

Copied: llvm/trunk/test/DebugInfo/PowerPC/tls.ll (from r185369, llvm/trunk/test/DebugInfo/X86/tls.ll)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PowerPC/tls.ll?p2=llvm/trunk/test/DebugInfo/PowerPC/tls.ll&p1=llvm/trunk/test/DebugInfo/X86/tls.ll&r1=185369&r2=185389&rev=185389&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/tls.ll (original)
+++ llvm/trunk/test/DebugInfo/PowerPC/tls.ll Mon Jul  1 16:45:25 2013
@@ -1,23 +1,10 @@
-; RUN: llc -mtriple=x86_64-unknown-unknown -O0 -filetype=asm < %s | FileCheck %s
-; RUN: llc -mtriple=i386-unknown-unknown -O0 -filetype=asm < %s | FileCheck --check-prefix=CHECK-32 %s
+; RUN: llc -mtriple=powerpc-unknown-unknown -O0 -filetype=asm < %s | FileCheck %s
 
 ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
 ; that here instead of raw assembly printing
 
-; 10 bytes of data in this DW_FORM_block1 representation of the location of 'tls'
-; CHECK: .byte	10{{ *}}# DW_AT_location
-; DW_OP_const8u (0x0e == 14) of adress
-; CHECK: .byte	14
-; The debug relocation of the address of the tls variable
-; CHECK: .quad	tls at DTPOFF
-; DW_OP_lo_user based on GCC/GDB extension presumably (by experiment) to support TLS
-; CHECK: .byte	224
-
-; same again, except with a 32 bit address
-; CHECK-32: .byte	6{{ *}}# DW_AT_location
-; CHECK-32: .byte	12
-; CHECK-32: .long	tls at DTPOFF
-; CHECK-32: .byte	224
+; CHECK: debug_info
+; CHECK-NOT: tls at DTPOFF
 
 @tls = thread_local global i32 7, align 4
 
@@ -32,3 +19,4 @@
 !5 = metadata !{i32 786473, metadata !1}          ; [ DW_TAG_file_type ] [/tmp/tls.cpp]
 !6 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
 !7 = metadata !{i32 2, metadata !"Dwarf Version", i32 3}
+

Modified: llvm/trunk/test/DebugInfo/X86/tls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/tls.ll?rev=185389&r1=185388&r2=185389&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/tls.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/tls.ll Mon Jul  1 16:45:25 2013
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=x86_64-unknown-unknown -O0 -filetype=asm < %s | FileCheck %s
-; RUN: llc -mtriple=i386-unknown-unknown -O0 -filetype=asm < %s | FileCheck --check-prefix=CHECK-32 %s
+; RUN: llc -mtriple=x86_64-linux -O0 -filetype=asm < %s | FileCheck %s
+; RUN: llc -mtriple=i386-linux -O0 -filetype=asm < %s | FileCheck --check-prefix=CHECK-32 %s
 
 ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
 ; that here instead of raw assembly printing





More information about the llvm-commits mailing list