# arm-none-eabi-ld: section .data VMA 0x20000000 overlaps section .bss VMA 0x20000000 in region RAM

- **ID:** `embedded/arm-gcc-section-overlap-in-ram`
- **Domain:** embedded
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Linker script defines .data and .bss sections with overlapping virtual memory addresses in RAM region, typically due to incorrect LMA/VMA alignment or missing section padding.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ARM GCC 12.3.1 | active | — | — |
| GNU ld 2.40 | active | — | — |
| STM32CubeIDE 1.14.0 | active | — | — |

## Workarounds

1. **Edit linker script (.ld file) to add explicit alignment and gap between .data and .bss sections: . = ALIGN(4); .data : { *(.data) } >RAM AT>FLASH; . = ALIGN(4); .bss : { *(.bss) } >RAM; Ensure .bss VMA starts after .data end address, e.g., .bss VMA = .data VMA + SIZEOF(.data) + 4.** (95% success)
   ```
   Edit linker script (.ld file) to add explicit alignment and gap between .data and .bss sections: . = ALIGN(4); .data : { *(.data) } >RAM AT>FLASH; . = ALIGN(4); .bss : { *(.bss) } >RAM; Ensure .bss VMA starts after .data end address, e.g., .bss VMA = .data VMA + SIZEOF(.data) + 4.
   ```
2. **Use the linker script's built-in PROVIDE and ASSERT to detect overlap at build time: add ASSERT(SIZEOF(.data) + SIZEOF(.bss) <= LENGTH(RAM), "RAM overflow"); in the script.** (90% success)
   ```
   Use the linker script's built-in PROVIDE and ASSERT to detect overlap at build time: add ASSERT(SIZEOF(.data) + SIZEOF(.bss) <= LENGTH(RAM), "RAM overflow"); in the script.
   ```

## Dead Ends

- **Increase RAM size in linker script (e.g., change RAM length from 64K to 128K)** — Overlap is due to address assignment, not insufficient total RAM; increasing size does not separate overlapping addresses. (90% fail)
- **Move all variables to .data section by removing __attribute__((section(".bss")))** — This may shift the problem but not resolve the underlying VMA collision; .data and .bss still share same base address. (80% fail)
