rs6000: Fix ASAN linker errors for Power ELF V1 ABI [PR113284]

Message ID 20240109105253.332676-1-iii@linux.ibm.com
State New
Headers
Series rs6000: Fix ASAN linker errors for Power ELF V1 ABI [PR113284] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed

Commit Message

Ilya Leoshkevich Jan. 9, 2024, 10:51 a.m. UTC
  Bootstrap and regtest running on ppc64le-redhat-linux and
powerpc64-linux-gnu.  Ok for trunk when successful?



Use ASM_OUTPUT_FUNCTION_LABEL () instead of ASM_OUTPUT_LABEL () in
the Power ELF V1 ABI branch of rs6000_elf_declare_function_name () to
ensure that the .LASANPC label is emitted.  The other branches already
use the correct macro.

Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

gcc/ChangeLog:

	PR sanitizer/113284
	* config/rs6000/rs6000.cc (rs6000_elf_declare_function_name):
	Use ASM_OUTPUT_FUNCTION_LABEL () for Power ELF V1 ABI.
---
 gcc/config/rs6000/rs6000.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jakub Jelinek Jan. 9, 2024, 11:07 a.m. UTC | #1
On Tue, Jan 09, 2024 at 11:51:16AM +0100, Ilya Leoshkevich wrote:
> Bootstrap and regtest running on ppc64le-redhat-linux and
> powerpc64-linux-gnu.  Ok for trunk when successful?
> 
> 
> 
> Use ASM_OUTPUT_FUNCTION_LABEL () instead of ASM_OUTPUT_LABEL () in
> the Power ELF V1 ABI branch of rs6000_elf_declare_function_name () to
> ensure that the .LASANPC label is emitted.  The other branches already
> use the correct macro.
> 
> Fixes: c659dd8bfb55 ("Implement ASM_DECLARE_FUNCTION_NAME using ASM_OUTPUT_FUNCTION_LABEL")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> 
> gcc/ChangeLog:
> 
> 	PR sanitizer/113284
> 	* config/rs6000/rs6000.cc (rs6000_elf_declare_function_name):
> 	Use ASM_OUTPUT_FUNCTION_LABEL () for Power ELF V1 ABI.

IMNSHO this is incorrect, please see the PR.

	Jakub
  

Patch

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 94fbf46f2b6..fd9bb807957 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -21334,7 +21334,7 @@  rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl)
   if (TARGET_64BIT && DEFAULT_ABI != ABI_ELFv2)
     {
       fputs ("\t.section\t\".opd\",\"aw\"\n\t.align 3\n", file);
-      ASM_OUTPUT_LABEL (file, name);
+      ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);
       fputs (DOUBLE_INT_ASM_OP, file);
       rs6000_output_function_entry (file, name);
       fputs (",.TOC.@tocbase,0\n\t.previous\n", file);