This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: collect2: ld terminated with signal 10 [Bus error]
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Subject: Re: collect2: ld terminated with signal 10 [Bus error]
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Thu, 29 Jun 2000 12:41:27 -0400 (EDT)
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
> > > collect2: ld terminated with signal 10 [Bus error]
> > > /usr/ccs/bin/ld: Unsatisfied symbols:
> > > bad_typeid virtual table(data)
> > > __check_eh_spec (data)
> > > __rtti_user (data)
> >
> > I looked at the assembler code used to build opnew.o in libgcc.a. It
> > generates an undefined reference to __check_eh_spec (data). The problem
> > is that ASM_OUTPUT_EXTERNAL is not being called for these functions. As
> > a result, the normal .IMPORT stuff for these library routines is not there.
>
> The problem is in mark_addressable. It sets TREE_USED for __check_null_eh_spec
> and __check_eh_spec, preventing build_call from calling mark_used. Possibly,
> fixing this problem will fix the problem for the others as well.
>
> 5002 TREE_USED (x) = 1;
> (gdb) bt
> #0 mark_addressable (exp=0x400b8200) at ../../../gcc/cp/typeck.c:5002
> #1 0x31e6b8 in build_unary_op (code=ADDR_EXPR, xarg=0x400b8200, noconvert=0)
> at ../../../gcc/cp/typeck.c:4739
> #2 0x3157b0 in decay_conversion (exp=0x400b8200)
> at ../../../gcc/cp/typeck.c:1793
> #3 0x326008 in default_conversion (exp=0x40054880)
> at ../../../gcc/cp/typeck.c:1803
> #4 0x24ee00 in build_call (function=0x400b8200, parms=0x0)
> at ../../../gcc/cp/call.c:355
> #5 0x32b508 in expand_end_eh_spec (raises=0x40020580, try_block=0x400b1600)
> at ../../../gcc/cp/except.c:773
> #6 0x28b00c in finish_function (flags=1074496000)
> at ../../../gcc/cp/decl.c:14444
Here is a patch to fix this problem. I have run a complete bootstrap
with this patch and one to follow which fixes a problem linking weak
data symbols under hpux. It is hard to judge whether there are any
regressions since building libio, libstdc++, etc with weak symbols
has never worked before and the build has been broken for a couple
of months without weak support.
This patch appears to be the simplest fix. However, I am not entirely happy
with it since it more or less assumes that the only path by which
mark_addressable is called for artificial functions is through build_call.
The problem in the current code is that TREE_USED is being set in
mark_addressable for function declarations before it is tested in build_call
to see if mark_used needs to be called.
Other options are to move the call to mark_used in build_call to
mark_addressable or to check whether the TREE_USED flag is set in the
declaration of function before build_addr_func is called in build_call.
I would prefer the later approach but it is somewhat more complicated.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2000-06-28 J. David Anglin <dave@hiauly1.hia.nrc.ca>
* typeck.c (mark_addressable): Don't set TREE_USED for artificial
function declarations.
--- typeck.c.orig Fri Jun 23 14:44:31 2000
+++ typeck.c Mon Jun 26 22:46:15 2000
@@ -4999,7 +4999,8 @@
&& !DECL_TEMPLATE_SPECIALIZATION (x))
mark_used (x);
TREE_ADDRESSABLE (x) = 1;
- TREE_USED (x) = 1;
+ if (!DECL_ARTIFICIAL(x))
+ TREE_USED (x) = 1;
TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1;
return 1;