[clang] [compiler-rt] [lld] [llvm] ARM and Thumb support for GCC-compatible static-base PIC data addressing with `-mno-pic-data-is-text-relative`. (PR #239188)

Peter Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 30 03:39:13 PST 2026


================
@@ -1409,6 +1409,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
       Builder.defineMacro("__PIE__", Twine(PICLevel));
       Builder.defineMacro("__pie__", Twine(PICLevel));
     }
+    if ((TI.getTriple().isARM() || TI.getTriple().isThumb()) &&
----------------
smithp35 wrote:

GCC doesn't have an equivalent macro for this feature.

I think there could be an argument for a feature flag that could be tested for by `__has_feature()` if there was a prospect of lots of assembly code being built for this and standard PIC. However I don't think we have justificiation for this yet. For example, if I have to write a dynamic-loader to get a PIC bare-metal program to work then that is already quite a wide-diversion from shared boot up code.

Suggest separating out into a separate patch and a feature flag investigated.


https://github.com/llvm/llvm-project/pull/239188


More information about the cfe-commits mailing list