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.

llvm-svn: 185389
This commit is contained in:
David Blaikie 2013-07-01 21:45:25 +00:00
parent ab70d5dbaa
commit 1b01ae8648
7 changed files with 38 additions and 9 deletions

View File

@ -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;
};

View File

@ -401,10 +401,6 @@ TargetLoweringObjectFileELF::InitializeELF(bool UseInitArray_) {
SectionKind::getDataRel());
}
const MCSymbolRefExpr *TargetLoweringObjectFileELF::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
}
//===----------------------------------------------------------------------===//
// MachO
//===----------------------------------------------------------------------===//

View File

@ -47,3 +47,9 @@ X86LinuxTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
const MCSymbolRefExpr *
X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
const MCSymbol *Sym) const {
return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
}

View File

@ -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

View File

@ -0,0 +1,5 @@
config.suffixes = ['.ll', '.s']
targets = set(config.root.targets_to_build.split())
if not 'PowerPC' in targets:
config.unsupported = True

View File

@ -0,0 +1,22 @@
; 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
; CHECK: debug_info
; CHECK-NOT: tls@DTPOFF
@tls = thread_local global i32 7, align 4
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7}
!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !2, metadata !3, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/tmp/tls.cpp] [DW_LANG_C_plus_plus]
!1 = metadata !{metadata !"tls.cpp", metadata !"/tmp"}
!2 = metadata !{i32 0}
!3 = metadata !{metadata !4}
!4 = metadata !{i32 786484, i32 0, null, metadata !"tls", metadata !"tls", metadata !"", metadata !5, i32 1, metadata !6, i32 0, i32 1, i32* @tls, null} ; [ DW_TAG_variable ] [tls] [line 1] [def]
!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}

View File

@ -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