This is an archive of the discontinued LLVM Phabricator instance.

implement printing out raw section data of xcoff objectfile for llvm-objdump
ClosedPublic

Authored by DiggerLin on Nov 14 2019, 10:21 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

DiggerLin created this revision.Nov 14 2019, 10:21 AM
sfertile accepted this revision.Nov 18 2019, 7:25 AM

LGTM. A minor suggestion: we could use a test where one of the virtual sections, say .bss is larger then the object file. Similar to X86/elf-disassemble-bss.test.

This revision is now accepted and ready to land.Nov 18 2019, 7:25 AM
This revision was automatically updated to reflect the committed changes.

I have fixed the problem.
by adding "; REQUIRES: powerpc-registered-target" into the test case.

aganea added a subscriber: aganea.Nov 19 2019, 12:16 PM
aganea added inline comments.
llvm/lib/Object/XCOFFObjectFile.cpp
273

This also fails on Windows/MSVC with:

D:\llvm-project\llvm\lib\Object\XCOFFObjectFile.cpp(273): error C2446: ':': no conversion from 'const llvm::support::ubig32_t' to 'const llvm::support::big64_t'
D:\llvm-project\llvm\lib\Object\XCOFFObjectFile.cpp(273): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\llvm-project\llvm\lib\Object\XCOFFObjectFile.cpp(271): error C2789: 'OffsetToRaw': an object of const-qualified type must be initialized
D:\llvm-project\llvm\lib\Object\XCOFFObjectFile.cpp(271): note: see declaration of 'OffsetToRaw'

Casting both FileOffsetToRawData to uint64_t fixes the problem.

DiggerLin marked an inline comment as done.Nov 19 2019, 4:36 PM
DiggerLin added inline comments.
llvm/lib/Object/XCOFFObjectFile.cpp
273

I think this is bug of CMVC compiler, I use gcc to compiler it , it success.
I have changed the code to

if (is64Bit())
  OffsetToRaw = toSection64(Sec)->FileOffsetToRawData;
else
  OffsetToRaw = toSection32(Sec)->FileOffsetToRawData;