* [PATCH] Re: 21 GCC HEAD regressions, 2 new, with your patch on 2004-07-07T22:45:18Z.
[not found] <20040709055003.GA29236@lucon.org>
@ 2004-07-09 6:24 ` Andrew Pinski
2004-07-09 7:10 ` H. J. Lu
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2004-07-09 6:24 UTC (permalink / raw)
To: gcc-patches; +Cc: gcc, Andrew Pinski, Andrew Pinski
>
> It looks like we may need a undo_make_decl_one_only if we have to
> change our mind like that.
Yes and I was just creating one.
Here is the patch which fixes the problem for me on
powerpc-apple-darwin.
OK? Bootstrapped on powerpc-apple-darwin.
I have not added to the other targets which need the macro also.
The C++ part and the other target support is needed for the 3.4 branch
also.
Thanks,
Andrew Pinski
ChangLog:
* config/darwin-protos.h (darwin_make_decl_non_one_only): Prototype.
* config/darwin.c (darwin_make_decl_non_one_only): Declare.
* config/darwin.h (MAKE_DECL_NON_ONE_ONLY): Declare.
* doc/tm.texi (MAKE_DECL_NON_ONE_ONLY): Document.
cp/ChangeLog:
* cp/rtti.c (emit_tinfo_decl): Call MAKE_DECL_NON_ONE_ONLY when
making the decl non weak.
Index: config/darwin-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin-protos.h,v
retrieving revision 1.35
diff -u -p -r1.35 darwin-protos.h
--- config/darwin-protos.h 19 May 2004 02:11:42 -0000 1.35
+++ config/darwin-protos.h 9 Jul 2004 05:54:57 -0000
@@ -85,6 +85,7 @@ extern void darwin_pragma_unused (struct
extern void darwin_file_end (void);
extern void darwin_make_decl_one_only (tree decl);
+extern void darwin_make_decl_non_one_only (tree decl);
/* Expanded by EXTRA_SECTION_FUNCTIONS into varasm.o. */
extern void const_section (void);
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.70
diff -u -p -r1.70 darwin.c
--- config/darwin.c 8 Jul 2004 00:12:27 -0000 1.70
+++ config/darwin.c 9 Jul 2004 05:54:57 -0000
@@ -1142,6 +1142,14 @@ darwin_make_decl_one_only (tree decl)
}
void
+darwin_make_decl_non_one_only (tree decl)
+{
+ TREE_PUBLIC (decl) = 0;
+ DECL_ONE_ONLY (decl) = 0;
+ DECL_SECTION_NAME (decl) = NULL;
+}
+
+void
machopic_select_section (tree exp, int reloc,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
Index: config/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.83
diff -u -p -r1.83 darwin.h
--- config/darwin.h 8 Jul 2004 00:12:27 -0000 1.83
+++ config/darwin.h 9 Jul 2004 05:54:57 -0000
@@ -336,6 +336,10 @@ do { text_section (); \
/* Making a symbols weak on Darwin requires more than just setting
DECL_WEAK. */
#define MAKE_DECL_ONE_ONLY(DECL) darwin_make_decl_one_only (DECL)
+/* Making a symbol non-weak again on Darwin requires more than just
setting
+ DECL_WEAK. */
+#define MAKE_DECL_NON_ONE_ONLY(DECL) darwin_make_decl_non_one_only
(DECL)
+
/* Representation of linkonce symbols for the MACH-O assembler.
Linkonce
symbols must be given a special section *and* must be preceded by a
special assembler directive. */
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/rtti.c,v
retrieving revision 1.186
diff -u -p -r1.186 rtti.c
--- cp/rtti.c 7 Jul 2004 18:29:38 -0000 1.186
+++ cp/rtti.c 9 Jul 2004 05:54:57 -0000
@@ -1464,7 +1464,15 @@ emit_tinfo_decl (tree decl)
{
DECL_COMDAT (decl) = 0;
if (SUPPORTS_ONE_ONLY)
- DECL_ONE_ONLY (decl) = 0;
+ {
+ if (DECL_ONE_ONLY (decl))
+ {
+#ifdef MAKE_DECL_NON_ONE_ONLY
+ MAKE_DECL_NON_ONE_ONLY (decl);
+#endif
+ DECL_ONE_ONLY (decl) = 0;
+ }
+ }
}
DECL_INITIAL (decl) = var_init;
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.337
diff -u -p -r1.337 tm.texi
--- doc/tm.texi 5 Jul 2004 19:49:20 -0000 1.337
+++ doc/tm.texi 9 Jul 2004 05:54:58 -0000
@@ -6763,6 +6763,13 @@ section flags in the Microsoft Windows P
requires changes to @var{decl}, such as putting it in a separate
section.
@end defmac
+@defmac MAKE_DECL_NON_ONE_ONLY (@var{decl})
+A C statement (sans semicolon) to mark @var{decl} to be emitted as a
+public symbol such that extra copies in multiple translation units will
+be not discarded by the linker. This is used to revert the effects of
+the MAKE_DECL_ONE_ONLY macro.
+@end defmac
+
@defmac SUPPORTS_ONE_ONLY
A C expression which evaluates to true if the target supports one-only
semantics.
^ permalink raw reply [flat|nested] 2+ messages in thread