public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of symver
@ 2023-02-22 12:23 Yash Shinde
  2023-02-23 10:49 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Yash Shinde @ 2023-02-22 12:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: raj.khem, Randy.MacLeod, Sundeep.Kokkonda

From: Khem Raj <raj.khem@gmail.com>

Adapter from

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html

This fix was debated but hasnt been applied gcc upstream since
they expect musl to support '@' in symbol versioning which is
a sun/gnu versioning extention. This patch however avoids the
need for the '@' symbols at all

libgcc/Changelog:

2015-05-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

        * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
        (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.

        * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.

gcc/Changelog:

2015-05-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>

        * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
        call __cpu_indicator_init_local instead of __cpu_indicator_init.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Yash Shinde <yash.shinde@windriver.com>
---
 gcc/config/i386/i386-expand.cc | 4 ++--
 libgcc/config/i386/cpuinfo.c   | 6 +++---
 libgcc/config/i386/t-linux     | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 3eddbc94360..aee05e813cc 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -12647,10 +12647,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
     {
     case IX86_BUILTIN_CPU_INIT:
       {
-	/* Make it call __cpu_indicator_init in libgcc.  */
+	/* Make it call __cpu_indicator_init_local in libgcc.a.  */
 	tree call_expr, fndecl, type;
 	type = build_function_type_list (integer_type_node, NULL_TREE);
-	fndecl = build_fn_decl ("__cpu_indicator_init", type);
+	fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
 	call_expr = build_call_expr (fndecl, 0);
 	return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
       }
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index dab1d98060f..cf824b4114a 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
 			     __cpu_features2);
 }
 
-#if defined SHARED && defined USE_ELF_SYMVER
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
+#ifndef SHARED
+int __cpu_indicator_init_local (void)
+  __attribute__ ((weak, alias ("__cpu_indicator_init")));
 #endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
 # t-slibgcc-elf-ver and t-linux
 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
 
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
 CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
-- 
2.39.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of symver
  2023-02-22 12:23 [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of symver Yash Shinde
@ 2023-02-23 10:49 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2023-02-23 10:49 UTC (permalink / raw)
  To: Yash Shinde; +Cc: gcc-patches, raj.khem, Randy.MacLeod, Sundeep.Kokkonda

On Wed, Feb 22, 2023 at 04:23:33AM -0800, Yash Shinde wrote:
> From: Khem Raj <raj.khem@gmail.com>
> 
> Adapter from
> 
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
> 
> This fix was debated but hasnt been applied gcc upstream since
> they expect musl to support '@' in symbol versioning which is
> a sun/gnu versioning extention. This patch however avoids the
> need for the '@' symbols at all

This is an undesirable ABI change:
-__cpu_indicator_init@GCC_4.8.0 FUNC GLOBAL DEFAULT
-__cpu_model@GCC_4.8.0 OBJECT GLOBAL DEFAULT 16
+__cpu_indicator_init@@GCC_4.8.0 FUNC GLOBAL DEFAULT
+__cpu_model@@GCC_4.8.0 OBJECT GLOBAL DEFAULT 16

So, this is certainly unacceptable.

> libgcc/Changelog:
> 
> 2015-05-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
>         * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
>         (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
> 
>         * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
> 
> gcc/Changelog:
> 
> 2015-05-11  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
>         * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
>         call __cpu_indicator_init_local instead of __cpu_indicator_init.

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-23 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 12:23 [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of symver Yash Shinde
2023-02-23 10:49 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).