This is an archive of the discontinued LLVM Phabricator instance.

Object: Add support for bigobj
ClosedPublic

Authored by majnemer on Sep 9 2014, 12:37 AM.

Details

Summary

This adds support for reading the "bigobj" variant of COFF produced by
cl's /bigobj and mingw's -mbig-obj.

The most significant difference that bigobj brings is more than 2**16
sections to COFF.

bigobj brings a few interesting differences with it:

  • It doesn't have a Characteristics field in the file header.
  • It doesn't have a SizeOfOptionalHeader field in the file header (it's only used in executable files).
  • Auxiliary symbol records have the same width as a symbol table entry. Since symbol table entries are bigger, so are auxiliary symbol records.

Write support will come soon.

Diff Detail

Repository
rL LLVM

Event Timeline

majnemer updated this revision to Diff 13444.Sep 9 2014, 12:37 AM
majnemer retitled this revision from to Object: Add support for bigobj.
majnemer updated this object.
majnemer added reviewers: rafael, Bigcheese, ruiu.
majnemer added a subscriber: Unknown Object (MLST).
ruiu added inline comments.Sep 9 2014, 1:06 PM
include/llvm/Object/COFF.h
72–73 ↗(On Diff #13444)

We have ulittle8_t and even ubig8_t? That made me think of the definition of endianness for a brief moment. It's weird at least.

231 ↗(On Diff #13444)

Why do you need to cast only CS16?

248 ↗(On Diff #13444)

This needs a comment saying that the reserved section numbers are returned as negative numbers.

427 ↗(On Diff #13444)

Do we still need this? Looks like we can now just use <=0.

majnemer updated this revision to Diff 13494.Sep 9 2014, 1:59 PM
  • Address review comments.
majnemer added inline comments.Sep 9 2014, 2:01 PM
include/llvm/Object/COFF.h
72–73 ↗(On Diff #13444)

Done.

231 ↗(On Diff #13444)

The right hand side will implicitly convert to const void * as well.

The cast is needed because the ternary operator will otherwise be unable to convert both arms of the expression to a common type.

248 ↗(On Diff #13444)

Done.

427 ↗(On Diff #13444)

Done.

ruiu accepted this revision.Sep 9 2014, 2:55 PM
ruiu edited edge metadata.

LGTM with this nit.

include/llvm/Object/COFF.h
248 ↗(On Diff #13444)

Where did you add a comment?

This revision is now accepted and ready to land.Sep 9 2014, 2:55 PM
ruiu added a comment.Sep 9 2014, 3:15 PM

I was looking at the old file. LGTM.

majnemer closed this revision.Sep 10 2014, 6:01 AM
majnemer updated this revision to Diff 13537.

Closed by commit rL217496 (authored by @majnemer).