[taken from gcc-2.95.3-7-suse]

This patch fixes handling of weak symbols (see
	http://gcc.gnu.org/ml/gcc-bugs/2001-03/msg00406.html).
	2001-03-13  Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
    * rtl.h (SYMBOL_REF_WEAK): New macro.
    * varasm.c (make_decl_rtl): Set SYMBOL_REF_WEAK for weak symbols.
    * rtlanal.c (rtx_addr_can_trap_p): A weak SYMBOL_REF can trap.


git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9585 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2004-10-28 18:20:18 +00:00
parent e31a22361a
commit c2c76c0b34
3 changed files with 13 additions and 7 deletions

View File

@ -168,7 +168,8 @@ typedef struct rtx_def
either changing how we compute the frame address or saving and
restoring registers in the prologue and epilogue.
1 in a MEM if the MEM refers to a scalar, rather than a member of
an aggregate. */
an aggregate.
1 in a SYMBOL_REF if the symbol is weak. */
unsigned frame_related : 1;
/* The first element of the operands of this rtx.
The number of operands and their types are controlled
@ -661,6 +662,9 @@ extern char *note_insn_name[];
/* 1 means a SYMBOL_REF has been the library function in emit_library_call. */
#define SYMBOL_REF_USED(RTX) ((RTX)->used)
/* 1 means a SYMBOL_REF is weak. */
#define SYMBOL_REF_WEAK(RTX) ((RTX)->frame_related)
/* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
of the function that is not involved in copying parameters to
pseudo-registers. FIRST_PARM_INSN is the very first insn of

View File

@ -136,11 +136,9 @@ rtx_addr_can_trap_p (x)
switch (code)
{
case SYMBOL_REF:
return SYMBOL_REF_WEAK (x);
case LABEL_REF:
/* SYMBOL_REF is problematic due to the possible presence of
a #pragma weak, but to say that loads from symbols can trap is
*very* costly. It's not at all clear what's best here. For
now, we ignore the impact of #pragma weak. */
return 0;
case REG:

View File

@ -723,6 +723,8 @@ make_decl_rtl (decl, asmspec, top_level)
Also handle vars declared register invalidly. */
if (DECL_RTL (decl) == 0)
{
rtx x;
/* Can't use just the variable's own name for a variable
whose scope is less than the whole file.
Concatenate a distinguishing number. */
@ -752,8 +754,10 @@ make_decl_rtl (decl, asmspec, top_level)
new_name, strlen (new_name));
}
DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
gen_rtx_SYMBOL_REF (Pmode, name));
x = gen_rtx_SYMBOL_REF (Pmode, name);
SYMBOL_REF_WEAK (x) = DECL_WEAK (decl);
DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), x);
MEM_ALIAS_SET (DECL_RTL (decl)) = get_alias_set (decl);
/* If this variable is to be treated as volatile, show its