This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: bugs.html
- To: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Subject: Re: PATCH: bugs.html
- From: Andreas Jaeger <aj at suse dot de>
- Date: Wed, 17 Oct 2001 09:19:32 +0200
- Cc: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>, <gcc-patches at gcc dot gnu dot org>
- References: <Pine.BSF.4.33.0110162343170.55697-100000@deneb.dbai.tuwien.ac.at>
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> writes:
> On Tue, 16 Oct 2001, Andreas Jaeger wrote:
[...]
>> I think most (all?) are on the branch but I've lost track. I can
>> check what we at SuSE add to our 2.95 version and send those patches.
>
> Yes, that sounds good.
Here're the patches that look critical and missing:
- This one fixes the C++ local destructors. Some people reported
problems with it on Alpha and I'm not sure what the status is for
alpha.
--- gcc-2.95.x/gcc/config/alpha/crtbegin.asm.jj Wed Dec 16 22:00:53 1998
+++ gcc-2.95.x/gcc/config/alpha/crtbegin.asm Wed Jun 13 12:41:28 2001
@@ -97,6 +97,31 @@ __EH_FRAME_BEGIN__:
# Support recursive calls to exit.
$ptr: .quad __DTOR_LIST__
+/* A globally unique widget for c++ local destructors to hang off.
+
+ This has a unique value in every dso; in the main program its
+ value is zero. The object should be protected. This means the
+ instance in any dso or the main program is not used in any other
+ dso. The dynamic linker takes care of this. */
+
+ .global __dso_handle
+ .type __dso_handle,@object
+ .size __dso_handle,8
+#ifdef SHARED
+.section .data
+ .align 3
+__dso_handle:
+ .quad __dso_handle
+#else
+.section .bss
+ .align 3
+__dso_handle:
+ .zero 8
+#endif
+#ifdef HAVE_GAS_HIDDEN
+ .hidden __dso_handle
+#endif
+
.text
.align 3
============================================================
Index: gcc/crtstuff.c
--- gcc-2.95.x/gcc/crtstuff.c 2001/04/03 10:34:32 1.18.4.1
+++ gcc-2.95.x/gcc/crtstuff.c 2001/08/09 06:56:33
@@ -55,6 +55,7 @@ Boston, MA 02111-1307, USA. */
#include "defaults.h"
#include <stddef.h>
#include "frame.h"
+#include "auto-host.h"
/* We do not want to add the weak attribute to the declarations of these
routines in frame.h because that will cause the definition of these
@@ -134,7 +135,29 @@ typedef void (*func_ptr) (void);
#ifdef INIT_SECTION_ASM_OP
#ifdef OBJECT_FORMAT_ELF
+/* Declare the __dso_handle variable. It should have a unique value
+ in every shared-object; in a main program its value is zero. The
+ object should in any case be protected. This means the instance
+ in one DSO or the main program is not used in another object. The
+ dynamic linker takes care of this. */
+
+/* XXX Ideally the following should be implemented using
+ __attribute__ ((__visibility__ ("hidden")))
+ but the __attribute__ support is not yet there. */
+#ifdef HAVE_GAS_HIDDEN
+asm (".hidden\t__dso_handle");
+#endif
+
+#ifdef CRTSTUFFS_O
+void *__dso_handle = &__dso_handle;
+#else
+void *__dso_handle = 0;
+#endif
+/* The __cxa_finalize function may not be available so we use only a
+ weak declaration. */
+extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;
+
/* Run all the global destructors on exit from the program. */
/* Some systems place the number of pointers in the first word of the
@@ -164,6 +187,11 @@ __do_global_dtors_aux (void)
if (completed)
return;
+
+#ifdef CRTSTUFFS_O
+ if (__cxa_finalize)
+ __cxa_finalize (__dso_handle);
+#endif
while (*p)
{
--- gcc-2.95.x/gcc/configure.in.jj Wed Oct 13 09:58:02 1999
+++ gcc-2.95.x/gcc/configure.in Wed Jun 13 12:44:34 2001
@@ -4053,6 +4053,21 @@ EOF
fi
AC_MSG_RESULT($gcc_cv_as_subsections)
+AC_MSG_CHECKING(assembler hidden support)
+gcc_cv_as_hidden=
+if test x$gcc_cv_as != x; then
+ # Check if we have .hidden
+ echo " .hidden foobar" > conftest.s
+ echo "foobar:" >> conftest.s
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+ AC_DEFINE(HAVE_GAS_HIDDEN, 1,
+ [Define if your assembler supports .hidden.])
+ gcc_cv_as_hidden="yes"
+ fi
+ rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+fi
+AC_MSG_RESULT($gcc_cv_as_hidden)
+
AC_MSG_CHECKING(assembler instructions)
gcc_cv_as_instructions=
if test x$gcc_cv_as != x; then
--- gcc-2.95.x/gcc/config.in.jj Mon Oct 25 10:02:08 1999
+++ gcc-2.95.x/gcc/config.in Wed Jun 13 12:45:56 2001
2 the beginning of your section */
#undef HAVE_GAS_SUBSECTION_ORDERING
+/* Define if your assembler supports .hidden. */
+#undef HAVE_GAS_HIDDEN
+
/* Define if your assembler uses the old HImode fild and fist notation. */
#undef HAVE_GAS_FILDS_FISTS
- This patch is needed to fix handling of weak symbols.
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.
Index: gcc/rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.105.4.3
diff -u -p -r1.105.4.3 rtl.h
--- gcc/rtl.h 2001/01/25 14:03:22 1.105.4.3
+++ gcc/rtl.h 2001/03/13 01:03:58
@@ -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
--- gcc/varasm.c.~1~ Fri Aug 11 00:51:55 2000
+++ gcc/varasm.c Mon Mar 19 11:09:16 2001
@@ -722,6 +722,8 @@
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. */
@@ -751,8 +753,10 @@
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
--- gcc/rtlanal.c.~1~ Wed Dec 20 16:03:31 2000
+++ gcc/rtlanal.c Mon Mar 19 11:09:50 2001
@@ -135,11 +135,9 @@
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:
The other patches we use mostly affect certain ports and are not
criticial for the 2.95er branch.
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj