summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-14 21:11:16 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-14 21:11:16 +0000
commita7d0bed3368b809ad47d7113cad82ca5c3a59957 (patch)
tree9b3cadc171d5f13c2962c18ebdb966e216702246 /llvm
parent0927edf815169c8cae86d2ff1a874ca223d1e392 (diff)
downloadbcm5719-llvm-a7d0bed3368b809ad47d7113cad82ca5c3a59957.tar.gz
bcm5719-llvm-a7d0bed3368b809ad47d7113cad82ca5c3a59957.zip
Fix another case of a .comm directive without a corresponding .type
directive. llvm-svn: 119073
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp3
-rw-r--r--llvm/test/MC/ELF/common.s21
2 files changed, 19 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index ba51f67f786..a2d94f5ba15 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -409,9 +409,10 @@ 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);
}
+ SetType(SD, ELF::STT_OBJECT);
+
if (GetBinding(SD) == ELF_STB_Local) {
const MCSection *Section = getAssembler().getContext().getELFSection(".bss",
MCSectionELF::SHT_NOBITS,
diff --git a/llvm/test/MC/ELF/common.s b/llvm/test/MC/ELF/common.s
index 96865befe38..0ffa6f45463 100644
--- a/llvm/test/MC/ELF/common.s
+++ b/llvm/test/MC/ELF/common.s
@@ -30,11 +30,24 @@
// CHECK-NEXT: ('st_value', 0x00000001)
// CHECK-NEXT: ('st_size', 0x00000001)
+ .local common6
+ .comm common6,8,16
+
+// CHECK: # Symbol 0x00000003
+// CHECK-NEXT: (('st_name', 0x00000011) # 'common6'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000003)
+// CHECK-NEXT: ('st_value', 0x00000010)
+// CHECK-NEXT: ('st_size', 0x00000008)
+// CHECK-NEXT: ),
+
// Test that without an explicit .local we produce a global.
.type common3,@object
.comm common3,4,4
-// CHECK: ('st_name', 0x00000011) # 'common3'
+// CHECK: ('st_name', 0x00000019) # 'common3'
// CHECK-NEXT: ('st_bind', 0x00000001)
// CHECK-NEXT: ('st_type', 0x00000001)
// CHECK-NEXT: ('st_other', 0x00000000)
@@ -54,7 +67,7 @@ foo:
.type common4,@object
.comm common4,40,16
-// CHECK: ('st_name', 0x0000001d) # 'common4'
+// CHECK: ('st_name', 0x00000025) # 'common4'
// CHECK-NEXT: ('st_bind', 0x00000001)
// CHECK-NEXT: ('st_type', 0x00000001)
// CHECK-NEXT: ('st_other', 0x00000000)
@@ -64,8 +77,8 @@ foo:
.comm common5,4,4
-// CHECK: # Symbol 0x00000008
-// CHECK-NEXT: (('st_name', 0x00000025) # 'common5'
+// CHECK: # Symbol 0x00000009
+// CHECK-NEXT: (('st_name', 0x0000002d) # 'common5'
// CHECK-NEXT: ('st_bind', 0x00000001)
// CHECK-NEXT: ('st_type', 0x00000001)
// CHECK-NEXT: ('st_other', 0x00000000)
OpenPOWER on IntegriCloud