[lld] d49270b - [lld][ELF] Removing redundant cast. NFC.
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 28 18:22:00 PST 2021
Author: Sam Clegg
Date: 2021-02-28T16:53:41-08:00
New Revision: d49270b087e85191057925ce00c19378caeee5b2
URL: https://github.com/llvm/llvm-project/commit/d49270b087e85191057925ce00c19378caeee5b2
DIFF: https://github.com/llvm/llvm-project/commit/d49270b087e85191057925ce00c19378caeee5b2.diff
LOG: [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
Added:
Modified:
lld/ELF/InputSection.cpp
lld/test/ELF/merge-string.s
Removed:
################################################################################
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 6f16fc7abc48..0ee1b0885d66 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1429,8 +1429,7 @@ SectionPiece *MergeInputSection::getSectionPiece(uint64_t offset) {
uint64_t MergeInputSection::getParentOffset(uint64_t offset) const {
// If Offset is not at beginning of a section piece, it is not in the map.
// In that case we need to search from the original section piece vector.
- const SectionPiece &piece =
- *(const_cast<MergeInputSection *>(this)->getSectionPiece (offset));
+ const SectionPiece &piece = *getSectionPiece(offset);
uint64_t addend = offset - piece.inputOff;
return piece.outputOff + addend;
}
diff --git a/lld/test/ELF/merge-string.s b/lld/test/ELF/merge-string.s
index ac8f1d4b206e..0922cd8f135e 100644
--- a/lld/test/ELF/merge-string.s
+++ b/lld/test/ELF/merge-string.s
@@ -7,16 +7,16 @@
// RUN: ld.lld -O 0 %t.o -o %t.so -shared
// RUN: llvm-readobj -S --section-data --symbols %t.so | FileCheck --check-prefix=NOMERGE %s
- .section .rodata1,"aMS", at progbits,1
- .asciz "abc"
+ .section .rodata1,"aMS", at progbits,1
+ .asciz "abc"
foo:
- .ascii "a"
+ .ascii "a"
bar:
.asciz "bc"
.asciz "bc"
.section .rodata2,"aMS", at progbits,2
- .align 2
+ .p2align 1
zed:
.short 20
.short 0
More information about the llvm-commits
mailing list