llvm.org GIT mirror llvm / a35ae96
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185389 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 7 years ago
7 changed file(s) with 38 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
7171 getStaticCtorSection(unsigned Priority = 65535) const;
7272 virtual const MCSection *
7373 getStaticDtorSection(unsigned Priority = 65535) const;
74
75 /// \brief Describe a TLS variable address within debug info.
76 virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
7774 };
7875
7976
398398 ELF::SHF_WRITE |
399399 ELF::SHF_ALLOC,
400400 SectionKind::getDataRel());
401 }
402
403 const MCSymbolRefExpr *TargetLoweringObjectFileELF::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
404 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
405401 }
406402
407403 //===----------------------------------------------------------------------===//
4646 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
4747 InitializeELF(TM.Options.UseInitArray);
4848 }
49
50 const MCSymbolRefExpr *
51 X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
52 const MCSymbol *Sym) const {
53 return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
54 }
3535 /// and x86-64.
3636 class X86LinuxTargetObjectFile : public TargetLoweringObjectFileELF {
3737 virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
38
39 /// \brief Describe a TLS variable address within debug info.
40 virtual const MCSymbolRefExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
3841 };
3942
4043 } // end namespace llvm
0 config.suffixes = ['.ll', '.s']
1
2 targets = set(config.root.targets_to_build.split())
3 if not 'PowerPC' in targets:
4 config.unsupported = True
0 ; RUN: llc -mtriple=powerpc-unknown-unknown -O0 -filetype=asm < %s | FileCheck %s
1
2 ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
3 ; that here instead of raw assembly printing
4
5 ; CHECK: debug_info
6 ; CHECK-NOT: tls@DTPOFF
7
8 @tls = thread_local global i32 7, align 4
9
10 !llvm.dbg.cu = !{!0}
11 !llvm.module.flags = !{!7}
12
13 !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]
14 !1 = metadata !{metadata !"tls.cpp", metadata !"/tmp"}
15 !2 = metadata !{i32 0}
16 !3 = metadata !{metadata !4}
17 !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]
18 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/tmp/tls.cpp]
19 !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]
20 !7 = metadata !{i32 2, metadata !"Dwarf Version", i32 3}
21
None ; RUN: llc -mtriple=x86_64-unknown-unknown -O0 -filetype=asm < %s | FileCheck %s
1 ; RUN: llc -mtriple=i386-unknown-unknown -O0 -filetype=asm < %s | FileCheck --check-prefix=CHECK-32 %s
0 ; RUN: llc -mtriple=x86_64-linux -O0 -filetype=asm < %s | FileCheck %s
1 ; RUN: llc -mtriple=i386-linux -O0 -filetype=asm < %s | FileCheck --check-prefix=CHECK-32 %s
22
33 ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
44 ; that here instead of raw assembly printing