aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.cc
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2024-01-09 11:40:14 +0100
committerIlya Leoshkevich <iii@linux.ibm.com>2024-01-12 10:51:53 +0100
commitd8c1361220ba7617adf4ccc396499f6393ec223e (patch)
treeeac8330190da6e9568ea27927cb7bb4a78a845f9 /gcc/varasm.cc
parent9073084a0648906c46dea5ed05650e94cf16a6ee (diff)
downloadgcc-d8c1361220ba7617adf4ccc396499f6393ec223e.zip
gcc-d8c1361220ba7617adf4ccc396499f6393ec223e.tar.gz
gcc-d8c1361220ba7617adf4ccc396499f6393ec223e.tar.bz2
rs6000: Fix ASAN linker errors for Power ELF V1 ABI [PR113284]
rs6000_elf_declare_function_name () outputs Power ELF V1 ABI function entry labels without using ASM_OUTPUT_FUNCTION_LABEL (). As a result, .LASANPC labels are not emitted, causing linker errors. In theory, it is possible to reuse ASM_OUTPUT_FUNCTION_LABEL () by changing rs6000_output_function_entry () to generate label names without outputting them, but this would be quite a large change. Instead, factor out the .LASANPC emitting code from ASM_OUTPUT_FUNCTION_LABEL () and call it manually. Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL") Suggested-by: Jakub Jelinek <jakub@redhat.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> gcc/ChangeLog: PR sanitizer/113284 * config/rs6000/rs6000.cc (rs6000_elf_declare_function_name): Use assemble_function_label_final () for Power ELF V1 ABI. * output.h (assemble_function_label_final): New function. * varasm.cc (assemble_function_label_raw): Use assemble_function_label_final (). (assemble_function_label_final): New function.
Diffstat (limited to 'gcc/varasm.cc')
-rw-r--r--gcc/varasm.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 1a869ae..2b63382 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -1843,6 +1843,15 @@ void
assemble_function_label_raw (FILE *file, const char *name)
{
ASM_OUTPUT_LABEL (file, name);
+ assemble_function_label_final ();
+}
+
+/* Finish outputting function label. Needs to be called when outputting
+ function label without using assemble_function_label_raw (). */
+
+void
+assemble_function_label_final (void)
+{
if ((flag_sanitize & SANITIZE_ADDRESS)
/* Notify ASAN only about the first function label. */
&& (in_cold_section_p == first_function_block_is_cold)