blob: f915f284eaf9f7426d370629a45539cdc071245e [file] [log] [blame]
Patrick Williams2194f502022-10-16 14:26:09 -05001From b3957bc1fd52ec427a1b71b10055905cab4bbc7c Mon Sep 17 00:00:00 2001
Brad Bishopbec4ebc2022-08-03 09:55:16 -04002From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
5 symver
6
7Adapter from
8
9https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
10
11This fix was debated but hasnt been applied gcc upstream since
12they expect musl to support '@' in symbol versioning which is
13a sun/gnu versioning extention. This patch however avoids the
14need for the '@' symbols at all
15
16libgcc/Changelog:
17
182015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
19
20 * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
21 (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
22
23 * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
24
25gcc/Changelog:
26
272015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
28
29 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31
32Upstream-Status: Pending
33
34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35---
36 gcc/config/i386/i386-expand.c | 4 ++--
37 libgcc/config/i386/cpuinfo.c | 6 +++---
38 libgcc/config/i386/t-linux | 2 +-
39 3 files changed, 6 insertions(+), 6 deletions(-)
40
41diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
Patrick Williams2194f502022-10-16 14:26:09 -050042index 31eae75d277..ec7e858ec83 100644
Brad Bishopbec4ebc2022-08-03 09:55:16 -040043--- a/gcc/config/i386/i386-expand.c
44+++ b/gcc/config/i386/i386-expand.c
Patrick Williams2194f502022-10-16 14:26:09 -050045@@ -11066,10 +11066,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
Brad Bishopbec4ebc2022-08-03 09:55:16 -040046 {
47 case IX86_BUILTIN_CPU_INIT:
48 {
49- /* Make it call __cpu_indicator_init in libgcc. */
50+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
51 tree call_expr, fndecl, type;
52 type = build_function_type_list (integer_type_node, NULL_TREE);
53- fndecl = build_fn_decl ("__cpu_indicator_init", type);
54+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
55 call_expr = build_call_expr (fndecl, 0);
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index ef463848f9d..1a3de052c80 100644
60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
63 __cpu_features2);
64 }
65
66-#if defined SHARED && defined USE_ELF_SYMVER
67-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
68-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
69+#ifndef SHARED
70+int __cpu_indicator_init_local (void)
71+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
72 #endif
73diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
74index 8506a635790..564296f788e 100644
75--- a/libgcc/config/i386/t-linux
76+++ b/libgcc/config/i386/t-linux
77@@ -3,5 +3,5 @@
78 # t-slibgcc-elf-ver and t-linux
79 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
80
81-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
82+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
83 CRTSTUFF_T_CFLAGS += $(CET_FLAGS)