[Bug c/38231] Improperly parsing -g -o causes bad info to be passed to ld on FreeBSD and ld segfaults
yanegomi at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Nov 23 01:37:00 GMT 2008
------- Comment #2 from yanegomi at gmail dot com 2008-11-23 01:36 -------
Ok, here's a shorter means of reproducing the issue:
echo 'int main () { return 0; }' > test.c
gcc -o test test.c
gcc -o -g test test.c
This issue doesn't occur as horribly with the gcc and ld versions that are
available on FreeBSD, but it still comes up with a confusing error on Fedora 9:
[root@fedora-vm regression_test]# echo 'int main () { return 0; }' > test.c
[root@fedora-vm regression_test]# gcc -o test test.c
[root@fedora-vm regression_test]# gcc -o -g test test.c
test: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.text+0x0): first defined
here
test:(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.rodata+0x0): first
defined here
test: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crti.o:(.fini+0x0): first defined
here
test:(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.rodata.cst4+0x0): first
defined here
test: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.data+0x0): first defined
here
test:(.rodata+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/i386-redhat-linux/4.3.0/crtbegin.o:(.rodata+0x0): first defined
here
test: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crti.o:(.init+0x0): first defined
here
/tmp/cc4jnyB9.o: In function `main':
test.c:(.text+0x0): multiple definition of `main'
test:(.text+0xb4): first defined here
/usr/lib/gcc/i386-redhat-linux/4.3.0/crtend.o:(.dtors+0x0): multiple definition
of `__DTOR_END__'
test:(.dtors+0x4): first defined here
/usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr
ignored.
/usr/bin/ld: error in test(.eh_frame); no .eh_frame_hdr table will be created.
collect2: ld returned 1 exit status
So it appears that the root cause is instead with ld, not gcc. Sorry for the
noise.
--
yanegomi at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38231
More information about the Gcc-bugs
mailing list