summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-02-01 01:31:36 +0000
committerMatthias Braun <matze@braunis.de>2017-02-01 01:31:36 +0000
commit8d115a384c83c01286d9aa82b0dcb83401e89741 (patch)
tree542f5159bf36b55a14ad19f396fa5272bbeb1c38 /llvm
parent926883e1c2a39baabc67cfd5ec0d913c9851af68 (diff)
downloadbcm5719-llvm-8d115a384c83c01286d9aa82b0dcb83401e89741.tar.gz
bcm5719-llvm-8d115a384c83c01286d9aa82b0dcb83401e89741.zip
MCMacho: Allow __thread_ptr section after dwarf sections
Differential Revision: https://reviews.llvm.org/D29315 llvm-svn: 293730
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp3
-rw-r--r--llvm/test/MC/MachO/ARM/no-tls-assert.ll28
2 files changed, 30 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 45a497240b4..bd425bb7309 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -142,7 +142,8 @@ static bool canGoAfterDWARF(const MCSectionMachO &MSec) {
if (SegName == "__TEXT" && SecName == "__eh_frame")
return true;
- if (SegName == "__DATA" && SecName == "__nl_symbol_ptr")
+ if (SegName == "__DATA" && (SecName == "__nl_symbol_ptr" ||
+ SecName == "__thread_ptr"))
return true;
return false;
diff --git a/llvm/test/MC/MachO/ARM/no-tls-assert.ll b/llvm/test/MC/MachO/ARM/no-tls-assert.ll
new file mode 100644
index 00000000000..3466d4a5a5f
--- /dev/null
+++ b/llvm/test/MC/MachO/ARM/no-tls-assert.ll
@@ -0,0 +1,28 @@
+; RUN: llc -filetype=obj -o - %s | llvm-objdump -section-headers - | FileCheck %s
+; This should not trigger the "Creating regular section after DWARF" assert.
+; CHECK: __text
+; CHECK: __thread_ptr 00000004
+target triple = "thumbv7-apple-ios9.0.0"
+
+@b = external thread_local global i32
+define i32* @func(i32 %a) !dbg !9 {
+ ret i32* @b
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5, !6, !7}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
+!1 = !DIFile(filename: "r.ii", directory: "/")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{i32 1, !"min_enum_size", i32 4}
+!7 = !{i32 1, !"PIC Level", i32 2}
+!9 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 4, type: !10, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+!10 = !DISubroutineType(types: !11)
+!11 = !{null, !12}
+!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!13 = !DILocalVariable(name: "a", arg: 1, scope: !9, file: !1, line: 4, type: !12)
+!14 = !DIExpression()
OpenPOWER on IntegriCloud