This is an archive of the discontinued LLVM Phabricator instance.

[XCOFF] change the decoding of External symbol's function auxiliary entry in XCOFF32 for llvm-readobj
ClosedPublic

Authored by DiggerLin on Oct 28 2022, 7:19 AM.

Details

Summary
  1. llvm-readobj decide whether to decode the external symbol's function auxiliary entry based on whether symbol is function or not currently. But the XCOFFSymbolRef::isFunction() do not work properly when -ffunction-sections is enabled. we will not decode the function auxiliary entry based on the XCOFFSymbolRef::isFunction()
  1. we will decode the function auxiliary entry based on following:

According to the https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__c0f91ad419jbau

In XCOFF32, there are only "one csect Auxiliary Entry" and "a function auxiliary symbol table entry" for the C_EXT, C_WEAKEXT, and C_HIDEXT Symbols. and By convention, the csect auxiliary entry in an XCOFF32 file must be the last auxiliary entry for any external symbol that has more than one auxiliary entry( that means for the C_EXT, C_WEAKEXT, and C_HIDEXT Symbols. if there more than one auxiliary Entries. we look the last one as csect auxiliary entry. and others auxiliary entries as function entries).

Diff Detail

Event Timeline

DiggerLin created this revision.Oct 28 2022, 7:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 7:19 AM
DiggerLin requested review of this revision.Oct 28 2022, 7:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2022, 7:19 AM
DiggerLin edited the summary of this revision. (Show Details)Oct 28 2022, 7:47 AM
llvm/test/tools/llvm-readobj/XCOFF/symbols-invalid.test
12–13

Minor: May want to re-number the cases.

llvm/tools/llvm-readobj/XCOFFDumper.cpp
625

I think we should have functional tests that demonstrate the new behaviour.

In the patch description, you've stated "In XCOFF32 ..." twice. Should one of them be "In XCOFF64"?

In the patch description, you've stated "In XCOFF32 ..." twice. Should one of them be "In XCOFF64"?

There is flag name "x_auxtype" in XCOFF64 to indicate the symbol auxiliary entry type(but XCOFF32 do not have the field.)

DiggerLin edited the summary of this revision. (Show Details)Nov 1 2022, 6:26 AM
DiggerLin marked 2 inline comments as done.Nov 1 2022, 6:44 AM
DiggerLin added inline comments.
llvm/tools/llvm-readobj/XCOFFDumper.cpp
625

I added symbol which has two function auxiliary and a Csect auxiliary entries in the tools/llvm-readobj/XCOFF/symbols.test

DiggerLin updated this revision to Diff 472283.Nov 1 2022, 6:48 AM
DiggerLin marked an inline comment as done.

address comment

llvm/test/tools/llvm-readobj/XCOFF/symbols-invalid.test
12–13

The temp file names are also numbered (should re-sync to match the case numbers).

DiggerLin updated this revision to Diff 472597.Nov 2 2022, 6:46 AM
DiggerLin marked an inline comment as done.

address comment.

llvm/test/tools/llvm-readobj/XCOFF/symbols-invalid.test
12–13

thanks

LGTM with comment.

llvm/test/tools/llvm-readobj/XCOFF/symbols.test
141 ↗(On Diff #472597)

One of the changes made in this patch is that the DT_FCN bit is not checked.

339 ↗(On Diff #472597)
This revision is now accepted and ready to land.Nov 2 2022, 3:22 PM