how to know the value of the variables defined in link script file?

Hi, how to know the value of the variables defined in link script file? for example, the following is the target.ld in ecos, could anybody know how to extract the __xxxx values from the generated ELF file? ============== start of target.ld===================== STARTUP(vectors.o) ENTRY(__exception_reset)

INPUT(extras.o)

GROUP(libtarget.a libgcc.a libsupc++.a) MEMORY { ram : ORIGIN = 0, LENGTH = 0x400000 }

SECTIONS {

__reserved_vectors = 0; . = __reserved_vectors + 0x3000;

__reserved_vsr_table = ALIGN (0x10); . = __reserved_vsr_table + 0x200;

__reserved_virtual_table = ALIGN (0x10); . = __reserved_virtual_table + 0x100;

__reserved_for_rom = ALIGN (0x10); . = __reserved_for_rom + 0x1cd00;

.vectors ALIGN (0x10) : { . = .; KEEP(*(.vectors)) } > ram

.text ALIGN (0x4) : { _stext = .; *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } > ram _etext = .; PROVIDE (etext = .);

.fini ALIGN (0x4) : { . = .; *(.fini) } > ram

.rodata1 ALIGN (0x8) : { . = .; *(.rodata1*) } > ram

.rodata ALIGN (0x8) : { . = .; *(.rodata*) } > ram

.fixup ALIGN (0x4) : { __FIXUP_START__ = ABSOLUTE(.); *(.fixup) __FIXUP_END__ = ABSOLUTE(.); } > ram

.gcc_except_table ALIGN (0x1) : { __EXCEPT_START__ = ABSOLUTE(.); *(.gcc_except_table) __EXCEPT_END__ = ABSOLUTE(.); } > ram

.data ALIGN (0x8) : { __ram_data_start = ABSOLUTE(.); *(.data*)

__GOT1_START__ = ABSOLUTE(.); *(.got1) __GOT1_END__ = ABSOLUTE(.);

. = ALIGN(8); __CTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.ctors*))) __CTOR_END__ = ABSOLUTE(.);

__DTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.);

. = ALIGN(8); KEEP(*( SORT (.ecos.table.*))) ;

. = ALIGN(4); *( .2ram.*) ; __GOT2_START__ = ABSOLUTE(.); *(.got2) __GOT2_END__ = ABSOLUTE(.);

__GOT_START = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) __GOT_END__ = ABSOLUTE(.);

*(.dynamic) *(.eh_frame) __SDATA_START__ = ABSOLUTE(.); *(.sdata) *(.sdata.*) __SDATA2_START__ = ABSOLUTE(.); *(.sdata2*) } > ram __rom_data_start = LOADADDR(.data); __ram_data_end = .; PROVIDE(__ram_data_end = .); _edata = .; PROVIDE (edata = .);

.sbss ALIGN (0x4) : { __sbss_start = ABSOLUTE (.); __SBSS_START__ = ABSOLUTE(.); *(.sbss.*) __SBSS_END__ = ABSOLUTE(.); __SBSSx_START__ = ABSOLUTE(.); *(.sbss*) __SBSSx_END__ = ABSOLUTE(.); *(.scommon*) __sbss_end = ABSOLUTE (.); } > ram

.bss ALIGN (0x10) : { __bss_start = ABSOLUTE (.); . = .; *(.dynbss*) *(.bss*) *(COMMON) __bss_end = ABSOLUTE (.); } > ram __heap1 = ALIGN (0x8);

. = ALIGN(4); _end = .; PROVIDE (end = .);

} hal_vsr_table = (0x0 + 0x3000);

hal_virtual_vector_table = ((0x0 + 0x3000) + 0x200); ======================= end of target.ld ========================

Reply to
justincui
Loading thread data ...

(-- rest clipped, TV --)

If the linker is GNU ld, the symbols defined in the linker script are available as external addresses to the code.

(Did you read the ld manual?)

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.