<div>Hi everyone,</div><br><div>tl;dr: gcc defines __thumb2__ in ARMv7 and clang doesn't. Is that a bug? Is there another way to check if thumb2 is supported by the compiler?</div><br><div>~</div><br><div>I recently started to work with Webkit in ARMv7 and decided to give clang a try building the javascript engine (JSC) used by webkit, mostly because of those sweet sanitizers.</div><br><div>However, it turns out the JIT was always disabled because of a cmake script that checks if the compiler defines either thumb2 or __thumb2__:</div><br><div><a href="https://github.com/WebKit/WebKit/blob/363701084a50c009bec41164cdb843df66d769d1/Source/cmake/OptionsCommon.cmake#L31" title="https://github.com/WebKit/WebKit/blob/363701084a50c009bec41164cdb843df66d769d1/Source/cmake/OptionsCommon.cmake#L31">https://github.com/WebKit/WebKit/blob/363701084a50c009bec41164cdb843df66d769d1/Source/cmake/OptionsCommon.cmake#L31</a><br></div><div>I've tested with some other versions of clang but none seem to define it: <a href="https://godbolt.org/z/WjGh3eTzv" title="https://godbolt.org/z/WjGh3eTzv">https://godbolt.org/z/WjGh3eTzv</a></div><br><div>While __thumb2__ is defined in gcc:</div><br><div>$ gcc -dM -E  main.c  | grep thumb</div><div>#define __thumb2__ 1</div><div>#define __thumb__ 1</div><br><div>clang doesn't define __thumb__ nor __thumb2__.</div><br><div>I managed to get clang with __thumb2__ defined by:</div><div>1. Changing the triplet<span data-emoji-typing="true">:</span> I eventually got a lot of compilation errors and gave up.</div><div>2. Added "-D__thumb__=1" to CMAKE_CXX_FLAGS :<span data-emoji-typing="true">P</span> and managed to fully build JSC. There were some regressions in a place I was investigating a bug but not major.</div><br><div>Anyway, I guess my questions are:</div><div>1. Is there a reason why __thumb2__ isn't defined in clang? Do we want it to be defined in clang?</div><div>2. Should we change it to checking if "__ARM_ARCH_ISA_THUMB" is 2 as per [0]?</div><br><div>Thanks in advance.</div><div>Mikhail.</div><br><div>[0] <a href="https://github.com/llvm/llvm-project/blob/8ee55ab6c06ec9f769f1086e3761c92286d56339/clang/lib/Basic/Targets/ARM.cpp#L709" title="https://github.com/llvm/llvm-project/blob/8ee55ab6c06ec9f769f1086e3761c92286d56339/clang/lib/Basic/Targets/ARM.cpp#L709">https://github.com/llvm/llvm-project/blob/8ee55ab6c06ec9f769f1086e3761c92286d56339/clang/lib/Basic/Targets/ARM.cpp#L709</a><br></div>