[PATCH] D92163: [obj2yaml] - Don't assert when trying to calculate the expected section offset.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 27 04:45:41 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2090ff59422: [obj2yaml] - Don't assert when trying to calculate the expected section offset. (authored by grimar).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92163/new/
https://reviews.llvm.org/D92163
Files:
llvm/test/tools/obj2yaml/ELF/offset.yaml
llvm/tools/obj2yaml/elf2yaml.cpp
Index: llvm/tools/obj2yaml/elf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/elf2yaml.cpp
+++ llvm/tools/obj2yaml/elf2yaml.cpp
@@ -248,8 +248,8 @@
ELFYAML::Section &Sec = *cast<ELFYAML::Section>(C.get());
const typename ELFT::Shdr &SecHdr = S[Sec.OriginalSecNdx];
- ExpectedOffset =
- alignTo(ExpectedOffset, SecHdr.sh_addralign ? SecHdr.sh_addralign : 1);
+ ExpectedOffset = alignTo(ExpectedOffset,
+ SecHdr.sh_addralign ? SecHdr.sh_addralign : 1uLL);
// We only set the "Offset" field when it can't be naturally derived
// from the offset and size of the previous section. This reduces
Index: llvm/test/tools/obj2yaml/ELF/offset.yaml
===================================================================
--- llvm/test/tools/obj2yaml/ELF/offset.yaml
+++ llvm/test/tools/obj2yaml/ELF/offset.yaml
@@ -32,6 +32,10 @@
# BASIC-NEXT: Type: SHT_PROGBITS
# BASIC-NEXT: AddressAlign: 0x10
# BASIC-NEXT: Offset: 0x200
+# BASIC-NEXT: - Name: .bar4
+# BASIC-NEXT: Type: SHT_PROGBITS
+# BASIC-NEXT: AddressAlign: 0x100000000
+# BASIC-NEXT: Offset: 0x210
--- !ELF
FileHeader:
@@ -81,6 +85,12 @@
Type: SHT_PROGBITS
AddressAlign: 0x10
Offset: 0x200
+## A case where AddressAlign > MAX_UINT32 and (uint32_t)AddressAlign == 0.
+## Check we dump an offset in this case properly.
+ - Name: .bar4
+ Type: SHT_PROGBITS
+ AddressAlign: 0x100000000
+ Offset: 0x210
## Show we dump the "Offset" key for the first section when
## it has an unexpected file offset.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92163.308021.patch
Type: text/x-patch
Size: 1691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201127/bd9115cb/attachment.bin>
More information about the llvm-commits
mailing list