[clang] [clang][mlibc] Predefine `__mlibc__` for mlibc targets (PR #225654)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 02:27:19 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: lzcnt (lzcunt)
<details>
<summary>Changes</summary>
Pretty much all users of mlibc targets currently vendor this or similar patches and having it upstream would be useful.
---
Full diff: https://github.com/llvm/llvm-project/pull/225654.diff
1 Files Affected:
- (modified) clang/lib/Basic/Targets/OSTargets.h (+3)
``````````diff
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index fb5c17cefc004..36354668de69c 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -396,6 +396,9 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo<Target> {
} else {
Builder.defineMacro("__gnu_linux__");
}
+ if (Triple.getEnvironmentName() == "mlibc") {
+ Builder.defineMacro("__mlibc__");
+ }
if (Opts.POSIXThreads)
Builder.defineMacro("_REENTRANT");
if (Opts.CPlusPlus)
``````````
</details>
https://github.com/llvm/llvm-project/pull/225654
More information about the cfe-commits
mailing list