diff --git a/share/machdeps/machdep_avr_16.yaml b/share/machdeps/machdep_avr_16.yaml
index f5ee3f6c8487f9c21f3de15a75d7255d4ff617d8..055d78e85c3d33563175e3c2c5f2e8d3c2508b8a 100644
--- a/share/machdeps/machdep_avr_16.yaml
+++ b/share/machdeps/machdep_avr_16.yaml
@@ -16,6 +16,7 @@ cpp_arch_flags:
 - -target
 - avr
 - -m16
+- -mmcu=atmega16
 custom_defs: |
     #undef AVR
     #define AVR 1
@@ -33,6 +34,8 @@ custom_defs: |
     #define __ATOMIC_SEQ_CST 5
     #undef __AVR
     #define __AVR 1
+    #undef __AVR_ATmega16__
+    #define __AVR_ATmega16__ 1
     #undef __AVR__
     #define __AVR__ 1
     #undef __BIGGEST_ALIGNMENT__
@@ -645,6 +648,8 @@ custom_defs: |
     #define __clang_version__ "15.0.7 "
     #undef __clang_wide_literal_encoding__
     #define __clang_wide_literal_encoding__ "UTF-16"
+    #undef __flash
+    #define __flash __attribute__((address_space(1)))
     #undef __llvm__
     #define __llvm__ 1
 eof: (-1)
diff --git a/share/machdeps/machdep_avr_8.yaml b/share/machdeps/machdep_avr_8.yaml
index 9a9268a4d5590425281b29da80561ab9d037b8cd..cbaeb67bbd3b9626e1cba28f416efded67c9cd79 100644
--- a/share/machdeps/machdep_avr_8.yaml
+++ b/share/machdeps/machdep_avr_8.yaml
@@ -15,6 +15,7 @@ compiler: clang
 cpp_arch_flags:
 - -target
 - avr
+- -mmcu=atmega8
 custom_defs: |
     #undef AVR
     #define AVR 1
@@ -32,6 +33,8 @@ custom_defs: |
     #define __ATOMIC_SEQ_CST 5
     #undef __AVR
     #define __AVR 1
+    #undef __AVR_ATmega8__
+    #define __AVR_ATmega8__ 1
     #undef __AVR__
     #define __AVR__ 1
     #undef __BIGGEST_ALIGNMENT__
@@ -644,6 +647,8 @@ custom_defs: |
     #define __clang_version__ "15.0.7 "
     #undef __clang_wide_literal_encoding__
     #define __clang_wide_literal_encoding__ "UTF-16"
+    #undef __flash
+    #define __flash __attribute__((address_space(1)))
     #undef __llvm__
     #define __llvm__ 1
 eof: (-1)