[clang] [llvm] [AVR] Handle flash RO data mapped to data space for newer devices (PR #146244)

Patryk Wychowaniec via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 06:43:39 PDT 2025


================
@@ -263,11 +263,17 @@ bool AVRAsmPrinter::doFinalization(Module &M) {
     auto *Section = cast<MCSectionELF>(TLOF.SectionForGlobal(&GO, TM));
     if (Section->getName().starts_with(".data"))
       NeedsCopyData = true;
-    else if (Section->getName().starts_with(".rodata") && SubTM->hasLPM())
+    else if (Section->getName().starts_with(".rodata") && SubTM->hasLPM()) {
       // AVRs that have a separate program memory (that's most AVRs) store
-      // .rodata sections in RAM.
-      NeedsCopyData = true;
-    else if (Section->getName().starts_with(".bss"))
+      // .rodata sections in RAM,
+      // but XMEGA3 family maps all flash in the data space.
----------------
Patryk27 wrote:

Does it actually map the entire flash or just this 32 kb segment?

If it's just this segment that's mapped, is it assumed that we should never copy anything to RAM because the flash will just remap stuff during runtime?

https://github.com/llvm/llvm-project/pull/146244


More information about the llvm-commits mailing list