Page MenuHomePhabricator

[Builtins] ARM: Fix assembling files in thumb mode.

Authored by manojgupta on Sep 25 2017, 12:32 AM.



clang does not assemble files in thumb mode unless .thumb declaration
is present. Add .thumb/.arm decl to _FUNCTION macros to ensure that
files are assembled correctly.

Fixes PR 34715.

Event Timeline

manojgupta created this revision.Sep 25 2017, 12:32 AM
manojgupta added inline comments.Sep 25 2017, 12:37 AM
54–56 ↗(On Diff #116496)

Please review this change and the one below since I am not much of an ARM assembly expert.

27 ↗(On Diff #116496)

This was the only function I found without a .p2align. Please let me know if this change is not required.

peter.smith edited edge metadata.Sep 25 2017, 12:50 PM

Apologies for being a pain, could you split the changes into their own review, even if they depend on each other? It will be easier to review, and to commit each one separately.

54–56 ↗(On Diff #116496)

I think that this would be better split out into a separate patch, potentially dependent on this one.

I think that you don't need an extra case for Thumb2. ARM_ARCH_7M and ARM_ARCH_7EM only support Thumb 2 so I think all you need to do is replace that condition with USE_THUMB2.

Apologies I've not got an assembler at hand to check.

27 ↗(On Diff #116496)

Arm functions need to be 4-byte aligned, Thumb functions 2-byte aligned. We might be able to move this to be part of DEFINE_COMPILERRT_FUNCTION so that it can be set to 2 or 4. Having it set to 4 as you suggest is probably good enough for now.

Thanks Peter,
I'll split out msr & .p2align into separate patches.

54–56 ↗(On Diff #116496)

I can't build in thumb without this change since clang complains about the illegal operand to msr instruction. But agree that this should be a separate patch.

manojgupta edited the summary of this revision. (Show Details)

Removed assembly file changes. They are moved to their own separate reviews.

compnerd accepted this revision.Sep 26 2017, 6:42 PM
This revision is now accepted and ready to land.Sep 26 2017, 6:42 PM
manojgupta closed this revision.Sep 27 2017, 2:34 AM