bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ld segfault linking mips code


From: Chris Bainbridge
Subject: ld segfault linking mips code
Date: Sat, 8 Jun 2002 02:12:49 +0100
User-agent: KMail/1.4.1

binutils 2.12, gcc 2.95.3, newlib 1.10.0, target mips-ecoff.

when the output format is binary ld segfaults:

$ gdb mips-ecoff-ld

(gdb)  r stdlib.o test.o -T test.ld
Starting program: /usr/local/stow/binutils-mips-ecoff-2.12/bin/mips-ecoff-ld 
stdlib.o test.o -T test.ld

Program received signal SIGSEGV, Segmentation fault.
_bfd_get_gp_value (abfd=0x0) at ../../bfd/bfd.c:967
967       if (abfd->format != bfd_object)

(gdb) p abfd->format
Cannot access memory at address 0x30
(gdb)

abfd is passed in as an argument...

(gdb) bt
#0  _bfd_get_gp_value (abfd=0x0) at ../../bfd/bfd.c:967
#1  0x080673a5 in mips_gprel_reloc (abfd=0x80b4d68, reloc_entry=0x81665e4, 
symbol=0x8165ca4, data=0x80ae018,
    input_section=0x80b5e24, output_bfd=0x0, error_message=0xbfffe4a8) at 
../../bfd/coff-mips.c:831
#2  0x0805e6c3 in bfd_perform_relocation (abfd=0x80b4d68, 
reloc_entry=0x81665e4, data=0x80ae018, input_section=0x80b5e24,
    output_bfd=0x0, error_message=0xbfffe4a8) at ../../bfd/reloc.c:624
#3  0x0805f210 in bfd_generic_get_relocated_section_contents (abfd=0x80a2b70, 
link_info=0x809c800, link_order=0x80a2cbc,
    data=0x80ae018 "\003à", relocateable=false, symbols=0x8165920) at 
../../bfd/reloc.c:3601
#4  0x0805c974 in bfd_get_relocated_section_contents (abfd=0x80a2b70, 
link_info=0x809c800, link_order=0x80a2cbc,
    data=0x80ae018 "\003à", relocateable=false, symbols=0x8165920) at 
../../bfd/bfd.c:1233
#5  0x080623f1 in default_indirect_link_order (output_bfd=0x80a2b70, 
info=0x809c800, output_section=0x80a3c2c,
    link_order=0x80a2cbc, generic_linker=true) at ../../bfd/linker.c:2809
#6  0x0806185a in _bfd_generic_final_link (abfd=0x80a2b70, info=0x809c800) at 
../../bfd/linker.c:2098
#7  0x080564c7 in ldwrite () at ../../ld/ldwrite.c:536
#8  0x080546b2 in main (argc=5, argv=0xbfffe644) at ../../ld/ldmain.c:426
#9  0x42017499 in __libc_start_main () from /lib/i686/libc.so.6

(gdb) f 2
#2  0x0805e6c3 in bfd_perform_relocation (abfd=0x80b4d68, 
reloc_entry=0x81665e4, data=0x80ae018, input_section=0x80b5e24,
    output_bfd=0x0, error_message=0xbfffe4a8) at ../../bfd/reloc.c:624
624           cont = howto->special_function (abfd, reloc_entry, symbol, data,
(gdb) p symbol->section->output_section->owner
$1 = (bfd *) 0x0
(gdb)

at line 819 of coff-mips.c (in mips_gprel_reloc) it does:

      relocateable = false;
      output_bfd = symbol->section->output_section->owner;

as you can see this is null, which gets passed into bfd_get_gp_value where its 
dereferenced and segfaults. This must be something to do with using binary as 
the output format, since OUTPUT_FORMAT(ecoff-bigmips) in the ld script 
doesn't segfault.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]