This is an archive of the discontinued LLVM Phabricator instance.

Use mcr for dmb instruction on armv6
ClosedPublic

Authored by raj.khem on Mar 24 2021, 10:49 AM.

Details

Summary

At present compiler-rt cross compiles for armv6 ( -march=armv6 ) but includes dmb instructions which are only available in armv7+ this causes SIGILL on clang+compiler-rt compiled components on rpi0w platforms.

Diff Detail

Event Timeline

raj.khem created this revision.Mar 24 2021, 10:49 AM
raj.khem requested review of this revision.Mar 24 2021, 10:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2021, 10:49 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
MaskRay added inline comments.
compiler-rt/lib/builtins/assembly.h
195

I see that musl src/thread/arm/atomics.s uses .arch armv6t2; mcr p15,0,r0,c7,c10,5

Is #elif __ARM_ARCH >= 6 accurate?

raj.khem added inline comments.Jun 14 2021, 12:39 AM
compiler-rt/lib/builtins/assembly.h
195

yes I think it is correct. Musl is using that directive for generating thumb2 code when -mthumb is used along with mcr barrier. mcr is available in both thumb/arm ISAs on ARMv6

Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 7:23 PM

@MaskRay can you help in moving this forward ?

MaskRay accepted this revision.Mar 10 2022, 7:25 PM
This revision is now accepted and ready to land.Mar 10 2022, 7:25 PM
This revision was landed with ongoing or failed builds.Mar 10 2022, 7:30 PM
This revision was automatically updated to reflect the committed changes.

I'm not sure this is right... even if dmb barriers do work, strex is only available in v7+ in Thumb mode, so I suspect this still causes a SIGILL on v6, whether or not Thumb2 is available.