{
  "id": "embedded/linker-section-overlap-ram",
  "signature": "ld: section .data overlaps with .bss in region RAM",
  "signature_zh": "ld：段.data与段.bss在RAM区域发生重叠",
  "regex": "section .data overlaps with .bss in region RAM",
  "domain": "embedded",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The linker script has incorrect memory region definitions or section placement, causing the .data (initialized data) and .bss (zero-initialized data) sections to overlap in RAM, typically due to misaligned start addresses or insufficient region size.",
  "root_cause_type": "generic",
  "root_cause_zh": "链接脚本中内存区域定义或段放置错误，导致.data段（已初始化数据）与.bss段（零初始化数据）在RAM中重叠，通常由起始地址未对齐或区域大小不足引起。",
  "versions": [],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Simply increasing the RAM region size in the linker script without adjusting the section start addresses may shift the overlap but not resolve it.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removing the .bss section entirely (by setting all variables to initialized) is not a scalable solution and may cause other linker errors.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Edit the linker script (e.g., STM32FLASH.ld) to add explicit alignment between .data and .bss. Example: .data : { *(.data) } >RAM AT>FLASH . = ALIGN(4); .bss : { *(.bss) } >RAM",
      "success_rate": 0.95,
      "how": "Edit the linker script (e.g., STM32FLASH.ld) to add explicit alignment between .data and .bss. Example: .data : { *(.data) } >RAM AT>FLASH . = ALIGN(4); .bss : { *(.bss) } >RAM",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the --print-memory-usage and --print-map flags to inspect section placement, then adjust the RAM region length to accommodate both sections.",
      "success_rate": 0.88,
      "how": "Use the --print-memory-usage and --print-map flags to inspect section placement, then adjust the RAM region length to accommodate both sections.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Edit the linker script (e.g., STM32FLASH.ld) to add explicit alignment between .data and .bss. Example: .data : { *(.data) } >RAM AT>FLASH . = ALIGN(4); .bss : { *(.bss) } >RAM",
    "Use the --print-memory-usage and --print-map flags to inspect section placement, then adjust the RAM region length to accommodate both sections."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://sourceware.org/binutils/docs/ld/Scripts.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}