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