From 67f79732435f1ce204e5558c05b1e4e2ce9e08e9 Mon Sep 17 00:00:00 2001 From: sirl Date: Sun, 13 May 2001 21:16:58 +0000 Subject: [PATCH] 2001-05-13 Franz Sirl * rtl.h (SYMBOL_REF_WEAK): New macro. * rtlanal.h (rtx_addr_can_trap): Use it, a weak SYMBOL_REF can trap. * varasm.c (make_decl_rtl): Mark SYMBOL_REF weak if necessary. * rtl.texi (SYMBOL_REF_WEAK): Document it. * gcc.texi: Remove wrong description. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42046 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 +++++++++- gcc/gcc.texi | 7 ------- gcc/rtl.h | 6 +++++- gcc/rtl.texi | 7 +++++++ gcc/rtlanal.c | 6 ++---- gcc/varasm.c | 1 + 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5f11b10..6a7e6bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-05-13 Franz Sirl + + * rtl.h (SYMBOL_REF_WEAK): New macro. + * rtlanal.h (rtx_addr_can_trap): Use it, a weak SYMBOL_REF can trap. + * varasm.c (make_decl_rtl): Mark SYMBOL_REF weak if necessary. + * rtl.texi (SYMBOL_REF_WEAK): Document it. + * gcc.texi: Remove wrong description. + 2001-05-13 Mark Mitchell * Makefile.in (STAMP): New macro. @@ -446,7 +454,7 @@ Mon May 7 09:30:14 2001 Jeffrey A Law (law@cygnus.com) * simplify-rtx.c (simplify_binary_operation): Simplify ~a + 1 into -a. -2000-05-04 Franz Sirl +2001-05-04 Franz Sirl * config/rs6000/rs6000.md (ashldi3 splits): Guard with TARGET_POWERPC64. diff --git a/gcc/gcc.texi b/gcc/gcc.texi index 81b6bd5..a2b90f1 100644 --- a/gcc/gcc.texi +++ b/gcc/gcc.texi @@ -2008,13 +2008,6 @@ clutter the program with a cast to @code{void} whenever the value isn't useful. @item -Assuming (for optimization) that the address of an external symbol is -never zero. - -This assumption is false on certain systems when @samp{#pragma weak} is -used. - -@item Making @samp{-fshort-enums} the default. This would cause storage layout to be incompatible with most other C diff --git a/gcc/rtl.h b/gcc/rtl.h index 4b1051c..a925210 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -162,7 +162,8 @@ typedef struct rtx_def unsigned int used : 1; /* Nonzero if this rtx came from procedure integration. In a REG, nonzero means this reg refers to the return value - of the current function. */ + of the current function. + 1 in a SYMBOL_REF if the symbol is weak. */ unsigned integrated : 1; /* 1 in an INSN or a SET if this rtx is related to the call frame, either changing how we compute the frame address or saving and @@ -934,6 +935,9 @@ extern unsigned int subreg_regno PARAMS ((rtx)); /* 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)->integrated) + /* Define a macro to look for REG_INC notes, but save time on machines where they never exist. */ diff --git a/gcc/rtl.texi b/gcc/rtl.texi index 4e1dd21..6c256b4 100644 --- a/gcc/rtl.texi +++ b/gcc/rtl.texi @@ -496,6 +496,13 @@ once. Stored in the @code{used} field. In a @code{symbol_ref}, this is used as a flag for machine-specific purposes. Stored in the @code{volatil} field and printed as @samp{/v}. +@findex SYMBOL_REF_WEAK +@cindex @code{symbol_ref} and @samp{/i} +@cindex @code{integrated}, in @code{symbol_ref} +@item SYMBOL_REF_WEAK (@var{x}) +In a @code{symbol_ref}, indicates that @var{x} has been declared weak. +Stored in the @code{integrated} field and printed as @samp{/i}. + @findex LABEL_OUTSIDE_LOOP_P @cindex @code{label_ref} and @samp{/s} @cindex @code{in_struct}, in @code{label_ref} diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 121b879..b0e2f4e 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -207,11 +207,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: diff --git a/gcc/varasm.c b/gcc/varasm.c index 6900987..9b2744a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -747,6 +747,7 @@ make_decl_rtl (decl, asmspec) SET_DECL_RTL (decl, gen_rtx_MEM (DECL_MODE (decl), gen_rtx_SYMBOL_REF (Pmode, name))); + SYMBOL_REF_WEAK (XEXP (DECL_RTL (decl), 0)) = DECL_WEAK (decl); if (TREE_CODE (decl) != FUNCTION_DECL) set_mem_attributes (DECL_RTL (decl), decl, 1); -- 2.7.4