There can be zero padding bytes at a section end for file alignment in PECOFF. Exclude those padding bytes when reading the section data.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM outside of the PE header check.
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | ||
---|---|---|
1035 | Can we use m_binary->getPEHeader() || m_binary->getPE32Header() here instead? We are technically ensuring that this is a linked (PE) binary rather than an object file. While a DOS header is present, it is not an absolute requirement (theoretically, it is practically never going to change). |
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | ||
---|---|---|
1035 | Done. |
Comment Actions
Hi, this is failing on swift-ci (runs on x86 bots) with the following error:
/Users/ec2-user/jenkins/workspace/oss-lldb-incremental-macos-cmake/build/Ninja-ReleaseAssert+stdlib-Release/lldb-macosx-x86_64/unittests/ObjectFile/PECOFF/./ObjectFilePECOFFTests --gtest_filter=SectionSizeTest.NoAlignmentPadding -- YAML:12:5: error: unknown key 'SizeOfRawData' SizeOfRawData: 512 ^~~~~~~~~~~~~ /Users/ec2-user/jenkins/workspace/oss-lldb-incremental-macos-cmake/llvm-project/lldb/unittests/ObjectFile/PECOFF/TestSectionSize.cpp:49: Failure Value of: llvm::detail::TakeExpected(ExpectedFile) Expected: succeeded Actual: failed (convertYAML() failed) /Users/ec2-user/jenkins/workspace/oss-lldb-incremental-macos-cmake/llvm-project/lldb/unittests/ObjectFile/PECOFF/TestSectionSize.cpp:49 Value of: llvm::detail::TakeExpected(ExpectedFile) Expected: succeeded Actual: failed (convertYAML() failed)
https://ci.swift.org/view/LLDB/job/oss-lldb-incremental-macos-cmake/
Could you take a look please?
Can we use m_binary->getPEHeader() || m_binary->getPE32Header() here instead? We are technically ensuring that this is a linked (PE) binary rather than an object file. While a DOS header is present, it is not an absolute requirement (theoretically, it is practically never going to change).