OUTPUT_FORMAT("binary") ENTRY(entry) SECTIONS { /* use ld -Ttext=nnn ... to set starting virtual address */ .text : { g_code = .; _g_code = .; /* symbols to mark start of section */ /* code */ *(.text*) /* wildcard for "gcc -ffunction-sections" */ *(.gnu.linkonce.t.*) /* C++ templates? */ *(.rodata*) /* read-only data (ELF only) */ *(.gnu.linkonce.r.*) /* C++ static constructors and destructors */ start_ctors = .; *(SORT(.ctor*)) end_ctors = .; /* accessed from asm code only... */ start_dtors = .; /* ...so no leading underscore */ *(SORT(.dtor*)) end_dtors = .; . = ALIGN(4096); } .data : { g_data = .; _g_data = .; /* data */ *(.data*) /* wildcard for "gcc -fdata-sections" */ *(.gnu.linkonce.d.*) . = ALIGN(4096); } .bss : { g_bss = .; _g_bss = .; /* BSS */ *(.bss*) /* wildcard for "gcc -fdata-sections" */ *(.gnu.linkonce.b.*) *(COMMON) /* "common" variables */ . = ALIGN(4096); } g_end = .; _g_end = .; /* MinGW debug sections Omit these and you may get an invalid executable file */ .stab : { *(.stab) } .stabstr : { *(.stabstr) } }