Fixed debug_aranges handling for common symbols.
The size of common symbols is now tracked correctly, so they can be listed in the arange section without needing knowledge of other following symbols.
.comm (and .lcomm) do not indicate to the system assembler any particular section to use, so we have to treat them as having no section.
Test case update to account for this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191210 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index e57025e..80b0ace 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -533,8 +533,8 @@
void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
- const MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
- AssignSection(Symbol, Section);
+ // Common symbols do not belong to any actual section.
+ AssignSection(Symbol, NULL);
OS << "\t.comm\t" << *Symbol << ',' << Size;
if (ByteAlignment != 0) {
@@ -552,8 +552,8 @@
/// @param Size - The size of the common symbol.
void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlign) {
- const MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
- AssignSection(Symbol, Section);
+ // Common symbols do not belong to any actual section.
+ AssignSection(Symbol, NULL);
OS << "\t.lcomm\t" << *Symbol << ',' << Size;
if (ByteAlign > 1) {