Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 1 | From 761fa6e3e37608cfd1b288e721a2ff89288cd6aa Mon Sep 17 00:00:00 2001 |
| 2 | From: Szabolcs Nagy <nsz@port70.net> |
| 3 | Date: Sat, 24 Oct 2015 20:09:53 +0000 |
| 4 | Subject: [PATCH 32/39] libgcc_s: Use alias for __cpu_indicator_init instead of |
| 5 | symver |
| 6 | |
| 7 | Adapter from |
| 8 | |
| 9 | https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html |
| 10 | |
| 11 | This fix was debated but hasnt been applied gcc upstream since |
| 12 | they expect musl to support '@' in symbol versioning which is |
| 13 | a sun/gnu versioning extention. This patch however avoids the |
| 14 | need for the '@' symbols at all |
| 15 | |
| 16 | libgcc/Changelog: |
| 17 | |
| 18 | 2015-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 | |
| 25 | gcc/Changelog: |
| 26 | |
| 27 | 2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com> |
| 28 | |
| 29 | * config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init |
| 30 | call __cpu_indicator_init_local instead of __cpu_indicator_init. |
| 31 | |
| 32 | Upstream-Status: Pending |
| 33 | |
| 34 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 35 | --- |
| 36 | gcc/config/i386/i386.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 | |
| 41 | diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c |
| 42 | index 1bca5a7eea6..096c4bc8e25 100644 |
| 43 | --- a/gcc/config/i386/i386.c |
| 44 | +++ b/gcc/config/i386/i386.c |
| 45 | @@ -36685,10 +36685,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, |
| 46 | { |
| 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 | } |
| 58 | diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c |
| 59 | index d6cb2de6265..ce04ef78205 100644 |
| 60 | --- a/libgcc/config/i386/cpuinfo.c |
| 61 | +++ b/libgcc/config/i386/cpuinfo.c |
| 62 | @@ -504,7 +504,7 @@ __cpu_indicator_init (void) |
| 63 | return 0; |
| 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 |
| 73 | diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux |
| 74 | index 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) |
| 84 | -- |
| 85 | 2.25.1 |
| 86 | |