Skip to content

Commit d3e13b5

Browse files
committed
ELFObjectWriter: Don't de-duplicate STT_FILE symbols
1 parent 0929464 commit d3e13b5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

llvm/include/llvm/MC/MCAssembler.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,6 @@ class MCAssembler {
450450
}
451451

452452
void addFileName(StringRef FileName) {
453-
for (const std::pair<std::string, size_t> &F : FileNames)
454-
if (F.first == FileName)
455-
return;
456453
FileNames.emplace_back(std::string(FileName), Symbols.size());
457454
}
458455

llvm/lib/MC/ELFObjectWriter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ void ELFWriter::computeSymbolTable(
725725
StrTabBuilder.finalize();
726726

727727
// Symbols are required to be in lexicographic order.
728-
//array_pod_sort(LocalSymbolData.begin(), LocalSymbolData.end());
729728
array_pod_sort(ExternalSymbolData.begin(), ExternalSymbolData.end());
730729

731730
// Make the first STT_FILE precede previous local symbols.

llvm/test/MC/ELF/file.s

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
# CHECK-NEXT: 7: 0000000000000000 0 NOTYPE LOCAL DEFAULT 6 local1
1111
# CHECK-NEXT: 8: 0000000000000000 0 SECTION LOCAL DEFAULT 8 bar1
1212
# CHECK-NEXT: 9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 8 local2
13-
# CHECK-NEXT: 10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 6 bar.c
14-
# CHECK-NEXT: 11: 0000000000000008 0 NOTYPE GLOBAL DEFAULT 2 foo.c
13+
# CHECK-NEXT: 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS bar.c
14+
# CHECK-NEXT: 11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 6 bar.c
15+
# CHECK-NEXT: 12: 0000000000000008 0 NOTYPE GLOBAL DEFAULT 2 foo.c
1516

1617
.quad .text
1718

@@ -34,3 +35,6 @@ local1:
3435
.section bar1,"a"
3536
local2:
3637
.quad bar1
38+
39+
## STT_FILE symbols of the same name are not de-duplicated.
40+
.file "bar.c"

0 commit comments

Comments
 (0)