This is an archive of the discontinued LLVM Phabricator instance.

[AsmParser][ARM] Make .thumb_func imply .thumb
ClosedPublic

Authored by LemonBoy on May 5 2021, 11:55 PM.

Details

Summary

GNU as documentation states that a .thumb_func directive implies .thumb, teach the asm parser to switch mode whenever it's encountered. On the other hand the labeled form, exclusive to Apple's toolchain, doesn't switch mode at all.

Diff Detail

Event Timeline

LemonBoy created this revision.May 5 2021, 11:55 PM
LemonBoy requested review of this revision.May 5 2021, 11:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2021, 11:55 PM
LemonBoy added inline comments.May 5 2021, 11:57 PM
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
11152

For reference the cctools implementation of this directive can be found here, function s_thumb_func.

LemonBoy updated this revision to Diff 343331.May 6 2021, 2:28 AM

Fix LLD test.

nickdesaulniers accepted this revision.May 6 2021, 10:23 AM

Seems to match how GAS behaves. Thanks for the patch.

This revision is now accepted and ready to land.May 6 2021, 10:23 AM
peter.smith accepted this revision.May 7 2021, 2:31 AM

LGTM too.

Could I trouble you to add a test case for something like:

        .text
        .arm
        .thumb_func
        nop
sym:
        bx lr

This just makes sure we get the nop before sym in Thumb state even though the symbol doesn't start immediately after the thumb_func.

LGTM too.

Could I trouble you to add a test case for something like:

        .text
        .arm
        .thumb_func
        nop
sym:
        bx lr

This just makes sure we get the nop before sym in Thumb state even though the symbol doesn't start immediately after the thumb_func.

No problem, done!

This revision was automatically updated to reflect the committed changes.