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
This commit is contained in:
Rafael Espindola 2010-11-14 19:40:55 +00:00
parent 60d5b5fdee
commit 765fb1a446
2 changed files with 13 additions and 0 deletions

View File

@ -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) {

View File

@ -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: ),