forked from OSchip/llvm-project
[lld][WebAssembly] Don't emit names for data segments that we omit
Followup to https://reviews.llvm.org/D92909 Differential Revision: https://reviews.llvm.org/D92997
This commit is contained in:
parent
d6f5e08199
commit
d8ed639a6a
|
@ -41,3 +41,5 @@ b:
|
|||
# CHECK-NEXT: - Name: __data_end
|
||||
# CHECK-NEXT: Kind: GLOBAL
|
||||
# CHECK-NEXT: Index: 1
|
||||
|
||||
# CHECK-NOT: DataSegmentNames:
|
||||
|
|
|
@ -566,7 +566,7 @@ unsigned NameSection::numNamedDataSegments() const {
|
|||
unsigned numNames = 0;
|
||||
|
||||
for (const OutputSegment *s : segments)
|
||||
if (!s->name.empty())
|
||||
if (!s->name.empty() && !s->isBss)
|
||||
++numNames;
|
||||
|
||||
return numNames;
|
||||
|
@ -636,8 +636,10 @@ void NameSection::writeBody() {
|
|||
writeUleb128(sub.os, count, "name count");
|
||||
|
||||
for (OutputSegment *s : segments) {
|
||||
writeUleb128(sub.os, s->index, "global index");
|
||||
writeStr(sub.os, s->name, "segment name");
|
||||
if (!s->name.empty() && !s->isBss) {
|
||||
writeUleb128(sub.os, s->index, "global index");
|
||||
writeStr(sub.os, s->name, "segment name");
|
||||
}
|
||||
}
|
||||
|
||||
sub.writeTo(bodyOutputStream);
|
||||
|
|
Loading…
Reference in New Issue