summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/global-sections.ll
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2016-06-14 15:09:30 +0000
committerNirav Dave <niravd@google.com>2016-06-14 15:09:30 +0000
commitf8d00d5cac27171abd644c227fc4302a2bdc11c6 (patch)
tree54626cfe42083f8d7b38512149c8159bac1cafbe /llvm/test/CodeGen/X86/global-sections.ll
parent17091364d13f2436eb63ec4df484d28fcb55d976 (diff)
downloadbcm5719-llvm-f8d00d5cac27171abd644c227fc4302a2bdc11c6.tar.gz
bcm5719-llvm-f8d00d5cac27171abd644c227fc4302a2bdc11c6.zip
Fix BSS global handling in AsmPrinter
Change EmitGlobalVariable to check final assembler section is in BSS before using .lcomm/.comm directive. This prevents globals from being put into .bss erroneously when -data-sections is used. This fixes PR26570. Reviewers: echristo, rafael Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21146 llvm-svn: 272674
Diffstat (limited to 'llvm/test/CodeGen/X86/global-sections.ll')
-rw-r--r--llvm/test/CodeGen/X86/global-sections.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/global-sections.ll b/llvm/test/CodeGen/X86/global-sections.ll
index ef1b1ac7524..ea6df468ceb 100644
--- a/llvm/test/CodeGen/X86/global-sections.ll
+++ b/llvm/test/CodeGen/X86/global-sections.ll
@@ -311,3 +311,21 @@ bb7:
; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G16
; WIN32-SECTIONS: _G16:
+
+; PR26570
+
+@G17 = internal global i8 0
+; LINUX: .type G17,@object
+; LINUX: .local G17
+; LINUX: .comm G17,1,1
+
+; DARWIN: .zerofill __DATA,__bss,_G17,1,0
+
+; LINUX-SECTIONS: .type G17,@object
+; LINUX-SECTIONS: .section .bss.G17,"aw",@nobits
+; LINUX-SECTIONS: .byte 0
+; LINUX-SECTIONS: .size G17, 1
+
+; WIN32-SECTIONS: .section .bss,"bw",one_only,_G17
+; WIN32-SECTIONS: _G17:
+; WIN32-SECTIONS:.byte 0
OpenPOWER on IntegriCloud