0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From a32c75b37209d6836eaaa943dc6b1207acba5d27 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] libgcc_s: Use alias for __cpu_indicator_init instead of
  5. symver
  6. Adapter from
  7. https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
  8. This fix was debated but hasnt been applied gcc upstream since
  9. they expect musl to support '@' in symbol versioning which is
  10. a sun/gnu versioning extention. This patch however avoids the
  11. need for the '@' symbols at all
  12. libgcc/Changelog:
  13. 2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
  14. * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
  15. (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
  16. * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
  17. gcc/Changelog:
  18. 2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
  19. * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
  20. call __cpu_indicator_init_local instead of __cpu_indicator_init.
  21. Upstream-Status: Pending
  22. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  23. ---
  24. gcc/config/i386/i386-expand.cc | 4 ++--
  25. libgcc/config/i386/cpuinfo.c | 6 +++---
  26. libgcc/config/i386/t-linux | 2 +-
  27. 3 files changed, 6 insertions(+), 6 deletions(-)
  28. diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
  29. index 68978ef8dc2..0c71f36b572 100644
  30. --- a/gcc/config/i386/i386-expand.cc
  31. +++ b/gcc/config/i386/i386-expand.cc
  32. @@ -12321,10 +12321,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
  33. {
  34. case IX86_BUILTIN_CPU_INIT:
  35. {
  36. - /* Make it call __cpu_indicator_init in libgcc. */
  37. + /* Make it call __cpu_indicator_init_local in libgcc.a. */
  38. tree call_expr, fndecl, type;
  39. type = build_function_type_list (integer_type_node, NULL_TREE);
  40. - fndecl = build_fn_decl ("__cpu_indicator_init", type);
  41. + fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
  42. call_expr = build_call_expr (fndecl, 0);
  43. return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
  44. }
  45. diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
  46. index dab1d98060f..cf824b4114a 100644
  47. --- a/libgcc/config/i386/cpuinfo.c
  48. +++ b/libgcc/config/i386/cpuinfo.c
  49. @@ -63,7 +63,7 @@ __cpu_indicator_init (void)
  50. __cpu_features2);
  51. }
  52. -#if defined SHARED && defined USE_ELF_SYMVER
  53. -__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
  54. -__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
  55. +#ifndef SHARED
  56. +int __cpu_indicator_init_local (void)
  57. + __attribute__ ((weak, alias ("__cpu_indicator_init")));
  58. #endif
  59. diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
  60. index 8506a635790..564296f788e 100644
  61. --- a/libgcc/config/i386/t-linux
  62. +++ b/libgcc/config/i386/t-linux
  63. @@ -3,5 +3,5 @@
  64. # t-slibgcc-elf-ver and t-linux
  65. SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
  66. -HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
  67. +HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
  68. CRTSTUFF_T_CFLAGS += $(CET_FLAGS)