cross compiler gcc 4.2.3 for FreeBSD 10

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

 



Hello!
I have compiled cross compiler gcc 4.2.3 for FreeBSD using
binutils-2.17.50. To compiler that compiler I used gcc 4.4.3 compiler.

Before that I patched files removing freebsd1* and freebsd[1... and
freebsd[[1 if/case. It is well known problem which I found in
Changelog of gcc 4.6.3

binutils-2.17.5/ld/configure
binutils-2.17.5/gas/configure
binutils-2.17.5/gprof/configure
binutils-2.17.5/opcodes/configure
binutils-2.17.5/configure
binutils-2.17.5/binutils/configure
binutils-2.17.5/bfd/configure
binutils-2.17.5/config.rpath
binutils-2.17.5/libtool.m4
binutils-2.17.5/ld/configure.host
binutils-2.17.5/ld/configure.tgt
binutils-2.17.5/bfd/config.bfd
binutils-2.17.5/bfd/configure

gcc-4.2.3/boehm-gc/configure
gcc-4.2.3/configure
gcc-4.2.3/fixincludes/configure
gcc-4.2.3/gcc/configure
gcc-4.2.3/gnattools/configure
gcc-4.2.3/intl/configure
gcc-4.2.3/libada/configure
gcc-4.2.3/libcpp/configure
gcc-4.2.3/libdecnumber/configure
gcc-4.2.3/libffi/configure
gcc-4.2.3/libgfortran/configure
gcc-4.2.3/libgomp/configure
gcc-4.2.3/libiberty/configure
gcc-4.2.3/libjava/classpath/configure
gcc-4.2.3/libjava/configure
gcc-4.2.3/libjava/libltdl/configure
gcc-4.2.3/libmudflap/configure
gcc-4.2.3/libobjc/configure
gcc-4.2.3/libssp/configure
gcc-4.2.3/libstdc++-v3/configure
gcc-4.2.3/zlib/configure
gcc compiler built with no errors.

Next I tried to compile a simple example of c++ code

int main()
{
        try
        {
                throw 10;
        }
        catch(...)
        {
                return 1;
        }

        return 0;
}
But I got a coredump

root@:~ # ./42.out
Abort (core dumped)
root@:~ # ldd ./42.out
./42.out:
        libstdc++.so.6 => /root/4.2/libstdc++.so.6 (0x28069000)
        libm.so.5 => /lib/libm.so.5 (0x28155000)
        libgcc_s.so.1 => /root/4.2/libgcc_s.so.1 (0x28177000)
        libc.so.7 => /lib/libc.so.7 (0x28185000)

root@:~ # gdb 42.out 42.out.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging
symbols found)...
Attaching to program: /root/42.out, process 42
ptrace: No such process.
Core was generated by `42.out'.
Program terminated with signal 6, Aborted.
Reading symbols from /root/4.2/libstdc++.so.6...done.
Loaded symbols for /root/4.2/libstdc++.so.6
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /root/4.2/libgcc_s.so.1...done.
Loaded symbols for /root/4.2/libgcc_s.so.1
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x282afed7 in kill () from /lib/libc.so.7
(gdb) bt
#0  0x282afed7 in kill () from /lib/libc.so.7
#1  0x282afe67 in raise () from /lib/libc.so.7
#2  0x282ae8a6 in abort () from /lib/libc.so.7
#3  0x28180078 in uw_init_context_1 (context=0xbfbfdb68,
outer_cfa=0xbfbfdc10, outer_ra=0x281214f1) at
../../gcc/unwind-dw2.c:1413
#4  0x281804e2 in _Unwind_RaiseException (exc=0x28803070) at unwind.inc:92
#5  0x281214f1 in __cxa_throw (obj=0x28803090, tinfo=0x80499a0,
dest=0) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:71
#6  0x08048770 in main ()

part of gcc/unwind-dw2.c:1413
...
  code = uw_frame_state_for (context, &fs);
  gcc_assert (code == _URC_NO_REASON); <--- line 14, here I got code
== _URC_END_OF_STACK
...

Then I linked libgcc and libstdc++ statically

root@:~ # ldd 42.out
42.out:
        libm.so.5 => /lib/libm.so.5 (0x2807c000)
        libc.so.7 => /lib/libc.so.7 (0x2809e000)

But the problem was reproducted again

root@:~ # ./42.out
Abort (core dumped)

With the same stack trace

root@:~ # gdb 42.out 42.out.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
Attaching to program: /root/42.out, process 42
ptrace: No such process.
Core was generated by `42.out'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x281c8ed7 in kill () from /lib/libc.so.7
(gdb) bt
#0  0x281c8ed7 in kill () from /lib/libc.so.7
#1  0x281c8e67 in raise () from /lib/libc.so.7
#2  0x281c78a6 in abort () from /lib/libc.so.7
#3  0x08056268 in uw_init_context_1 (context=0xbfbfdb68,
outer_cfa=0xbfbfdc10, outer_ra=0x804d537) at
../../gcc/unwind-dw2.c:1413
#4  0x080566d2 in _Unwind_RaiseException (exc=0x28803070) at unwind.inc:92
#5  0x0804d537 in __cxa_throw (obj=0x28803090, tinfo=0x805c480,
dest=0) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:71
#6  0x080492c0 in main ()

Can you please tell me where to dig to get workable compiler?

-- 
/BR, Alexander




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux