gccint recommends using ASM_OUTPUT_FUNCTION_LABEL in
ASM_DECLARE_FUNCTION_NAME, but many implementations use
ASM_OUTPUT_LABEL instead. It's inconsistent and prevents changes to
ASM_OUTPUT_FUNCTION_LABEL from affecting the respective targets.
Link: https://inbox.sourceware.org/gcc-patches/20240102194511.3171559-2-iii@linux.ibm.com/
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
gcc/ChangeLog:
* config/aarch64/aarch64.cc (aarch64_declare_function_name):
Use ASM_OUTPUT_FUNCTION_LABEL ().
* config/alpha/alpha.cc (alpha_start_function): Likewise.
* config/arm/aout.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
* config/arm/arm.cc (arm_asm_declare_function_name): Likewise.
* config/bfin/bfin.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
* config/c6x/c6x.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
* config/gcn/gcn.cc (gcn_hsa_declare_function_name): Likewise.
* config/h8300/h8300.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
* config/ia64/ia64.cc (ia64_start_function): Likewise.
* config/mcore/mcore-elf.h (ASM_DECLARE_FUNCTION_NAME):
Likewise.
* config/microblaze/microblaze.cc (microblaze_function_prologue):
Likewise.
* config/mips/mips.cc (mips_start_unique_function): Return the
tree.
(mips_start_function_definition): Use
ASM_OUTPUT_FUNCTION_LABEL ().
(mips_finish_stub): Pass the tree to
mips_start_function_definition ().
(mips16_build_function_stub): Likewise.
(mips16_build_call_stub): Likewise.
(mips_output_function_prologue): Likewise.
* config/pa/pa.cc (pa_output_function_label): Use
ASM_OUTPUT_FUNCTION_LABEL ().
* config/riscv/riscv.cc (riscv_declare_function_name): Likewise.
* config/rs6000/rs6000.cc (rs6000_elf_declare_function_name):
Likewise.
(rs6000_xcoff_declare_function_name): Likewise.
/* Don't forget the type directive for ELF. */
ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "function");
- ASM_OUTPUT_LABEL (stream, name);
+ ASM_OUTPUT_FUNCTION_LABEL (stream, name, fndecl);
cfun->machine->label_is_assembled = true;
}
/* Output the textual info surrounding the prologue. */
void
-alpha_start_function (FILE *file, const char *fnname,
- tree decl ATTRIBUTE_UNUSED)
+alpha_start_function (FILE *file, const char *fnname, tree decl)
{
unsigned long imask, fmask;
/* Complete stack size needed. */
if (TARGET_ABI_OPEN_VMS)
strcat (entry_label, "..en");
- ASM_OUTPUT_LABEL (file, entry_label);
+ ASM_OUTPUT_FUNCTION_LABEL (file, entry_label, decl);
inside_function = TRUE;
if (TARGET_ABI_OPEN_VMS)
do \
{ \
ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
- ASM_OUTPUT_LABEL (STREAM, NAME); \
+ ASM_OUTPUT_FUNCTION_LABEL (STREAM, NAME, DECL); \
} \
while (0)
#endif
ARM_DECLARE_FUNCTION_NAME (file, name, decl);
ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
ASM_DECLARE_RESULT (file, DECL_RESULT (decl));
- ASM_OUTPUT_LABEL (file, name);
+ ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);
if (cmse_name)
ASM_OUTPUT_LABEL (file, cmse_name);
fputc ('\n',FILE); \
} while (0)
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
- do { \
- fputs (".type ", FILE); \
- assemble_name (FILE, NAME); \
- fputs (", STT_FUNC", FILE); \
- fputc (';',FILE); \
- fputc ('\n',FILE); \
- ASM_OUTPUT_LABEL(FILE, NAME); \
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ do { \
+ fputs (".type ", FILE); \
+ assemble_name (FILE, NAME); \
+ fputs (", STT_FUNC", FILE); \
+ fputc (';', FILE); \
+ fputc ('\n', FILE); \
+ ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
} while (0)
#define ASM_OUTPUT_LABEL(FILE, NAME) \
c6x_output_file_unwind (FILE); \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
+ ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
} \
while (0)
comments that pass information to mkoffload. */
void
-gcn_hsa_declare_function_name (FILE *file, const char *name, tree)
+gcn_hsa_declare_function_name (FILE *file, const char *name, tree decl)
{
int sgpr, vgpr, avgpr;
bool xnack_enabled = TARGET_XNACK;
fputs ("\t.type\t", file);
assemble_name (file, name);
fputs (",@function\n", file);
- assemble_name (file, name);
- fputs (":\n", file);
+ ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);
/* This comment is read by mkoffload. */
if (flag_openacc)
#define GLOBAL_ASM_OP "\t.global "
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- ASM_OUTPUT_LABEL (FILE, NAME)
+ ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL)
/* This is how to store into the string LABEL
the symbol_ref name of an internal numbered label where
/* Output the textual info surrounding the prologue. */
void
-ia64_start_function (FILE *file, const char *fnname,
- tree decl ATTRIBUTE_UNUSED)
+ia64_start_function (FILE *file, const char *fnname, tree decl)
{
#if TARGET_ABI_OPEN_VMS
vms_start_function (fnname);
fputs ("\t.proc ", file);
assemble_name (file, fnname);
fputc ('\n', file);
- ASM_OUTPUT_LABEL (file, fnname);
+ ASM_OUTPUT_FUNCTION_LABEL (file, fnname, decl);
}
/* Called after register allocation to add any instructions needed for the
} \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
+ ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
} \
while (0)
ASM_OUTPUT_TYPE_DIRECTIVE (file, fnname, "function");
}
- assemble_name (file, fnname);
- fputs (":\n", file);
+ ASM_OUTPUT_FUNCTION_LABEL (file, fnname, current_function_decl);
if (interrupt_handler && strcmp (INTERRUPT_HANDLER_NAME, fnname))
fputs ("_interrupt_handler:\n", file);
/* Declare a unique, locally-binding function called NAME, then start
its definition. */
-static void
+static tree
mips_start_unique_function (const char *name)
{
tree decl;
fputs ("\t.hidden\t", asm_out_file);
assemble_name (asm_out_file, name);
putc ('\n', asm_out_file);
+
+ return decl;
}
/* Start a definition of function NAME. MIPS16_P indicates whether the
function contains MIPS16 code. */
static void
-mips_start_function_definition (const char *name, bool mips16_p)
+mips_start_function_definition (const char *name, bool mips16_p, tree decl)
{
if (mips16_p)
fprintf (asm_out_file, "\t.set\tmips16\n");
ASM_OUTPUT_TYPE_DIRECTIVE (asm_out_file, name, "function");
/* Start the definition proper. */
- assemble_name (asm_out_file, name);
- fputs (":\n", asm_out_file);
+ ASM_OUTPUT_FUNCTION_LABEL (asm_out_file, name, decl);
}
/* End a function definition started by mips_start_function_definition. */
return;
const char *name = stub->get_name ();
- mips_start_unique_function (name);
- mips_start_function_definition (name, false);
+ tree decl = mips_start_unique_function (name);
+ mips_start_function_definition (name, false, decl);
stub->output_body ();
mips_end_function_definition (name);
delete stub;
/* Start the function definition. */
assemble_start_function (stubdecl, stubname);
- mips_start_function_definition (stubname, false);
+ mips_start_function_definition (stubname, false, stubdecl);
/* If generating pic2 code, either set up the global pointer or
switch to pic0. */
/* Start the function definition. */
assemble_start_function (stubdecl, stubname);
- mips_start_function_definition (stubname, false);
+ mips_start_function_definition (stubname, false, stubdecl);
if (fp_ret_p)
{
assemble_start_function. This is needed so that the name used here
exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
- mips_start_function_definition (fnname, TARGET_MIPS16);
+ mips_start_function_definition (fnname, TARGET_MIPS16, current_function_decl);
/* Output MIPS-specific frame information. */
if (!flag_inhibit_size_directive)
/* The function's label and associated .PROC must never be
separated and must be output *after* any profiling declarations
to avoid changing spaces/subspaces within a procedure. */
- ASM_OUTPUT_LABEL (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
+ const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+ ASM_OUTPUT_FUNCTION_LABEL (file, name, current_function_decl);
fputs ("\t.PROC\n", file);
/* pa_expand_prologue does the dirty work now. We just need
{
riscv_asm_output_variant_cc (stream, fndecl, name);
ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "function");
- ASM_OUTPUT_LABEL (stream, name);
+ ASM_OUTPUT_FUNCTION_LABEL (stream, name, fndecl);
if (DECL_FUNCTION_SPECIFIC_TARGET (fndecl))
{
fprintf (stream, "\t.option push\n");
fputs ("\t.long 0\n", file);
fprintf (file, "\t.previous\n");
}
- ASM_OUTPUT_LABEL (file, name);
+ ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);
}
static void rs6000_elf_file_end (void) ATTRIBUTE_UNUSED;
assemble_name (file, buffer);
fputs (TARGET_32BIT ? "\n" : ",3\n", file);
- ASM_OUTPUT_LABEL (file, buffer);
+ ASM_OUTPUT_FUNCTION_LABEL (file, buffer, decl);
symtab_node::get (decl)->call_for_symbol_and_aliases (rs6000_declare_alias,
&data, true);