This is an archive of the discontinued LLVM Phabricator instance.

Handle local commons for XCOFF object file writing
ClosedPublic

Authored by jasonliu on Aug 12 2019, 10:50 AM.

Details

Summary

Adds support for emitting common local global symbols to an XCOFF object file.
Local commons are emitted into the .bss section with a storage class of
C_HIDEXT.

Diff Detail

Repository
rL LLVM

Event Timeline

daltenty created this revision.Aug 12 2019, 10:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2019, 10:50 AM
hubert.reinterpretcast added inline comments.
llvm/lib/MC/XCOFFObjectWriter.cpp
238 ↗(On Diff #214666)

"CSect" would match how the function is named.

llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
5 ↗(On Diff #214666)

There should be a follow-up patch to this (dependent on D65240) that checks the symbol table entries.

15 ↗(On Diff #214666)

There is no matching RUN line.

llvm/lib/MC/XCOFFObjectWriter.cpp
238 ↗(On Diff #214666)

I guess it's "CSECT" now.

240 ↗(On Diff #214666)

There's no Add in the base patch anymore. This needs a rebase.

llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
5 ↗(On Diff #214666)

D65240 might land before this, in which case, this patch should be updated for the test changes.

jasonliu commandeered this revision.Aug 22 2019, 2:15 PM
jasonliu edited reviewers, added: daltenty; removed: jasonliu.

Moving forward this patch for David.

jasonliu updated this revision to Diff 216716.Aug 22 2019, 2:17 PM
jasonliu marked an inline comment as done.

Rebased the patch on master.

jasonliu marked 3 inline comments as done.Aug 22 2019, 2:17 PM
sfertile accepted this revision.Aug 26 2019, 6:36 AM

LGTM.

This revision is now accepted and ready to land.Aug 26 2019, 6:36 AM
This revision was automatically updated to reflect the committed changes.

Whereas commons cannot be placed into the same section, local commons can be. While it is true that there are no csect members defined in the symbol table for a csect for local commons, the separate label names are available in the assembly. In the object file, these are offsets from the csect. How references are done via the TOC is a matter of choice.