summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-08-30 22:23:14 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-03 09:55:50 +0100
commita4b6d8b7eb9b93855b160c31c452a7b50dfbded0 (patch)
tree900823ade591eea67fd323d2e17ed7413f9a4768
parent3a207a2a5c2f149f33846ac70a1478003b56121b (diff)
downloadpoky-a4b6d8b7eb9b93855b160c31c452a7b50dfbded0.tar.gz
gcc: Fix ldbl-128 support for musl
Let the patch trigger based on target triplet instead of passing via configure, this lets gcc compile for 64bit otherwise it ends up with libgcc build errors error: unable to emulate 'TF' (From OE-Core rev: 2259bf5366a9ff654dfaf15baa5df2d943383ce6) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-9.2/0030-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch178
-rw-r--r--meta/recipes-devtools/gcc/gcc-common.inc7
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-common.inc1
3 files changed, 66 insertions, 120 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-9.2/0030-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-9.2/0030-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
index f5769bc8e9..38eab5a083 100644
--- a/meta/recipes-devtools/gcc/gcc-9.2/0030-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ b/meta/recipes-devtools/gcc/gcc-9.2/0030-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
@@ -1,125 +1,79 @@
1From baab61ae3938ee2fa9ec03a20793508516a46dae Mon Sep 17 00:00:00 2001 1From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Szabolcs Nagy <nsz@port70.net>
3Date: Fri, 29 Apr 2016 20:03:28 +0000 3Date: Wed, 28 Feb 2018 00:54:05 +0000
4Subject: [PATCH 30/36] libgcc: Add knob to use ldbl-128 on ppc 4Subject: [PATCH 10/12] ldbl128 config
5
6musl does not support ldbl 128 so we can not assume
7that linux as a whole supports ldbl-128 bits, instead
8act upon configure option passed to gcc and assume no
9on musl and yes otherwise if no option is passed since
10default behaviour is to assume ldbl128 it does not
11change the defaults
12 5
13Upstream-Status: Pending 6Upstream-Status: Pending
14 7
15Signed-off-by: Khem Raj <raj.khem@gmail.com> 8Signed-off-by: Khem Raj <raj.khem@gmail.com>
16--- 9---
17 libgcc/Makefile.in | 1 + 10 gcc/configure | 13 +++++++++++++
18 libgcc/config/rs6000/t-linux | 5 ++++- 11 gcc/configure.ac | 16 ++++++++++++++--
19 libgcc/configure | 18 ++++++++++++++++++ 12 2 files changed, 27 insertions(+), 2 deletions(-)
20 libgcc/configure.ac | 12 ++++++++++++
21 4 files changed, 35 insertions(+), 1 deletion(-)
22 mode change 100644 => 100755 libgcc/configure
23 13
24diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in 14diff --git a/gcc/configure b/gcc/configure
25index ea390a5bbea..114c7876304 100644 15index 6121e163259..07ff8597d48 100755
26--- a/libgcc/Makefile.in 16--- a/gcc/configure
27+++ b/libgcc/Makefile.in 17+++ b/gcc/configure
28@@ -50,6 +50,7 @@ unwind_header = @unwind_header@ 18@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
29 md_unwind_header = @md_unwind_header@ 19 withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
30 sfp_machine_header = @sfp_machine_header@ 20 else
31 thread_header = @thread_header@
32+with_ldbl128 = @with_ldbl128@
33
34 host_noncanonical = @host_noncanonical@
35 real_host_noncanonical = @real_host_noncanonical@
36diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
37index 4f6d4c4a4d2..c50dd94a2da 100644
38--- a/libgcc/config/rs6000/t-linux
39+++ b/libgcc/config/rs6000/t-linux
40@@ -1,3 +1,6 @@
41 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
42
43-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
44+ifeq ($(with_ldbl128),yes)
45+HOST_LIBGCC2_CFLAGS += -mlong-double-128
46+endif
47+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
48diff --git a/libgcc/configure b/libgcc/configure
49old mode 100644
50new mode 100755
51index 36dbbc1f699..b5dd5c34e2a
52--- a/libgcc/configure
53+++ b/libgcc/configure
54@@ -651,6 +651,7 @@ build_vendor
55 build_cpu
56 build
57 with_aix_soname
58+with_ldbl128
59 enable_vtable_verify
60 enable_gcov
61 enable_shared
62@@ -702,6 +703,7 @@ with_ld
63 enable_shared
64 enable_gcov
65 enable_vtable_verify
66+with_long_double_128
67 with_aix_soname
68 enable_version_specific_runtime_libs
69 with_slibdir
70@@ -1363,6 +1365,7 @@ Optional Packages:
71 --with-target-subdir=SUBDIR Configuring in a subdirectory for target
72 --with-cross-host=HOST Configuring with a cross compiler
73 --with-ld arrange to use the specified ld (full pathname)
74+ --with-long-double-128 use 128-bit long double by default
75 --with-aix-soname=aix|svr4|both
76 shared library versioning (aka "SONAME") variant to
77 provide on AIX
78@@ -2268,6 +2271,21 @@ fi
79
80
81 21
82+# Check whether --with-long-double-128 was given. 22+ case "$target" in
83+if test "${with_long_double_128+set}" = set; then : 23+ s390*-*-linux-musl*)
84+ withval=$with_long_double_128; with_ldbl128="$with_long_double_128" 24+ gcc_cv_target_ldbl128=yes
85+else 25+ ;;
86+ case "${host}" in 26+ powerpc*-*-linux-musl*)
87+ power*-*-musl*) 27+ gcc_cv_target_ldbl128=no
88+ with_ldbl128="no";; 28+ ;;
89+ *) with_ldbl128="yes";; 29+ *)
90+ esac
91+
92+fi
93+
94+ 30+
31 if test $glibc_version_major -gt 2 \
32 || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
33 gcc_cv_target_ldbl128=yes
34@@ -29320,6 +29329,10 @@ else
35 && gcc_cv_target_ldbl128=yes
36
37 fi
95+ 38+
39+ ;;
40+ esac
96+ 41+
97 # Check whether --with-aix-soname was given. 42 fi
98 if test "${with_aix_soname+set}" = set; then :
99 withval=$with_aix_soname; case "${host}:${enable_shared}" in
100diff --git a/libgcc/configure.ac b/libgcc/configure.ac
101index 8e96cafdf8b..9247856bf24 100644
102--- a/libgcc/configure.ac
103+++ b/libgcc/configure.ac
104@@ -82,6 +82,18 @@ AC_ARG_ENABLE(vtable-verify,
105 [enable_vtable_verify=no])
106 AC_SUBST(enable_vtable_verify)
107 43
108+AC_ARG_WITH(long-double-128, 44 ;;
109+[AS_HELP_STRING([--with-long-double-128], 45diff --git a/gcc/configure.ac b/gcc/configure.ac
110+ [use 128-bit long double by default])], 46index b066cc609e1..6c15ed898c0 100644
111+ with_ldbl128="$with_long_double_128", 47--- a/gcc/configure.ac
112+[case "${host}" in 48+++ b/gcc/configure.ac
113+ power*-*-musl*) 49@@ -5971,13 +5971,25 @@ case "$target" in
114+ with_ldbl128="no";; 50 AC_ARG_WITH(long-double-128,
115+ *) with_ldbl128="yes";; 51 [AS_HELP_STRING([--with-long-double-128],
116+ esac 52 [use 128-bit long double by default])],
117+]) 53- gcc_cv_target_ldbl128="$with_long_double_128",
118+AC_SUBST(with_ldbl128) 54+ gcc_cv_target_ldbl128="$with_long_double_128", [
119+ 55+ case "$target" in
120 AC_ARG_WITH(aix-soname, 56+ s390*-*-linux-musl*)
121 [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], 57+ gcc_cv_target_ldbl128=yes
122 [shared library versioning (aka "SONAME") variant to provide on AIX])], 58+ ;;
59+ powerpc*-*-linux-musl*)
60+ gcc_cv_target_ldbl128=no
61+ ;;
62+ *)]
63 [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
64 [gcc_cv_target_ldbl128=no
65 grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
66 $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
67 && gcc_cv_target_ldbl128=yes
68- ]])])
69+ ]])]
70+ [
71+ ;;
72+ esac
73+ ])
74 ;;
75 esac
76 if test x$gcc_cv_target_ldbl128 = xyes; then
123-- 77--
1242.22.1 782.17.1
125 79
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index 96334e54b4..89273a7745 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -41,13 +41,6 @@ def get_gcc_ppc_plt_settings(bb, d):
41 return "--enable-secureplt" 41 return "--enable-secureplt"
42 return "" 42 return ""
43 43
44def get_long_double_setting(bb, d):
45 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and d.getVar('TCLIBC') in [ 'glibc' ]:
46 return "--with-long-double-128"
47 else:
48 return "--without-long-double-128 libgcc_cv_powerpc_float128=no"
49 return ""
50
51def get_gcc_multiarch_setting(bb, d): 44def get_gcc_multiarch_setting(bb, d):
52 target_arch = d.getVar('TRANSLATED_TARGET_ARCH') 45 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
53 multiarch_options = { 46 multiarch_options = {
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
index b6f2ca541d..24ba8ce75f 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -36,7 +36,6 @@ EXTRA_OECONF = "\
36 ${EXTRA_OECONF_PATHS} \ 36 ${EXTRA_OECONF_PATHS} \
37 ${@get_gcc_mips_plt_setting(bb, d)} \ 37 ${@get_gcc_mips_plt_setting(bb, d)} \
38 ${@get_gcc_ppc_plt_settings(bb, d)} \ 38 ${@get_gcc_ppc_plt_settings(bb, d)} \
39 ${@get_long_double_setting(bb, d)} \
40 ${@get_gcc_multiarch_setting(bb, d)} \ 39 ${@get_gcc_multiarch_setting(bb, d)} \
41" 40"
42 41