Skip to content

Commit d49270b

Browse files
committed
[lld][ELF] Removing redundant cast. NFC.
Also a couple of minor cleanups in merge-string.s: - fix inconsistent use of tabs - use `.p2align` rather than `.align` since `.p2align` works the same on all platforms (the meaning of align seems to differ between platforms according to `AlignmentIsInBytes`. I noticed these potential cleanups while porting SHF_STRINGS support to wasm-ld. Differential Revision: https://reviews.llvm.org/D97647
1 parent 40cee38 commit d49270b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lld/ELF/InputSection.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,8 +1429,7 @@ SectionPiece *MergeInputSection::getSectionPiece(uint64_t offset) {
14291429
uint64_t MergeInputSection::getParentOffset(uint64_t offset) const {
14301430
// If Offset is not at beginning of a section piece, it is not in the map.
14311431
// In that case we need to search from the original section piece vector.
1432-
const SectionPiece &piece =
1433-
*(const_cast<MergeInputSection *>(this)->getSectionPiece (offset));
1432+
const SectionPiece &piece = *getSectionPiece(offset);
14341433
uint64_t addend = offset - piece.inputOff;
14351434
return piece.outputOff + addend;
14361435
}

lld/test/ELF/merge-string.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
// RUN: ld.lld -O 0 %t.o -o %t.so -shared
88
// RUN: llvm-readobj -S --section-data --symbols %t.so | FileCheck --check-prefix=NOMERGE %s
99

10-
.section .rodata1,"aMS",@progbits,1
11-
.asciz "abc"
10+
.section .rodata1,"aMS",@progbits,1
11+
.asciz "abc"
1212
foo:
13-
.ascii "a"
13+
.ascii "a"
1414
bar:
1515
.asciz "bc"
1616
.asciz "bc"
1717

1818
.section .rodata2,"aMS",@progbits,2
19-
.align 2
19+
.p2align 1
2020
zed:
2121
.short 20
2222
.short 0

0 commit comments

Comments
 (0)