diff --git a/clang/lib/Basic/Targets/AVR.cpp b/clang/lib/Basic/Targets/AVR.cpp --- a/clang/lib/Basic/Targets/AVR.cpp +++ b/clang/lib/Basic/Targets/AVR.cpp @@ -300,6 +300,7 @@ Builder.defineMacro("AVR"); Builder.defineMacro("__AVR"); Builder.defineMacro("__AVR__"); + Builder.defineMacro("__ELF__"); if (!this->CPU.empty()) { auto It = llvm::find_if( diff --git a/clang/test/CodeGen/avr/target-cpu-defines/atmega328p.c b/clang/test/CodeGen/avr/target-cpu-defines/atmega328p.c --- a/clang/test/CodeGen/avr/target-cpu-defines/atmega328p.c +++ b/clang/test/CodeGen/avr/target-cpu-defines/atmega328p.c @@ -5,3 +5,4 @@ // CHECK: #define __AVR 1 // CHECK: #define __AVR_ATmega328P__ 1 // CHECK: #define __AVR__ 1 +// CHECK: #define __ELF__ 1 diff --git a/clang/test/CodeGen/avr/target-cpu-defines/attiny104.c b/clang/test/CodeGen/avr/target-cpu-defines/attiny104.c --- a/clang/test/CodeGen/avr/target-cpu-defines/attiny104.c +++ b/clang/test/CodeGen/avr/target-cpu-defines/attiny104.c @@ -5,3 +5,4 @@ // CHECK: #define __AVR 1 // CHECK: #define __AVR_ATtiny104__ 1 // CHECK: #define __AVR__ 1 +// CHECK: #define __ELF__ 1 diff --git a/clang/test/CodeGen/avr/target-cpu-defines/common.c b/clang/test/CodeGen/avr/target-cpu-defines/common.c --- a/clang/test/CodeGen/avr/target-cpu-defines/common.c +++ b/clang/test/CodeGen/avr/target-cpu-defines/common.c @@ -4,3 +4,4 @@ // CHECK: #define AVR 1 // CHECK: #define __AVR 1 // CHECK: #define __AVR__ 1 +// CHECK: #define __ELF__ 1