diff --git a/tools/tcc/linkerscript/a.out.lds b/tools/tcc/linkerscript/a.out.lds index a7f7f41a8ab71811ca15264f2e099295c743bdeb..9d430566b45872b6a97193c39a3f6f35d1ae9601 100644 --- a/tools/tcc/linkerscript/a.out.lds +++ b/tools/tcc/linkerscript/a.out.lds @@ -5,28 +5,33 @@ SECTIONS .text : AT(0x400) { PROVIDE(.text_begin = .); *(.text) - PROVIDE(.text_end = .); + PROVIDE(.text_real_end = .); } .data ALIGN(0x400) : { + PROVIDE(.text_align_end = .); PROVIDE(.data_begin = .); *(.data) *(.rodata) *(.rodata1) - PROVIDE(.data_end = .); + PROVIDE(.data_real_end = .); } .bss ALIGN(0x400) : { + PROVIDE(.data_align_end = .); PROVIDE(.bss_begin = .); *(.bss) - PROVIDE(.bss_end = .); + PROVIDE(.bss_real_end = .); } .symtab ALIGN(0x400) : { PROVIDE(.sym_begin = .); *(.symtab) PROVIDE(.sym_end = .); } - PROVIDE(.textsize = (SIZEOF(.text) + 0x400 - 1) & ~( 0x400 - 1 )); - PROVIDE(.datasize = (SIZEOF(.data) + 0x400 - 1) & ~( 0x400 - 1 )); - PROVIDE(.bsssize = SIZEOF(.bss)); + .text_end = (SIZEOF(.data) + SIZEOF(.bss) == 0) ? .text_real_end : .text_align_end; + .data_end = (SIZEOF(.bss) == 0) ? .data_real_end : .data_align_end; + .bss_end = .bss_real_end; + PROVIDE(.textsize = .text_end - .text_begin); + PROVIDE(.datasize = .data_end - .data_begin); + PROVIDE(.bsssize = .bss_end - .bss_begin); PROVIDE(.symsize = 0); .header ALIGN(0x400) : AT(0x0){ LONG(267)