blob: 3f666dc7bd543c6f7f61826c54e2ca332fca365d [file] [log] [blame]
Andrew Geisslerc926e172021-05-07 16:11:35 -05001From ea9154338cb3acbd75945fddde4202e73c20dd1a Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
Andrew Geisslerc182c622020-05-15 14:13:32 -05004Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
Andrew Geissler82c905d2020-04-13 13:39:40 -05005 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
Andrew Geisslerc182c622020-05-15 14:13:32 -050029 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
Andrew Geissler82c905d2020-04-13 13:39:40 -050030 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---
Andrew Geisslerc182c622020-05-15 14:13:32 -050036 gcc/config/i386/i386-expand.c | 4 ++--
37 libgcc/config/i386/cpuinfo.c | 6 +++---
38 libgcc/config/i386/t-linux | 2 +-
Andrew Geissler82c905d2020-04-13 13:39:40 -050039 3 files changed, 6 insertions(+), 6 deletions(-)
40
Andrew Geisslerc182c622020-05-15 14:13:32 -050041diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
Andrew Geisslerc926e172021-05-07 16:11:35 -050042index ac69eed4d32..ffaa44a16fc 100644
Andrew Geisslerc182c622020-05-15 14:13:32 -050043--- a/gcc/config/i386/i386-expand.c
44+++ b/gcc/config/i386/i386-expand.c
Andrew Geisslerc926e172021-05-07 16:11:35 -050045@@ -11038,10 +11038,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
Andrew Geissler82c905d2020-04-13 13:39:40 -050046 {
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
Andrew Geisslerc926e172021-05-07 16:11:35 -050059index ef463848f9d..1a3de052c80 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050060--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
Andrew Geisslerc926e172021-05-07 16:11:35 -050062@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
63 __cpu_features2);
Andrew Geissler82c905d2020-04-13 13:39:40 -050064 }
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)