This is an archive of the discontinued LLVM Phabricator instance.

[AIX][XCOFF] Generate undefined symbol in symbol table for external function call
ClosedPublic

Authored by jasonliu on Nov 19 2019, 7:42 AM.

Details

Summary

This patch sets up the infrastructure for

  1. Associate MCSymbolXCOFF with an MCSectionXCOFF when it could not get implicitly associated.
  2. Generate undefined symbols. The patch itself generates undefined symbol for external function call only. Generate undefined symbol for external global variable and external function descriptors will be handled in separate patch(s) after this is land.

Diff Detail

Event Timeline

jasonliu created this revision.Nov 19 2019, 7:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2019, 7:42 AM
daltenty added inline comments.Nov 19 2019, 2:20 PM
llvm/lib/MC/XCOFFObjectWriter.cpp
318

getContainingCsect() already has this assertion internally

jasonliu updated this revision to Diff 230268.Nov 20 2019, 8:01 AM

Removed unnecessary assertion.

jasonliu marked 2 inline comments as done.Nov 20 2019, 8:01 AM
jasonliu added inline comments.
llvm/lib/MC/XCOFFObjectWriter.cpp
318

You are right. Removed.

This revision is now accepted and ready to land.Nov 22 2019, 8:34 AM
This revision was automatically updated to reflect the committed changes.
jasonliu marked an inline comment as done.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
5338

Does it make sense to check the linkage on the function? What if it is weak?

Minor nits if the weak function case needs to be addressed anyway (probably at least a TODO).

llvm/lib/MC/XCOFFObjectWriter.cpp
577

s/symbol's/symbols'/;
or
Calculate indices for undefined symbols.

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
5334

Suggestion:
<ins>an </ins>undefined symbol need<ins>s</ins> to <ins>be </ins>associate<ins>d</ins> with

jasonliu marked 4 inline comments as done.Nov 26 2019, 8:13 AM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
5338

You are right. We would have a weak external referenced symbol in that case.
We will also need to do more work for weak function in the future though, for example, emit ".weak .foo" and so on.