Referenced symbol not present in final image?
Øyvind Harboe
oyvind.harboe@zylin.com
Fri Apr 8 10:30:00 GMT 2005
Using binutils 2.15:
Under what circumstances would the linker allow a symbol to be
referenced but not defined?
In the image, pthread_mutex_lock=0, so anyone trying to call
pthread_mutex_lock crashes when trying to access address 0.
When trying --trace-symbol, the symbol is referenced but never defined.
$ arm-elf-gcc -Wl,-static -g [trimmed] -nostdlib -nostartfiles
-L../romapp/install/lib -Ttarget.ld -trace-symbol=pthread_mutex_lock
output/./main.o: reference to pthread_mutex_lock
/ecos-c/cdtworkspace/arm/install/bin/../lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o): reference to pthread_mutex_lock
/ecos-c/cdtworkspace/arm/install/bin/../lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/libstdc++.a(locale_init.o): reference to pthread_mutex_lock
/ecos-c/cdtworkspace/arm/install/bin/../lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/libstdc++.a(allocator-inst.o): reference to pthread_mutex_lock
(My goal is to get libstdc++ w/gcc 3.4.3 working for
http://sources.redhat.com/ecos)
--
Øyvind Harboe
http://www.zylin.com
-------------- next part --------------
STARTUP(vectors.o)
ENTRY(reset_vector)
INPUT(extras.o)
GROUP(libgcc.a libsupc++.a libstdc++.a libtarget.a)
MEMORY
{
ram : ORIGIN = 0x00000000, LENGTH = 0x40000
rom : ORIGIN = 0x01030000, LENGTH = 0x1d0000
}
SECTIONS
{
.debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_info 0 : { *(.debug_info) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } .note.arm.ident 0 : { KEEP (*(.note.arm.ident)) }
.rom_vectors 0x01030000 : { __rom_vectors_vma = ABSOLUTE(.); . = .; KEEP (*(.vectors)) } > rom __rom_vectors_lma = LOADADDR(.rom_vectors);
.text ALIGN (0x1) : { _stext = ABSOLUTE(.); PROVIDE (__stext = ABSOLUTE(.)); *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) *(.glue_7) *(.glue_7t) } > rom _etext = .; PROVIDE (__etext = .);
.fini ALIGN (0x4) : { . = .; *(.fini) } > rom
.rodata ALIGN (0x4) : { . = .; *(.rodata*) *(.gnu.linkonce.r.*) } > rom
.rodata1 ALIGN (0x4) : { . = .; *(.rodata1) } > rom
.fixup ALIGN (0x4) : { . = .; *(.fixup) } > rom
.gcc_except_table ALIGN (0x4) : { . = .; *(.gcc_except_table) } > rom
.fixed_vectors 0x20 : { . = .; KEEP (*(.fixed_vectors)) } > ram
.data 0x4000 : AT ((LOADADDR (.gcc_except_table) + SIZEOF (.gcc_except_table) + 4 - 1) & ~ (4 - 1)) { __ram_data_start = ABSOLUTE (.); *(.data*) *(.data1) *(.gnu.linkonce.d.*) . = ALIGN (4); KEEP(*( SORT (.ecos.table.*))) ; . = ALIGN (4); __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) . = ALIGN (4); *(.2ram.*) } > ram __rom_data_start = LOADADDR (.data); __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); PROVIDE (__rom_data_end = LOADADDR (.data) + SIZEOF(.data));
.bss ALIGN (0x4) : { __bss_start = ABSOLUTE (.); *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) __bss_end = ABSOLUTE (.); } > ram
__heap1 = ALIGN (0x8);
. = ALIGN(4); _end = .; PROVIDE (end = .);
}
More information about the Binutils
mailing list