aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.cc
diff options
context:
space:
mode:
authorKewen.Lin <linkw@gcc.gnu.org>2022-11-24 21:17:28 -0600
committerKewen Lin <linkw@linux.ibm.com>2022-11-24 21:17:28 -0600
commitf120196382ac5ac49ec4a60f8abad42f22d45a91 (patch)
tree3e3db2e70fb65301de650e04b07e70cebe429620 /gcc/varasm.cc
parent4581328022615c2cb732cfb404151c4b059d26e3 (diff)
downloadgcc-f120196382ac5ac49ec4a60f8abad42f22d45a91.zip
gcc-f120196382ac5ac49ec4a60f8abad42f22d45a91.tar.gz
gcc-f120196382ac5ac49ec4a60f8abad42f22d45a91.tar.bz2
Adjust the symbol for SECTION_LINK_ORDER linked_to section [PR99889]
As discussed in PR98125, -fpatchable-function-entry with SECTION_LINK_ORDER support doesn't work well on powerpc64 ELFv1 because the filled "Symbol" in .section name,"flags"o,@type,Symbol sits in .opd section instead of in the function_section like .text or named .text*. Since we already generates one label LPFE* which sits in function_section of current_function_decl, this patch is to reuse it as the symbol for the linked_to section. It avoids the above ABI specific issue when using the symbol concluded from current_function_decl. Besides, with this support some previous workarounds can be reverted. PR target/99889 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry): Adjust to call function default_print_patchable_function_entry. * targhooks.cc (default_print_patchable_function_entry_1): Remove and move the flags preparation ... (default_print_patchable_function_entry): ... here, adjust to use current_function_funcdef_no for label no. * targhooks.h (default_print_patchable_function_entry_1): Remove. * varasm.cc (default_elf_asm_named_section): Adjust code for __patchable_function_entries section support with LPFE label. gcc/testsuite/ChangeLog: * g++.dg/pr93195a.C: Remove the skip on powerpc*-*-* 64-bit. * gcc.target/aarch64/pr92424-2.c: Adjust LPFE1 with LPFE0. * gcc.target/aarch64/pr92424-3.c: Likewise. * gcc.target/i386/pr93492-2.c: Likewise. * gcc.target/i386/pr93492-3.c: Likewise. * gcc.target/i386/pr93492-4.c: Likewise. * gcc.target/i386/pr93492-5.c: Likewise.
Diffstat (limited to 'gcc/varasm.cc')
-rw-r--r--gcc/varasm.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index d0beac8..9dfbebb 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -6915,11 +6915,16 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
if (flags & SECTION_LINK_ORDER)
{
- tree id = DECL_ASSEMBLER_NAME (decl);
- ultimate_transparent_alias_target (&id);
- const char *name = IDENTIFIER_POINTER (id);
- name = targetm.strip_name_encoding (name);
- fprintf (asm_out_file, ",%s", name);
+ /* For now, only section "__patchable_function_entries"
+ adopts flag SECTION_LINK_ORDER, internal label LPFE*
+ was emitted in default_print_patchable_function_entry,
+ just place it here for linked_to section. */
+ gcc_assert (!strcmp (name, "__patchable_function_entries"));
+ fprintf (asm_out_file, ",");
+ char buf[256];
+ ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE",
+ current_function_funcdef_no);
+ assemble_name_raw (asm_out_file, buf);
}
if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
{