From: Rafael Espindola Date: Sun, 14 Nov 2010 19:40:55 +0000 (+0000) Subject: Fix the type of a symbol created with .comm and no corresponding .type. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=765fb1a446e0f1f338858dc628b4a7a60da37e80;p=oota-llvm.git Fix the type of a symbol created with .comm and no corresponding .type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119060 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp index 1f4f1461a57..ba51f67f786 100644 --- a/lib/MC/MCELFStreamer.cpp +++ b/lib/MC/MCELFStreamer.cpp @@ -409,6 +409,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, if (!BindingExplicitlySet.count(Symbol)) { SetBinding(SD, ELF::STB_GLOBAL); SD.setExternal(true); + SetType(SD, ELF::STT_OBJECT); } if (GetBinding(SD) == ELF_STB_Local) { diff --git a/test/MC/ELF/common.s b/test/MC/ELF/common.s index 9aa0c06298e..96865befe38 100644 --- a/test/MC/ELF/common.s +++ b/test/MC/ELF/common.s @@ -61,3 +61,15 @@ foo: // CHECK-NEXT: ('st_shndx', 0x0000fff2) // CHECK-NEXT: ('st_value', 0x00000010) // CHECK-NEXT: ('st_size', 0x00000028) + + .comm common5,4,4 + +// CHECK: # Symbol 0x00000008 +// CHECK-NEXT: (('st_name', 0x00000025) # 'common5' +// CHECK-NEXT: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000001) +// CHECK-NEXT: ('st_other', 0x00000000) +// CHECK-NEXT: ('st_shndx', 0x0000fff2) +// CHECK-NEXT: ('st_value', 0x00000004) +// CHECK-NEXT: ('st_size', 0x00000004) +// CHECK-NEXT: ),