[PATCH] alpha: enable gnu-indirect-function support for alpha-linux

Matt Turner <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
Add alpha*-* to the list of targets that default to
--enable-gnu-indirect-function on glibc-based Linux systems.  This
sets HAVE_GNU_INDIRECT_FUNCTION=1, making targetm.has_ifunc_p() return
true and enabling __attribute__((ifunc)) support.

No Alpha backend changes are needed — the generic ifunc machinery in
varasm.cc handles emission, and alpha/elf.h already provides the
required ASM_OUTPUT_TYPE_DIRECTIVE and ASM_OUTPUT_DEF macros.

Requires binutils support for R_ALPHA_IRELATIVE and glibc dynamic
linker support for the new relocation.

The binutils patch series adding STT_GNU_IFUNC and R_ALPHA_IRELATIVE
support has been sent to the binutils list:

  https://sourceware.org/pipermail/binutils/2026-August/150713.html

glibc dynamic linker support for R_ALPHA_IRELATIVE will follow.

Tested by cross-compiling gcc.dg/attr-ifunc-{1..5}.c and
g++.dg/ext/attr-ifunc-{1..5}.C targeting alpha-linux-gnu.  GCC
correctly emits .type foo, @gnu_indirect_function and the resulting
binaries contain STT_GNU_IFUNC symbols.  Runtime tests require the
pending glibc dynamic linker patch.
---
 gcc/config.gcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git ./gcc/config.gcc ./gcc/config.gcc
index 6968d666b89..aade3c6b152 100644
--- ./gcc/config.gcc
+++ ./gcc/config.gcc
@@ -3685,7 +3685,7 @@ case ${target} in
         ;;
 *-*-linux* | *-*-gnu*)
 	case ${target} in
-	aarch64*-* | arm*-* | i[34567]86-* | powerpc*-* | s390*-* | sparc*-* | x86_64-* | loongarch*-*)
+	aarch64*-* | alpha*-* | arm*-* | i[34567]86-* | powerpc*-* | s390*-* | sparc*-* | x86_64-* | loongarch*-*)
 		default_gnu_indirect_function=yes
 		;;
 	esac
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.