re PR c++/14808 ([win32] Undefined results with virtual base classes)

PR c++/14808
	* defaults.h (TARGET_USE_LOCAL_THUNK_ALIAS_P): New macro. Default
	to 1 if ASM_OUTPUT_DEF is defined.
	* doc/tm.texi (TARGET_USE_LOCAL_THUNK_ALIAS_P): Document.
	* config/i386/cygming.h (TARGET_USE_LOCAL_THUNK_ALIAS_P): Define.
	Set to non-zero iff not a one_only decl.

	* cp/method.c (use_thunk): Test TARGET_USE_LOCAL_THUNK_ALIAS_P rather
	than ASM_OUTPUT_DEF.

From-SVN: r80525
This commit is contained in:
Danny Smith 2004-04-08 22:31:23 +00:00 committed by Danny Smith
parent cc81dde821
commit 4a77e08cfc
6 changed files with 44 additions and 8 deletions

View File

@ -1,3 +1,12 @@
2004-04-08 Danny Smith <dannysmith@users.sourceforge.net>
PR c++/14808
* defaults.h (TARGET_USE_LOCAL_THUNK_ALIAS_P): New macro. Default
to 1 if ASM_OUTPUT_DEF is defined.
* doc/tm.texi (TARGET_USE_LOCAL_THUNK_ALIAS_P): Document.
* config/i386/cygming.h (TARGET_USE_LOCAL_THUNK_ALIAS_P): Define.
Set to non-zero iff not a one_only decl.
2004-04-08 Paul Brook <paul@codesourcery.com>
* arm.h (CLASS_LIKELY_SPILLED_P): Define.

View File

@ -382,6 +382,11 @@ extern int i386_pe_dllimport_name_p (const char *);
ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET)); \
} while (0)
/* Decide whether it is safe to use a local alias for a virtual function
when constructing thunks. */
#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
#undef TREE
#ifndef BUFSIZ

View File

@ -1,3 +1,9 @@
2004-04-08 Danny Smith <dannysmith@users.sourceforge.net>
PR c++/14808
* method.c (use_thunk): Test TARGET_USE_LOCAL_THUNK_ALIAS_P rather
than ASM_OUTPUT_DEF.
2004-04-08 Jakub Jelinek <jakub@redhat.com>
* decl2.c (mark_used): Don't segfault if cfun != NULL but

View File

@ -363,11 +363,10 @@ use_thunk (tree thunk_fndecl, bool emit_p)
if (!emit_p)
return;
#ifdef ASM_OUTPUT_DEF
alias = make_alias_for_thunk (function);
#else
alias = function;
#endif
if (TARGET_USE_LOCAL_THUNK_ALIAS_P (function))
alias = make_alias_for_thunk (function);
else
alias = function;
fixed_offset = THUNK_FIXED_OFFSET (thunk_fndecl);
virtual_offset = THUNK_VIRTUAL_OFFSET (thunk_fndecl);
@ -401,8 +400,8 @@ use_thunk (tree thunk_fndecl, bool emit_p)
push_to_top_level ();
#ifdef ASM_OUTPUT_DEF
if (targetm.have_named_sections)
if (TARGET_USE_LOCAL_THUNK_ALIAS_P (function)
&& targetm.have_named_sections)
{
resolve_unique_section (function, 0, flag_function_sections);
@ -414,7 +413,6 @@ use_thunk (tree thunk_fndecl, bool emit_p)
DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function);
}
}
#endif
/* The back-end expects DECL_INITIAL to contain a BLOCK, so we
create one. */

View File

@ -484,6 +484,16 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
#define TARGET_VTABLE_DATA_ENTRY_DISTANCE 1
#endif
/* Decide whether it is safe to use a local alias for a virtual function
when constructing thunks. */
#ifndef TARGET_USE_LOCAL_THUNK_ALIAS_P
#ifdef ASM_OUTPUT_DEF
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) 1
#else
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) 0
#endif
#endif
/* Select a format to encode pointers in exception handling data. We
prefer those that result in fewer dynamic relocations. Assume no
special support here and encode direct references. */

View File

@ -9209,3 +9209,11 @@ The parameter @var{path} is the include to register. On Darwin
systems, this is used for Framework includes, which have semantics
that are different from @option{-I}.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_USE_LOCAL_THUNK_ALIAS_P (tree @var{fndecl})
This target hook returns @code{true} if it is safe to use a local alias
for a virtual function @var{fndecl} when constructing thunks,
@code{false} otherwise. By default, the hook returns @code{true} for all
functions, if a target supports aliases (ie. defines
@code{ASM_OUTPUT_DEF}), @code{false} otherwise,
@end deftypefn