Ugly hack alert!

libg++'s exception code causes gcc to generate (ahem!) non-conventional
assembler code in -fpic mode that gas and ld choke on.  Basically, gas
and ld require than symbols referenced in the GOT (global offset table)
are actually global (as the name implies).  It attempted to work around
it before, but didn't quite go far enough to prevent a core dump in ld.
This hack causes GOT referenced symbols to be forced global.  This
probably breaks the __EXCEPTION_TABLE__ stuff in pic mode, but heck, it
wasn't even possible to compile with a shared library before at all.

I'm not 100% sure what the bug is.  There's two possibilities:
1: gcc/cp/exception.c has to be fixed to stop doing GOT references to
   local symbols, or
2: as/ld/symorder/ld.so etc need to be taught about how to keep local
   symbols around so that they can be dealt with in GOT references.

John Polstra's elfkit stuff seems to deal with this fine though, which is
why I think it's a "missing feature" in our hacked gas and ld..
This commit is contained in:
Peter Wemm 1996-10-03 08:07:38 +00:00
parent 890c2894d8
commit e8d53f09e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18654

View file

@ -25,7 +25,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: tc-i386.c,v 1.4 1995/05/30 04:47:29 rgrimes Exp $";
static char rcsid[] = "$Id: tc-i386.c,v 1.5 1996/10/01 00:12:43 peter Exp $";
#endif
#include "as.h"
@ -2082,6 +2082,7 @@ relax_addressT segment_address_in_file;
if (!extrn_bit && !S_IS_EXTERNAL(fixP->fx_addsy))
as_warn("GOT relocation burb: `%s' should be global",
S_GET_NAME(fixP->fx_addsy));
S_SET_EXTERNAL(fixP->fx_addsy);
extrn_bit = 1;
break;
case RELOC_GOTOFF: