mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 20:59:51 +00:00
GV with null value initializer shouldn't go to BSS if it's meant for a mergeable strings section. Currently it only checks for Darwin. Someone else please check if it should apply to other targets as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ccd846b73f
commit
caa0c2cadd
@ -835,7 +835,9 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
if (Subtarget->isTargetELF())
|
||||
O << "\t.type " << name << ",%object\n";
|
||||
|
||||
if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal()) {
|
||||
if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() &&
|
||||
!(isDarwin &&
|
||||
TAI->SectionKindForGlobal(GVar) == SectionKind::RODataMergeStr)) {
|
||||
// FIXME: This seems to be pretty darwin-specific
|
||||
|
||||
if (GVar->hasExternalLinkage()) {
|
||||
|
@ -915,7 +915,8 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
if (C->isNullValue() && /* FIXME: Verify correct */
|
||||
!GVar->hasSection() &&
|
||||
(GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
|
||||
GVar->mayBeOverridden())) {
|
||||
GVar->mayBeOverridden()) &&
|
||||
TAI->SectionKindForGlobal(GVar) != SectionKind::RODataMergeStr) {
|
||||
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
|
||||
|
||||
if (GVar->hasExternalLinkage()) {
|
||||
|
@ -799,7 +799,9 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
|
||||
SwitchToSection(TAI->SectionForGlobal(GVar));
|
||||
|
||||
if (C->isNullValue() && !GVar->hasSection()) {
|
||||
if (C->isNullValue() && !GVar->hasSection() &&
|
||||
!(Subtarget->isTargetDarwin() &&
|
||||
TAI->SectionKindForGlobal(GVar) == SectionKind::RODataMergeStr)) {
|
||||
// FIXME: This seems to be pretty darwin-specific
|
||||
if (GVar->hasExternalLinkage()) {
|
||||
if (const char *Directive = TAI->getZeroFillDirective()) {
|
||||
|
4
test/CodeGen/X86/cstring.ll
Normal file
4
test/CodeGen/X86/cstring.ll
Normal file
@ -0,0 +1,4 @@
|
||||
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep comm
|
||||
; rdar://6479858
|
||||
|
||||
@str1 = internal constant [1 x i8] zeroinitializer
|
Loading…
Reference in New Issue
Block a user