{
  "id": "embedded/arm-gcc-section-overlap-in-ram",
  "signature": "arm-none-eabi-ld: section .data VMA 0x20000000 overlaps section .bss VMA 0x20000000 in region RAM",
  "signature_zh": "arm-none-eabi-ld：段 .data 的 VMA 0x20000000 与段 .bss 的 VMA 0x20000000 在 RAM 区域重叠",
  "regex": "arm-none-eabi-ld: section \\.(data|bss) VMA 0x[0-9A-F]+ overlaps section \\.(data|bss) VMA 0x[0-9A-F]+ in region RAM",
  "domain": "embedded",
  "category": "build_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "链接脚本在 RAM 区域中为 .data 和 .bss 段定义了重叠的虚拟内存地址，通常是由于 LMA/VMA 对齐错误或缺少段填充。",
  "versions": [
    {
      "version": "ARM GCC 12.3.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "GNU ld 2.40",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "STM32CubeIDE 1.14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase RAM size in linker script (e.g., change RAM length from 64K to 128K)",
      "why_fails": "Overlap is due to address assignment, not insufficient total RAM; increasing size does not separate overlapping addresses.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Move all variables to .data section by removing __attribute__((section(\".bss\")))",
      "why_fails": "This may shift the problem but not resolve the underlying VMA collision; .data and .bss still share same base address.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "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.",
      "success_rate": 0.95,
      "how": "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.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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.",
      "success_rate": 0.9,
      "how": "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.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "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.",
    "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."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://gcc.gnu.org/onlinedocs/gcc-12.3.0/gnu_lnk.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-11-08",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}