Forum > FPC development

[SOLVED] smartlinking with LD

(1/1)

Key-Real:
i have the tf_smartlink_sections in tsysteminfo.flags
he make me:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---.section .text.n_si_prc_$$__fpc_proc_start$$longint,"ax"
so my section name is .text.n_si_prc_$$__fpc_proc_start$$longint

that's good :)

my linker.ld is:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---MEMORY{        ram (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 64K}STARTUP(./rtl/ps1/si_prc.o)SECTIONS{        .text : ALIGN(8) {                __exe_start__ = .;                __text_start__ = .;                *(.text .text.*)                __text_end__ = .;                __text_size__ = __text_start__ - __text_end__;        } > ram         .rodata : ALIGN(8) {                __rdata_start__ = .;                *(.rdata .rdata.* .rodata .rodata.*)                __rdata_end__ = .;                __rdata_size__ = __rdata_end__ - __rdata_start__;        } > ram         .ctors : ALIGN(8) {                __ctors_start__ = .;                KEEP(*(.ctors))                KEEP(*(SORT(.ctors.*)))                __ctors_end__ = .;                __ctors_size__ = __ctors_end__ - __ctors_start__;        } > ram         .dtors : ALIGN(8) {                __dtors_start__ = .;                KEEP(*(.dtors))                KEEP(*(SORT(.dtors.*)))                __dtors_end__ = .;                __dtors_size__ = __dtors_end__ - __dtors_start__;        } > ram         .data : ALIGN(8) {                __sdata_start__ = .;                *(.sdata .sdata.*)                __sdata_end__ = .;                __sdata_size__ = __sdata_end__ - __sdata_start__;                __data_start__ = .;                *(.data .data.*)                SORT(CONSTRUCTORS)                . = ALIGN(2048);                __data_end__ = .;                __exe_end__ = .;                __data_size__ = __data_end__ - __data_start__;        } > ram         __exe_size__ = __exe_end__ - __exe_start__;         .sbss : ALIGN(64) {                __sbss_start__ = .;                *(.sbss .sbss.*)                __sbss_end__ = .;                __sbss_size__ = __sbss_end__ - __sbss_start__;        } > ram         .bss : ALIGN(64) {                __bss_start__ = .;                *(.bss .bss.*)                *(COMMON)                . = ALIGN(64);                __bss_end__ = .;                __bss_size__ = __bss_end__ - __bss_start__;        } > ram} 
If I link with
ld --gc-sections
he strips me ALL the text sections, here i have an empty .asm file after dump

how to change the linker script?

Key-Real:
do i have to create a .text.[name] section for every function?

Key-Real:
If You wanna link with --gc-sections

use an ENTRYPOINT() and KEEP() derictives:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---MEMORY{        ram (rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 64K}ENTRY(main)SECTIONS{        .text : ALIGN(8) {                __exe_start__ = .;                __text_start__ = .;                KEEP(*(.text.n_main));                *(.text .text.*)                __text_end__ = .;                __text_size__ = __text_start__ - __text_end__;        } > ram         .rodata : ALIGN(8) {                __rdata_start__ = .;                *(.rdata .rdata.* .rodata .rodata.*)                __rdata_end__ = .;                __rdata_size__ = __rdata_end__ - __rdata_start__;        } > ram         .ctors : ALIGN(8) {                __ctors_start__ = .;                KEEP(*(.ctors))                KEEP(*(SORT(.ctors.*)))                __ctors_end__ = .;                __ctors_size__ = __ctors_end__ - __ctors_start__;        } > ram         .dtors : ALIGN(8) {                __dtors_start__ = .;                KEEP(*(.dtors))                KEEP(*(SORT(.dtors.*)))                __dtors_end__ = .;                __dtors_size__ = __dtors_end__ - __dtors_start__;        } > ram         .data : ALIGN(8) {                __sdata_start__ = .;                *(.sdata .sdata.*)                __sdata_end__ = .;                __sdata_size__ = __sdata_end__ - __sdata_start__;                __data_start__ = .;                *(.data .data.*)                SORT(CONSTRUCTORS)                . = ALIGN(2048);                __data_end__ = .;                __exe_end__ = .;                __data_size__ = __data_end__ - __data_start__;        } > ram         __exe_size__ = __exe_end__ - __exe_start__;         .sbss : ALIGN(64) {                __sbss_start__ = .;                *(.sbss .sbss.*)                __sbss_end__ = .;                __sbss_size__ = __sbss_end__ - __sbss_start__;        } > ram         .bss : ALIGN(64) {                __bss_start__ = .;                *(.bss .bss.*)                *(COMMON)                . = ALIGN(64);                __bss_end__ = .;                __bss_size__ = __bss_end__ - __bss_start__;        } > ram} 

Navigation

[0] Message Index

Go to full version