(previous mail was only sent to Pedro. I include the previous mail, where I
found that the segfault is in ld, not in collect2.
Some progress.
According to the code, the incriminated lines are:
/* Flag that this BFD uses long names, even though the format might
expect them to be off by default. This won't directly affect the
format of any output BFD created from this one, but the information
can be used to decide what to do. */
bfd_coff_set_long_section_names (abfd, TRUE);
memcpy (buf, hdr->s_name + 1, SCNNMLEN - 1);
buf[SCNNMLEN - 1] = '\0';
strindex = strtol (buf, &p, 10);
if (*p == '\0' && strindex >= 0)
{
strings = _bfd_coff_read_string_table (abfd);
if (strings == NULL)
return FALSE;
* /* FIXME: For extra safety, we should make sure that
strindex does not run us past the end, but right now we
don't know the length of the string table. */
* strings += strindex;
name = (char *) bfd_alloc (abfd,
(bfd_size_type) *strlen (strings)* +
1);
if (name == NULL)
return FALSE;
strcpy (name, strings);
}
playing with GDB I find that:
$3 = 8976241
(gdb) print strings
$4 = 0xacf3e1 <Address 0xacf3e1 out of bounds>
(gdb) print (strings-strindex)
$5 = 0x23fc70 "\r\255\272.debug_abbrev"
(gdb) print buf
$6 = "8976241"
(gdb) print abfd
$7 = (bfd *) 0x23fb00
(gdb) print hdr
$9 = (struct internal_scnhdr *) 0xfaf364
(gdb) print *hdr
$10 = {s_name = "/8976241", s_paddr = 0, s_vaddr = 0, s_size = 145, s_scnptr
= 572, s_relptr = 0, s_lnnoptr = 0, s_nreloc = 0, s_nlnno = 0, s_flags =
1108344832, s_align = 21807152, s_page = 20 '\024'}
(gdb) print target_index
$11 = 4
(gdb) print flags
$12 = 1
(gdb)
I don't know why the heck this happens, but the address out of bounds I get
seems related to this FIXME .
What do you think?
Should I report this to upstream? who can handle that? mingw gurus? "vanilla
binutils" gurus?
It does not happen on linux.
Sebastien
On Sat, Jan 30, 2010 at 9:55 PM, Sébastien Lorquet <squa...@gmail.com>wrote:
> You're right. I was too sleepy to notice that.
>
> Now I get the sigsegv:
>
> C:\MinGW>c:/mingw/cross41-debug/bin/../libexec/gcc/arm-mingw32ce/4.1.0/collect2.exe
> -v -Bdynamic -o test.exe c:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32ce
>
> /4.1.0/../../../../arm-mingw32ce/lib/crt3.o
> -Lc:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32ce/4.1.0
> -Lc:/mingw/cross41-debug/bin/../lib/gcc -Lc:/mingw/cross
> 41-debug/bin/../lib/gcc/arm-mingw32ce/4.1.0/../../../../arm-mingw32ce/lib
> C:\DOCUME~1\squalyl\LOCALS~1\Temp/ccfo5YRa.o -lmingw32 -lgcc -lceoldname
> -lmingwex -lc
>
> oredll -lcoredll -lmingw32 -lgcc -lceoldname -lmingwex -lcoredll
> collect2 version 4.1.0 (arm MinGW)
> c:\MinGW\cross41-debug\bin/arm-mingw32ce-ld.exe -v -Bdynamic -o test.exe
> c:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32ce/4.1.0/../../../../arm-mingw32ce/lib
> /crt3.o -Lc:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32ce/4.1.0
> -Lc:/mingw/cross41-debug/bin/../lib/gcc
> -Lc:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32c
> e/4.1.0/../../../../arm-mingw32ce/lib
> C:\DOCUME~1\squalyl\LOCALS~1\Temp/ccfo5YRa.o -lmingw32 -lgcc -lceoldname
> -lmingwex -lcoredll -lcoredll -lmingw32 -lgcc -lc
> eoldname -lmingwex -lcoredll
>
> collect2: ld returned 5 exit status
>
> C:\MinGW>gdb c:\MinGW\cross41-debug\bin/arm-mingw32ce-ld.exe
> 'gdb' n'est pas reconnu en tant que commande interne
> ou externe, un programme exécutable ou un fichier de commandes.
>
> C:\MinGW>gcc3\bin\gdb c:\MinGW\cross41-debug\bin/arm-mingw32ce-ld.exe
> GNU gdb (GDB) 7.0.1
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "mingw32".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from
> c:\MinGW\cross41-debug\bin/arm-mingw32ce-ld.exe...done.
> < C:\DOCUME~1\squalyl\LOCALS~1\Temp/ccfo5YRa.o -lmingw32 -lgcc -lceoldname
> -lmingwex -lcoredll -lcoredll -lmingw32 -lgcc -lceoldname -lmingwex
> -lcoredll
> Starting program: c:\MinGW\cross41-debug\bin/arm-mingw32ce-ld.exe -v
> -Bdynamic -o test.exe
> c:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32ce/4.1.0/../../../..
> /arm-mingw32ce/lib/crt3.o
> -Lc:/mingw/cross41-debug/bin/../lib/gcc/arm-mingw32ce/4.1.0
> -Lc:/mingw/cross41-debug/bin/../lib/gcc -Lc:/mingw/cross41-debug/bin/../li
> b/gcc/arm-mingw32ce/4.1.0/../../../../arm-mingw32ce/lib
> C:\DOCUME~1\squalyl\LOCALS~1\Temp/ccfo5YRa.o -lmingw32 -lgcc -lceoldname
> -lmingwex -lcoredll -lcoredll -
>
> lmingw32 -lgcc -lceoldname -lmingwex -lcoredll
> [New Thread 556.0xe48]
> GNU ld (GNU Binutils) 2.20.51.20091016
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x77c178ac in strlen () from C:\WINDOWS\system32\msvcrt.dll
> (gdb) bt
> #0 0x77c178ac in strlen () from C:\WINDOWS\system32\msvcrt.dll
> #1 0x00437f78 in make_a_section_from_file (abfd=0x23fb00, hdr=0xfaf364,
> target_index=4) at
> /home/squalyl/projects/cegcc/src/binutils/bfd/coffgen.c:93
> Backtrace stopped: frame did not save the PC
> (gdb) list
> 177 /home/squalyl/projects/cegcc/src/binutils/ld/ldmain.c: No such file
> or directory.
> in /home/squalyl/projects/cegcc/src/binutils/ld/ldmain.c
> (gdb)
>
>
>
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel