aboutsummaryrefslogtreecommitdiff
path: root/gcc/langhooks.c
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2007-05-24 10:11:49 +0000
committerDanny Smith <dannysmith@gcc.gnu.org>2007-05-24 10:11:49 +0000
commit5234b8f573b0c5fa3c2c2694d183668423382b23 (patch)
treef82b188a73ec315cce237f81bc0dfa75447a66db /gcc/langhooks.c
parent4f5497a9245ac73f32f4d202e3b7497c61e79925 (diff)
downloadgcc-5234b8f573b0c5fa3c2c2694d183668423382b23.zip
gcc-5234b8f573b0c5fa3c2c2694d183668423382b23.tar.gz
gcc-5234b8f573b0c5fa3c2c2694d183668423382b23.tar.bz2
re PR target/27067 (Compile errors with multiple inheritance where the stdcall attribute is applied to virtual functions.)
ChangeLog PR target/27067 * doc/tm.texi (TARGET_MANGLE_DECL_ASSEMBLER_NAME): Document. * targhooks.h (default_mangle_decl_assembler_name): Declare default hook. * targhooks.c (default_mangle_decl_assembler_name): Define default hook. * target-def.h (TARGET_MANGLE_DECL_ASSEMBLER_NAME) New. Set to default hook. * target.h (struct gcc_target): Add mangle_decl_assembler_name field. * langhooks.c (lhd_set_decl_assembler_name): Call targetm.mangle_decl_assembler_name for names with global scope. * config/i386/cygming.h (TARGET_MANGLE_DECL_ASSEMBLER_NAME) Override default. (ASM_OUTPUT_DEF_FROM_DECLS): Simplify to use DECL_ASSEMBLER_NAME. * config/i386/i386-protos.h (i386_pe_mangle_decl_assembler_name): Declare. * config/i386/winnt.c (i386_pe_maybe_mangle_decl_assembler_name): New. Factored out of i386_pe_encode_section_info. (gen_stdcall_or_fastcall_suffix): Get name identifier as argument. Move check for prior decoration of stdcall symbols to i386_pe_encode_section_info. (i386_pe_encode_section_info): Adjust call to gen_stdcall_or_fastcall_suffix. Use i386_pe_maybe_mangle_decl_assembler_name, if needed. (i386_pe_mangle_decl_assembler_name): New. Wrap i386_pe_maybe_mangle_decl_assembler_name. cp/ChangeLog * mangle.c (mangle_decl): Call targetm.mangle_decl_assembler_name. From-SVN: r125020
Diffstat (limited to 'gcc/langhooks.c')
-rw-r--r--gcc/langhooks.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index dc816ba..96234f6 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -34,6 +34,7 @@ Boston, MA 02110-1301, USA. */
#include "integrate.h"
#include "flags.h"
#include "langhooks.h"
+#include "target.h"
#include "langhooks-def.h"
#include "ggc.h"
#include "diagnostic.h"
@@ -147,6 +148,8 @@ lhd_warn_unused_global_decl (tree decl)
void
lhd_set_decl_assembler_name (tree decl)
{
+ tree id;
+
/* The language-independent code should never use the
DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and
VAR_DECLs for variables with static storage duration need a real
@@ -161,21 +164,26 @@ lhd_set_decl_assembler_name (tree decl)
as that used in the source language. (That's correct for C, and
GCC used to set DECL_ASSEMBLER_NAME to the same value as
DECL_NAME in build_decl, so this choice provides backwards
- compatibility with existing front-ends.
-
+ compatibility with existing front-ends. This assumption is wrapped
+ in a target hook, to allow for target-specific modification of the
+ identifier.
+
Can't use just the variable's own name for a variable whose scope
is less than the whole compilation. Concatenate a distinguishing
number - we use the DECL_UID. */
+
if (TREE_PUBLIC (decl) || DECL_CONTEXT (decl) == NULL_TREE)
- SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
+ id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
else
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
char *label;
ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
+ id = get_identifier (label);
}
+ SET_DECL_ASSEMBLER_NAME (decl, id);
+
}
/* Type promotion for variable arguments. */