This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.0.1 PATCH: Support #pragma weak on IRIX 5/6
- To: gcc-patches at gcc dot gnu dot org
- Subject: 3.0.1 PATCH: Support #pragma weak on IRIX 5/6
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- Date: Fri, 13 Jul 2001 21:10:45 +0200 (MEST)
- Cc: "H . J . Lu" <hjl at lucon dot org>
This is an updated versions of H. J. Lu's patch
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg00822.html
It enables support for pragma weak on IRIX 5 and 6, and has a couple of
minor changes relative to the prior version:
* a comment update in c-pragma.h
* moved definition of ASM_OUTPUT_WEAK_ALIAS and ASM_WEAKEN_LABEL to
iris5.h: the IRIX 5 assembler already handles .weakext, so we can support
#pragma weak on both IRIX 5 and 6
Bootstrapped on mips-sgi-irix5.3 (running on IRIX 6.2) with --with-gnu-as
and gas 2.11.2 (with a necessary, but unrelated patch, to be submitted to
the binutils list) and mips-sgi-irix6.5.
Here are the testsuite differences:
* mips-sgi-irix5.3:
-FAIL: g++.ext/attrib5.C (test for excess errors)
+FAIL: g++.ext/attrib5.C Execution test
-FAIL: g++.other/mangle3.C (test for excess errors)
-FAIL: g++.pt/static3.C (test for excess errors)
-FAIL: g++.pt/static6.C (test for excess errors)
-FAIL: gcc.dg/special/weak-1.c execution test
-FAIL: gcc.dg/special/weak-2.c execution test
-FAIL: wkali-2a.o
-FAIL: 21_strings/capacity.cc (test for excess errors)
-FAIL: 22_locale/numpunct.cc (test for excess errors)
-FAIL: 26_numerics/complex_inserters_extractors.cc (test for excess errors)
+FAIL: 26_numerics/complex_inserters_extractors.cc execution test
Apart from several fixes testcases, two prior compilation failures have
turned into execution failures, so no regressions.
* mips-sgi-irix6.2 -> mips-sgi-irix6.5 (I've upgraded to IRIX 6.5.12 since
running the reference bootstrap, so some testsuite changes may be related
to this, not to the present patch):
-FAIL: g++.brendan/crash20.C (test for excess errors)
+PASS: g++.brendan/crash20.C (test for excess errors)
-FAIL: g++.law/code-gen5.C (test for excess errors)
-XFAIL: g++.law/code-gen5.C Execution test
+PASS: g++.law/code-gen5.C (test for excess errors)
+PASS: g++.law/code-gen5.C Execution test
-FAIL: g++.law/ctors6.C (test for excess errors)
+PASS: g++.law/ctors6.C (test for excess errors)
-FAIL: g++.law/operators4.C (test for excess errors)
+PASS: g++.law/operators4.C (test for excess errors)
-FAIL: g++.other/headers1.C (test for excess errors)
-XFAIL: g++.other/headers1.C Execution test
+PASS: g++.other/headers1.C (test for excess errors)
+PASS: g++.other/headers1.C Execution test
-FAIL: g++.robertl/eb3.C (test for excess errors)
+PASS: g++.robertl/eb3.C (test for excess errors)
-FAIL: 21_strings/inserters_extractors.cc execution test
+PASS: 21_strings/inserters_extractors.cc execution test
-FAIL: 22_locale/ctype_char_members.cc execution test
+PASS: 22_locale/ctype_char_members.cc execution test
-FAIL: 26_numerics/complex_inserters_extractors.cc execution test
+PASS: 26_numerics/complex_inserters_extractors.cc execution test
-FAIL: 27_io/istream_extractor_arith.cc execution test
+PASS: 27_io/istream_extractor_arith.cc execution test
-FAIL: 27_io/istream_manip.cc execution test
+PASS: 27_io/istream_manip.cc execution test
-FAIL: 27_io/istream_sentry.cc execution test
+PASS: 27_io/istream_sentry.cc execution test
So no regressions either.
Ok for branch and mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE
2001-07-13 H.J. Lu <hjl@gnu.org>
Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* c-pragma.h (ASM_OUTPUT_WEAK_ALIAS): Define if possible.
(HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and
ASM_OUTPUT_WEAK_ALIAS are defined.
* config/mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL):
Moved ...
* config/mips/iris5.h: ... here.
(HANDLE_SYSV_PRAGMA): Defined as 1.
* varasm.c (weak_finish): Use ASM_OUTPUT_WEAK_ALIAS.
* doc/tm.texi (ASM_OUTPUT_WEAK_ALIAS): Support the undefined weak
symbol.
===================================================================
RCS file: gcc/RCS/c-pragma.h,v
retrieving revision 1.1
diff -up -r1.1 gcc/c-pragma.h
--- gcc/c-pragma.h 2000/11/25 19:28:42 1.1
+++ gcc/c-pragma.h 2000/11/25 18:28:42
@@ -22,11 +22,23 @@ Boston, MA 02111-1307, USA. */
#define _C_PRAGMA_H
#ifdef HANDLE_SYSV_PRAGMA
-/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are
- defined. */
-#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
+/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIAS
+ or ASM_OUTPUT_DEF are defined. */
+#ifdef ASM_WEAKEN_LABEL
+#if !defined (ASM_OUTPUT_WEAK_ALIAS) && defined (ASM_OUTPUT_DEF)
+#define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE) \
+ do \
+ { \
+ ASM_WEAKEN_LABEL (STREAM, NAME); \
+ if (VALUE) \
+ ASM_OUTPUT_DEF (STREAM, NAME, VALUE); \
+ } \
+ while (0)
+#endif
+#ifdef ASM_OUTPUT_WEAK_ALIAS
#define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
#endif
+#endif
/* We always support #pragma pack for SYSV pragmas. */
#ifndef HANDLE_PRAGMA_PACK
===================================================================
RCS file: gcc/config/mips/RCS/iris5.h,v
retrieving revision 1.1
diff -up -r1.1 gcc/config/mips/iris5.h
--- gcc/config/mips/iris5.h 2001/03/15 18:55:59 1.1
+++ gcc/config/mips/iris5.h 2001/03/15 17:55:59
@@ -165,3 +169,26 @@ do { \
tree name_tree = get_identifier (NAME); \
TREE_ASM_WRITTEN (name_tree) = 1; \
} while (0)
+
+/* This is how we tell the assembler that a symbol is weak. */
+
+#define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE) \
+ do \
+ { \
+ ASM_GLOBALIZE_LABEL (FILE, NAME); \
+ fputs ("\t.weakext\t", FILE); \
+ assemble_name (FILE, NAME); \
+ if (VALUE) \
+ { \
+ fputc (' ', FILE); \
+ assemble_name (FILE, VALUE); \
+ } \
+ fputc ('\n', FILE); \
+ } \
+ while (0)
+
+#define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0)
+
+/* Handle #pragma weak and #pragma pack. */
+#undef HANDLE_SYSV_PRAGMA
+#define HANDLE_SYSV_PRAGMA 1
===================================================================
RCS file: gcc/config/mips/RCS/iris6.h,v
retrieving revision 1.1
diff -up -r1.1 gcc/config/mips/iris6.h
--- gcc/config/mips/iris6.h 2001/06/11 20:29:43 1.1
+++ gcc/config/mips/iris6.h 2001/06/11 18:29:43
@@ -205,23 +207,6 @@ Boston, MA 02111-1307, USA. */
#define TYPE_ASM_OP "\t.type\t"
#define SIZE_ASM_OP "\t.size\t"
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
- do { \
- ASM_GLOBALIZE_LABEL (FILE, NAME); \
- fputs ("\t.weakext\t", FILE); \
- assemble_name (FILE, NAME); \
- if (VALUE) \
- { \
- fputc (' ', FILE); \
- assemble_name (FILE, VALUE); \
- } \
- fputc ('\n', FILE); \
- } while (0)
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
-
/* Irix assembler does not support the init_priority C++ attribute. */
#undef SUPPORTS_INIT_PRIORITY
#define SUPPORTS_INIT_PRIORITY 0
===================================================================
RCS file: gcc/doc/RCS/tm.texi,v
retrieving revision 1.1
diff -up -r1.1 gcc/doc/tm.texi
--- gcc/doc/tm.texi 2001/06/14 22:54:21 1.1
+++ gcc/doc/tm.texi 2001/06/14 20:54:21
@@ -6320,7 +6320,8 @@ correct for most systems.
@item ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
A C statement to output to the stdio stream @var{stream} assembler code
which defines (equates) the weak symbol @var{name} to have the value
-@var{value}.
+@var{value}. If @var{value} is @code{NULL}, it defines @var{name} as
+an undefined weak symbol.
Define this macro if the target only supports weak aliases; define
ASM_OUTPUT_DEF instead if possible.
===================================================================
RCS file: gcc/RCS/varasm.c,v
retrieving revision 1.1
diff -up -r1.1 gcc/varasm.c
--- gcc/varasm.c 2001/05/17 18:07:33 1.1
+++ gcc/varasm.c 2001/05/17 16:07:33
@@ -4777,11 +4777,7 @@ weak_finish ()
for (t = weak_decls; t; t = t->next)
{
if (t->name)
- {
- ASM_WEAKEN_LABEL (asm_out_file, t->name);
- if (t->value)
- ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
- }
+ ASM_OUTPUT_WEAK_ALIAS (asm_out_file, t->name, t->value);
}
}
#endif