summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-04-13 22:39:07 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-05-09 10:47:50 +0100
commitde109820c3c393bb3f2b06ccf564a9b05b4872aa (patch)
tree8a9494921924c926cbbfed476b5c7d02a20cd32e /meta/recipes-devtools/gcc
parent8b5c4fea90b1d043dc9b8cbadbc4d9b48b5944cc (diff)
downloadpoky-de109820c3c393bb3f2b06ccf564a9b05b4872aa.tar.gz
gcc-runtime: Disable gcc version of libssp
libssp is implemented fully in glibc as well as in musl so we really do not need the gcc version of this library except may be for mingw, where we keep it enabled anyway gcc in OE is built with the knowledge that C library already provides libssp implementation, we should therefore not need the gcc implementation of same. libssp_nonshared piece is a detail which is needed when gcc is the compiler, in glibc this is part of libc_nonshared.a already and libc_nonshared.a is linked always when linking with -lc becuase libc.so in glibc is actually a linker script GROUP ( /usr/lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /usr/lib/ld-linux-x86-64.so.2 ) ) which automatically links in the needed runtime bits, this however is not the case for musl, where core SSP APIs are implemented in full but compiler specific runtime isn't, for this we add a new package called libssp_nonshared which generate the needed runtime stub and gcc is already carrying patch to link to libssp_nonshared.a on musl This should fix a long standing problem where static PIE executable were not buildable with OE since it was conflicting SSP implementation one from C library and the other one from gcc and we end up with duplicate symbol errors during linking. Backport a patch from trunk which enhances enable|disable-libssp to not only disable building libssp but also not emit the gcc specs to use it for subsequent linking when stack-protector options are used on compiler cmdline (From OE-Core rev: 6c14f99936f8c8c9b9d9f40a6b0c69675ea9a566) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3.inc7
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0049-gcc-override-TARGET_LIBC_PROVIDES_SSP.patch204
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime.inc4
3 files changed, 212 insertions, 3 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc
index d968c322d2..0586182282 100644
--- a/meta/recipes-devtools/gcc/gcc-7.3.inc
+++ b/meta/recipes-devtools/gcc/gcc-7.3.inc
@@ -72,6 +72,7 @@ SRC_URI = "\
72 file://0045-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \ 72 file://0045-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
73 file://0047-sync-gcc-stddef.h-with-musl.patch \ 73 file://0047-sync-gcc-stddef.h-with-musl.patch \
74 file://0048-gcc-Enable-static-PIE.patch \ 74 file://0048-gcc-Enable-static-PIE.patch \
75 file://0049-gcc-override-TARGET_LIBC_PROVIDES_SSP.patch \
75 file://fix-segmentation-fault-precompiled-hdr.patch \ 76 file://fix-segmentation-fault-precompiled-hdr.patch \
76 file://no-sse-fix-test-case-failures.patch \ 77 file://no-sse-fix-test-case-failures.patch \
77 ${BACKPORTS} \ 78 ${BACKPORTS} \
@@ -93,10 +94,12 @@ FORTRAN = ""
93JAVA = "" 94JAVA = ""
94 95
95LTO = "--enable-lto" 96LTO = "--enable-lto"
97SSP ?= "--disable-libssp"
98SSP_mingw32 = "--enable-libssp"
96 99
97EXTRA_OECONF_BASE = "\ 100EXTRA_OECONF_BASE = "\
98 ${LTO} \ 101 ${LTO} \
99 --enable-libssp \ 102 ${SSP} \
100 --enable-libitm \ 103 --enable-libitm \
101 --disable-bootstrap \ 104 --disable-bootstrap \
102 --disable-libmudflap \ 105 --disable-libmudflap \
@@ -120,7 +123,7 @@ EXTRA_OECONF_INITIAL = "\
120 --disable-plugin \ 123 --disable-plugin \
121 --enable-decimal-float=no \ 124 --enable-decimal-float=no \
122 --without-isl \ 125 --without-isl \
123 gcc_cv_libc_provides_ssp=yes \ 126 --disable-libssp \
124" 127"
125 128
126EXTRA_OECONF_PATHS = "\ 129EXTRA_OECONF_PATHS = "\
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0049-gcc-override-TARGET_LIBC_PROVIDES_SSP.patch b/meta/recipes-devtools/gcc/gcc-7.3/0049-gcc-override-TARGET_LIBC_PROVIDES_SSP.patch
new file mode 100644
index 0000000000..7c53c95c3a
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0049-gcc-override-TARGET_LIBC_PROVIDES_SSP.patch
@@ -0,0 +1,204 @@
1From 9815bd97561c778ee0bc0c17f245e88e66570111 Mon Sep 17 00:00:00 2001
2From: sandra <sandra@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Wed, 1 Nov 2017 02:14:19 +0000
4Subject: [PATCH] 2017-10-31 Sandra Loosemore <sandra@codesourcery.com>
5
6 gcc/
7 * configure.ac (--enable-libssp): New.
8 (gcc_cv_libc_provides_ssp): Check for explicit setting before
9 trying to determine target-specific default. Adjust indentation.
10 * configure: Regenerated.
11 * doc/install.texi (Configuration): Expand --disable-libssp
12 documentation.
13
14
15git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254288 138bc75d-0d04-0410-961f-82ee72b054a4
16---
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Upstream-Status: Backport [https://patchwork.ozlabs.org/patch/823049/]
19
20 gcc/ChangeLog | 9 +++++++++
21 gcc/configure | 26 +++++++++++++++++++++++---
22 gcc/configure.ac | 24 ++++++++++++++++++++----
23 gcc/doc/install.texi | 3 ++-
24 4 files changed, 54 insertions(+), 8 deletions(-)
25
26Index: gcc-7.3.0/gcc/configure.ac
27===================================================================
28--- gcc-7.3.0.orig/gcc/configure.ac
29+++ gcc-7.3.0/gcc/configure.ac
30@@ -5719,10 +5719,25 @@ if test x$gcc_cv_solaris_crts = xyes; th
31 [Define if the system-provided CRTs are present on Solaris.])
32 fi
33
34+AC_ARG_ENABLE(libssp,
35+[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
36+[case "${enableval}" in
37+ yes|no)
38+ ;;
39+ *)
40+ AC_MSG_ERROR([unknown libssp setting $enableval])
41+ ;;
42+esac], [])
43+
44 # Test for stack protector support in target C library.
45 AC_CACHE_CHECK(__stack_chk_fail in target C library,
46- gcc_cv_libc_provides_ssp,
47- [gcc_cv_libc_provides_ssp=no
48+ gcc_cv_libc_provides_ssp,
49+ [gcc_cv_libc_provides_ssp=no
50+ if test "x$enable_libssp" = "xno"; then
51+ gcc_cv_libc_provides_ssp=yes
52+ elif test "x$enable_libssp" = "xyes"; then
53+ gcc_cv_libc_provides_ssp=no
54+ else
55 case "$target" in
56 *-*-musl*)
57 # All versions of musl provide stack protector
58@@ -5759,8 +5774,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
59 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
60 [echo "no __stack_chk_fail on this target"])
61 ;;
62- *) gcc_cv_libc_provides_ssp=no ;;
63- esac])
64+ *) gcc_cv_libc_provides_ssp=no ;;
65+ esac
66+ fi])
67
68 if test x$gcc_cv_libc_provides_ssp = xyes; then
69 AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
70Index: gcc-7.3.0/gcc/doc/install.texi
71===================================================================
72--- gcc-7.3.0.orig/gcc/doc/install.texi
73+++ gcc-7.3.0/gcc/doc/install.texi
74@@ -1658,7 +1658,8 @@ not be built.
75
76 @item --disable-libssp
77 Specify that the run-time libraries for stack smashing protection
78-should not be built.
79+should not be built or linked against. On many targets library support
80+is provided by the C library instead.
81
82 @item --disable-libquadmath
83 Specify that the GCC quad-precision math library should not be built.
84Index: gcc-7.3.0/gcc/configure
85===================================================================
86--- gcc-7.3.0.orig/gcc/configure
87+++ gcc-7.3.0/gcc/configure
88@@ -940,6 +940,7 @@ enable_fix_cortex_a53_843419
89 with_glibc_version
90 enable_gnu_unique_object
91 enable_linker_build_id
92+enable_libssp
93 enable_default_ssp
94 with_long_double_128
95 with_gc
96@@ -1679,6 +1680,7 @@ Optional Features:
97 extension on glibc systems
98 --enable-linker-build-id
99 compiler will always pass --build-id to linker
100+ --enable-libssp enable linking against libssp
101 --enable-default-ssp enable Stack Smashing Protection as default
102 --enable-maintainer-mode
103 enable make rules and dependencies not useful (and
104@@ -18450,7 +18452,7 @@ else
105 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
106 lt_status=$lt_dlunknown
107 cat > conftest.$ac_ext <<_LT_EOF
108-#line 18436 "configure"
109+#line 18455 "configure"
110 #include "confdefs.h"
111
112 #if HAVE_DLFCN_H
113@@ -18556,7 +18558,7 @@ else
114 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
115 lt_status=$lt_dlunknown
116 cat > conftest.$ac_ext <<_LT_EOF
117-#line 18542 "configure"
118+#line 18561 "configure"
119 #include "confdefs.h"
120
121 #if HAVE_DLFCN_H
122@@ -25234,6 +25236,7 @@ $as_echo "#define HAVE_AS_SPARC5_VIS4 1"
123
124 fi
125
126+
127 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for SPARC6 instructions" >&5
128 $as_echo_n "checking assembler for SPARC6 instructions... " >&6; }
129 if test "${gcc_cv_as_sparc_sparc6+set}" = set; then :
130@@ -25270,6 +25273,7 @@ $as_echo "#define HAVE_AS_SPARC6 1" >>co
131
132 fi
133
134+
135 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for LEON instructions" >&5
136 $as_echo_n "checking assembler for LEON instructions... " >&6; }
137 if test "${gcc_cv_as_sparc_leon+set}" = set; then :
138@@ -28947,6 +28951,18 @@ $as_echo "#define HAVE_SOLARIS_CRTS 1" >
139
140 fi
141
142+# Check whether --enable-libssp was given.
143+if test "${enable_libssp+set}" = set; then :
144+ enableval=$enable_libssp; case "${enableval}" in
145+ yes|no)
146+ ;;
147+ *)
148+ as_fn_error "unknown libssp setting $enableval" "$LINENO" 5
149+ ;;
150+esac
151+fi
152+
153+
154 # Test for stack protector support in target C library.
155 { $as_echo "$as_me:${as_lineno-$LINENO}: checking __stack_chk_fail in target C library" >&5
156 $as_echo_n "checking __stack_chk_fail in target C library... " >&6; }
157@@ -28954,6 +28970,11 @@ if test "${gcc_cv_libc_provides_ssp+set}
158 $as_echo_n "(cached) " >&6
159 else
160 gcc_cv_libc_provides_ssp=no
161+ if test "x$enable_libssp" = "xno"; then
162+ gcc_cv_libc_provides_ssp=yes
163+ elif test "x$enable_libssp" = "xyes"; then
164+ gcc_cv_libc_provides_ssp=no
165+ else
166 case "$target" in
167 *-*-musl*)
168 # All versions of musl provide stack protector
169@@ -29001,8 +29022,9 @@ else
170 fi
171
172 ;;
173- *) gcc_cv_libc_provides_ssp=no ;;
174+ *) gcc_cv_libc_provides_ssp=no ;;
175 esac
176+ fi
177 fi
178 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_libc_provides_ssp" >&5
179 $as_echo "$gcc_cv_libc_provides_ssp" >&6; }
180@@ -29037,18 +29059,15 @@ fi
181
182
183 # Test for <sys/sdt.h> on the target.
184-
185-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
186-$as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
187-have_sys_sdt_h=no
188+#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
189+#AC_MSG_CHECKING(sys/sdt.h in the target C library)
190+#have_sys_sdt_h=no
191 #if test -f $target_header_dir/sys/sdt.h; then
192 # have_sys_sdt_h=yes
193-#
194-#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
195-#
196+# AC_DEFINE(HAVE_SYS_SDT_H, 1,
197+# [Define if your target C library provides sys/sdt.h])
198 #fi
199-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
200-$as_echo "$have_sys_sdt_h" >&6; }
201+#AC_MSG_RESULT($have_sys_sdt_h)
202
203 # Check if TFmode long double should be used by default or not.
204 # Some glibc targets used DFmode long double, but with glibc 2.4
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index 7629fa56ff..72b8081cd3 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -22,8 +22,10 @@ RUNTIMELIBITM_nios2 = ""
22RUNTIMELIBITM_microblaze = "" 22RUNTIMELIBITM_microblaze = ""
23RUNTIMELIBITM_riscv32 = "" 23RUNTIMELIBITM_riscv32 = ""
24RUNTIMELIBITM_riscv64 = "" 24RUNTIMELIBITM_riscv64 = ""
25RUNTIMELIBSSP ?= ""
26RUNTIMELIBSSP_mingw32 ?= "libssp"
25 27
26RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \ 28RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
27 ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \ 29 ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
28" 30"
29RUNTIMETARGET_append_x86 = " libmpx" 31RUNTIMETARGET_append_x86 = " libmpx"