Index: lib/Basic/Targets/BPF.cpp =================================================================== --- lib/Basic/Targets/BPF.cpp +++ lib/Basic/Targets/BPF.cpp @@ -20,7 +20,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { - DefineStd(Builder, "bpf", Opts); + Builder.defineMacro("__bpf__"); Builder.defineMacro("__BPF__"); } Index: test/Preprocessor/bpf-predefined-macros.c =================================================================== --- /dev/null +++ test/Preprocessor/bpf-predefined-macros.c @@ -0,0 +1,16 @@ +// RUN: %clang -E -target bpfel -x c -o - %s | FileCheck %s +// RUN: %clang -E -target bpfeb -x c -o - %s | FileCheck %s + +#ifdef __bpf__ +int b; +#endif +#ifdef __BPF__ +int c; +#endif +#ifdef bpf +int d; +#endif + +// CHECK: int b; +// CHECK: int c; +// CHECK-NOT: int d;