This is an archive of the discontinued LLVM Phabricator instance.

[PPC32] Parse bl __tls_get_addr(x@tlsgd)@plt+32768
ClosedPublic

Authored by MaskRay on Jun 17 2023, 2:43 PM.

Details

Summary

PPC32 -fpic/-fPIC generates bl __tls_get_addr(x@tlsgd)@PLT or
bl __tls_get_addr(x@tlsgd)@PLT+32768.
powerpc-linux-gnu-gcc -fPIC generates bl __tls_get_addr+32668(x@tlsgd)@plt.

These expressions can be parsed by GNU assembler but not by the integrated
assembler. Add the support.

Diff Detail

Event Timeline

MaskRay created this revision.Jun 17 2023, 2:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2023, 2:43 PM
MaskRay requested review of this revision.Jun 17 2023, 2:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2023, 2:43 PM
MaskRay edited the summary of this revision. (Show Details)Jun 17 2023, 2:44 PM
MaskRay updated this revision to Diff 532427.Jun 17 2023, 2:55 PM

Move E = Parser.getTok().getLoc(); early, though I believe there is no real behavior difference.

lkail added reviewers: Esme, shchenz.
brad added a comment.Jul 30 2023, 4:18 PM

Not my area, but this looks good for IAS.

Not my area, but this looks good for IAS.

Yes, and clang --target=powerpc -save-temps ... uses the integrated assembler to read Clang emitted assembly, which will work with this patch.

nemanjai accepted this revision.Aug 6 2023, 11:40 PM

I think the code could be clarified a bit with some additional comments, but otherwise LGTM.

llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
1568–1592

Perhaps this should be bl __tls_get_addr[+a](x@tlsgd)@plt[+b] to make it clear that we may be parsing an addend after __tls_get_addr as well as one after @plt.

1587

And here, perhaps a comment that this adds __tls_get_addr with a|b|a+b.

This revision is now accepted and ready to land.Aug 6 2023, 11:40 PM
MaskRay updated this revision to Diff 548038.Aug 7 2023, 7:42 PM
MaskRay marked 2 inline comments as done.

thanks for the review!

add more comments

This revision was landed with ongoing or failed builds.Aug 7 2023, 7:45 PM
This revision was automatically updated to reflect the committed changes.