================
@@ -29,6 +29,14 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
Builder.defineMacro("__bpf__");
Builder.defineMacro("__BPF__");
+
+ std::string CPU = getTargetOpts().CPU;
+ if (CPU == "probe")
+ Builder.defineMacro("__bpf_cpu_version__", "0");
+ else if (CPU.empty() || CPU == "generic")
+ Builder.defineMacro("__bpf_cpu_version__", "1");
+ else
+ Builder.defineMacro("__bpf_cpu_version__", CPU.substr(1));
----------------
yonghong-song wrote:
Okay, during coding, I feel that I don't really like __BPF_CPU_VERSION. I would
prefer either BPF_CPU_VERSION or __BPF_CPU_VERSION__. I will tentatively use
BPF_CPU_VERSION for now.
https://github.com/llvm/llvm-project/pull/71856
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits