All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] libssp-nonshared: Add recipe
@ 2018-04-16  6:50 Khem Raj
  2018-04-16  6:50 ` [PATCH 2/4] musl: Depend on libssp-nonshared Khem Raj
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Khem Raj @ 2018-04-16  6:50 UTC (permalink / raw)
  To: openembedded-core

libssp-nonshared is a minimal gcc runtime piece which is needed
on non-glibc systems which do implement libssp APIs in libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/musl/libssp-nonshared.bb    | 39 ++++++++++++++++
 .../musl/libssp-nonshared/ssp-local.c         | 45 +++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 meta/recipes-core/musl/libssp-nonshared.bb
 create mode 100644 meta/recipes-core/musl/libssp-nonshared/ssp-local.c

diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
new file mode 100644
index 0000000000..3afab30fa2
--- /dev/null
+++ b/meta/recipes-core/musl/libssp-nonshared.bb
@@ -0,0 +1,39 @@
+# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl"
+LICENSE = "GPL-3.0-with-GCC-exception"
+LIC_FILES_CHKSUM = "file://ssp-local.c;beginline=1;endline=32;md5=c06d391208c0cfcbc541a6728ed65cc4"
+SECTION = "libs"
+
+SRC_URI = "file://ssp-local.c"
+
+PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
+STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils \
+           virtual/${TARGET_PREFIX}gcc-initial \
+"
+
+do_configure[noexec] = "1"
+
+S = "${WORKDIR}"
+
+do_compile() {
+	${CC} ${CPPFLAGS} ${CFLAGS} -c ssp-local.c -o ssp-local.o
+	${AR} r libssp_nonshared.a ssp-local.o
+}
+do_install() {
+	install -Dm 0644 ${B}/libssp_nonshared.a ${D}${base_libdir}/libssp_nonshared.a
+}
+
+PACKAGES = "${PN}"
+FILES_${PN} = "${base_libdir}/libssp_nonshared.a"
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
diff --git a/meta/recipes-core/musl/libssp-nonshared/ssp-local.c b/meta/recipes-core/musl/libssp-nonshared/ssp-local.c
new file mode 100644
index 0000000000..8f51afa2c1
--- /dev/null
+++ b/meta/recipes-core/musl/libssp-nonshared/ssp-local.c
@@ -0,0 +1,45 @@
+/* Stack protector support.
+   Copyright (C) 2005-2018 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+extern void __stack_chk_fail (void);
+
+/* Some targets can avoid loading a GP for calls to hidden functions.
+   Using this entry point may avoid the load of a GP entirely for the
+   function, making the overall code smaller.  */
+
+void
+__attribute__((visibility ("hidden")))
+__stack_chk_fail_local (void)
+{
+  __stack_chk_fail ();
+}
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] musl: Depend on libssp-nonshared
  2018-04-16  6:50 [PATCH 1/4] libssp-nonshared: Add recipe Khem Raj
@ 2018-04-16  6:50 ` Khem Raj
  2018-04-16  6:50 ` [PATCH 3/4] gcc-runtime: Disable gcc version of libssp Khem Raj
  2018-04-16  6:50 ` [PATCH 4/4] libunwind: Drop adding libssp to linker flags Khem Raj
  2 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2018-04-16  6:50 UTC (permalink / raw)
  To: openembedded-core

libssp-nonshared is required on musl since
it does not implement the gcc runtime piece of
libssp, which actually it a gcc optimization to
reach to __stack_chk_fail

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/musl/musl_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 42ba411f17..d5a9360b70 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -22,6 +22,7 @@ DEPENDS = "virtual/${TARGET_PREFIX}binutils \
            libgcc-initial \
            linux-libc-headers \
            bsd-headers \
+           libssp-nonshared \
           "
 
 export CROSS_COMPILE="${TARGET_PREFIX}"
@@ -65,7 +66,7 @@ do_install() {
 	done
 }
 
-RDEPENDS_${PN}-dev += "linux-libc-headers-dev bsd-headers-dev"
+RDEPENDS_${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared"
 RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
 RPROVIDES_${PN} += "ldd libsegfault rtld(GNU_HASH)"
 
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
  2018-04-16  6:50 [PATCH 1/4] libssp-nonshared: Add recipe Khem Raj
  2018-04-16  6:50 ` [PATCH 2/4] musl: Depend on libssp-nonshared Khem Raj
@ 2018-04-16  6:50 ` Khem Raj
  2018-04-17 10:12   ` Burton, Ross
  2018-04-17 10:42   ` Richard Purdie
  2018-04-16  6:50 ` [PATCH 4/4] libunwind: Drop adding libssp to linker flags Khem Raj
  2 siblings, 2 replies; 8+ messages in thread
From: Khem Raj @ 2018-04-16  6:50 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-7.3.inc     | 4 +++-
 meta/recipes-devtools/gcc/gcc-runtime.inc | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc
index d968c322d2..7e52afc643 100644
--- a/meta/recipes-devtools/gcc/gcc-7.3.inc
+++ b/meta/recipes-devtools/gcc/gcc-7.3.inc
@@ -93,10 +93,12 @@ FORTRAN = ""
 JAVA = ""
 
 LTO = "--enable-lto"
+SSP ?= "--disable-libssp"
+SSP_mingw = "--enable-libssp"
 
 EXTRA_OECONF_BASE = "\
     ${LTO} \
-    --enable-libssp \
+    ${SSP} \
     --enable-libitm \
     --disable-bootstrap \
     --disable-libmudflap \
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index 97365a21dc..b4e5539575 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = ""
 RUNTIMELIBITM_microblaze = ""
 RUNTIMELIBITM_riscv32 = ""
 RUNTIMELIBITM_riscv64 = ""
+RUNTIMELIBSSP ?= ""
+RUNTIMELIBSSP_mingw ?= "libssp"
 
-RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
+RUNTIMETARGET = "libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
     ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
 "
 RUNTIMETARGET_append_x86 = " libmpx"
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] libunwind: Drop adding libssp to linker flags
  2018-04-16  6:50 [PATCH 1/4] libssp-nonshared: Add recipe Khem Raj
  2018-04-16  6:50 ` [PATCH 2/4] musl: Depend on libssp-nonshared Khem Raj
  2018-04-16  6:50 ` [PATCH 3/4] gcc-runtime: Disable gcc version of libssp Khem Raj
@ 2018-04-16  6:50 ` Khem Raj
  2 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2018-04-16  6:50 UTC (permalink / raw)
  To: openembedded-core

This is no longer needed as gcc provided libssp
is not built

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/libunwind/libunwind.inc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/meta/recipes-support/libunwind/libunwind.inc b/meta/recipes-support/libunwind/libunwind.inc
index b9c532d3ad..36851d07ed 100644
--- a/meta/recipes-support/libunwind/libunwind.inc
+++ b/meta/recipes-support/libunwind/libunwind.inc
@@ -14,8 +14,6 @@ PACKAGECONFIG[latexdocs] = "--enable-documentation, --disable-documentation, lat
 EXTRA_OECONF_arm = "--enable-debug-frame"
 EXTRA_OECONF_aarch64 = "--enable-debug-frame"
 
-SECURITY_LDFLAGS_append_libc-musl = " -lssp_nonshared -lssp"
-
 do_install_append () {
 	oe_multilib_header libunwind.h
 }
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
  2018-04-16  6:50 ` [PATCH 3/4] gcc-runtime: Disable gcc version of libssp Khem Raj
@ 2018-04-17 10:12   ` Burton, Ross
  2018-04-18  7:37     ` Khem Raj
  2018-04-17 10:42   ` Richard Purdie
  1 sibling, 1 reply; 8+ messages in thread
From: Burton, Ross @ 2018-04-17 10:12 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

This is, I suspect, the cause of nativesdk-perl failing on the autobuilder:

TOPDIR/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-perl/5.24.1-r0/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/7.3.0/ld:
cannot find -lssp_nonshared
TOPDIR/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-perl/5.24.1-r0/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/7.3.0/ld:
cannot find -lssp
collect2: error: ld returned 1 exit status
makefile:391: recipe for target 'lib/buildcustomize.pl' failed

http://errors.yoctoproject.org/Errors/Details/176127/

Ross

On 16 April 2018 at 07:50, Khem Raj <raj.khem@gmail.com> wrote:
> 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.
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/gcc/gcc-7.3.inc     | 4 +++-
>  meta/recipes-devtools/gcc/gcc-runtime.inc | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc
> index d968c322d2..7e52afc643 100644
> --- a/meta/recipes-devtools/gcc/gcc-7.3.inc
> +++ b/meta/recipes-devtools/gcc/gcc-7.3.inc
> @@ -93,10 +93,12 @@ FORTRAN = ""
>  JAVA = ""
>
>  LTO = "--enable-lto"
> +SSP ?= "--disable-libssp"
> +SSP_mingw = "--enable-libssp"
>
>  EXTRA_OECONF_BASE = "\
>      ${LTO} \
> -    --enable-libssp \
> +    ${SSP} \
>      --enable-libitm \
>      --disable-bootstrap \
>      --disable-libmudflap \
> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
> index 97365a21dc..b4e5539575 100644
> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
> @@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = ""
>  RUNTIMELIBITM_microblaze = ""
>  RUNTIMELIBITM_riscv32 = ""
>  RUNTIMELIBITM_riscv64 = ""
> +RUNTIMELIBSSP ?= ""
> +RUNTIMELIBSSP_mingw ?= "libssp"
>
> -RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
> +RUNTIMETARGET = "libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
>      ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
>  "
>  RUNTIMETARGET_append_x86 = " libmpx"
> --
> 2.17.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
  2018-04-16  6:50 ` [PATCH 3/4] gcc-runtime: Disable gcc version of libssp Khem Raj
  2018-04-17 10:12   ` Burton, Ross
@ 2018-04-17 10:42   ` Richard Purdie
  2018-04-17 13:57     ` Khem Raj
  1 sibling, 1 reply; 8+ messages in thread
From: Richard Purdie @ 2018-04-17 10:42 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

On Sun, 2018-04-15 at 23:50 -0700, Khem Raj wrote:
> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc
> b/meta/recipes-devtools/gcc/gcc-runtime.inc
> index 97365a21dc..b4e5539575 100644
> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
> @@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = ""
>  RUNTIMELIBITM_microblaze = ""
>  RUNTIMELIBITM_riscv32 = ""
>  RUNTIMELIBITM_riscv64 = ""
> +RUNTIMELIBSSP ?= ""
> +RUNTIMELIBSSP_mingw ?= "libssp"
>  
> -RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic
> ${RUNTIMELIBITM} \
> +RUNTIMETARGET = "libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
>      ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'],
> 'libquadmath', '', d)} \
>  "
>  RUNTIMETARGET_append_x86 = " libmpx"

This last piece looks like you removed libssp for everywhere, glibc
included except mingw?

Is the source file you included in the new recipe the same as the one
in the gcc source but linked differently? If so, I'd be tempted to
build that gcc-runtime with a musl specific do_compile addition...

I assume this is post 2.5 material as its fairly invasive changes at
the tail end of a release...

Cheers,

Richard


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
  2018-04-17 10:42   ` Richard Purdie
@ 2018-04-17 13:57     ` Khem Raj
  0 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2018-04-17 13:57 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer

On Tue, Apr 17, 2018 at 3:42 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Sun, 2018-04-15 at 23:50 -0700, Khem Raj wrote:
>> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc
>> b/meta/recipes-devtools/gcc/gcc-runtime.inc
>> index 97365a21dc..b4e5539575 100644
>> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
>> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
>> @@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = ""
>>  RUNTIMELIBITM_microblaze = ""
>>  RUNTIMELIBITM_riscv32 = ""
>>  RUNTIMELIBITM_riscv64 = ""
>> +RUNTIMELIBSSP ?= ""
>> +RUNTIMELIBSSP_mingw ?= "libssp"
>>
>> -RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic
>> ${RUNTIMELIBITM} \
>> +RUNTIMETARGET = "libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
>>      ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'],
>> 'libquadmath', '', d)} \
>>  "
>>  RUNTIMETARGET_append_x86 = " libmpx"
>
> This last piece looks like you removed libssp for everywhere, glibc
> included except mingw?
>

yes, since the needed bits for ssp are already provided via libc.so there should
not be a need for it needing libssp on glibc based systems, I think
its due to the libssp
patch we are carrying in gcc, I will take a look at that and limit it
to just musl tuples

> Is the source file you included in the new recipe the same as the one
> in the gcc source but linked differently? If so, I'd be tempted to
> build that gcc-runtime with a musl specific do_compile addition...
>
> I assume this is post 2.5 material as its fairly invasive changes at
> the tail end of a release...
>

yes this is for 2.6 we may backport it later if needed.

> Cheers,
>
> Richard


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
  2018-04-17 10:12   ` Burton, Ross
@ 2018-04-18  7:37     ` Khem Raj
  0 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2018-04-18  7:37 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core



On 4/17/18 3:12 AM, Burton, Ross wrote:
> This is, I suspect, the cause of nativesdk-perl failing on the autobuilder:
> 
> TOPDIR/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-perl/5.24.1-r0/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/7.3.0/ld:
> cannot find -lssp_nonshared
> TOPDIR/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-perl/5.24.1-r0/recipe-sysroot-native/usr/bin/x86_64-pokysdk-linux/../../libexec/x86_64-pokysdk-linux/gcc/x86_64-pokysdk-linux/7.3.0/ld:
> cannot find -lssp
> collect2: error: ld returned 1 exit status
> makefile:391: recipe for target 'lib/buildcustomize.pl' failed
> 
> http://errors.yoctoproject.org/Errors/Details/176127/
> 

Sent a V2, which should fix it.
https://patchwork.openembedded.org/patch/150197/


> Ross
> 
> On 16 April 2018 at 07:50, Khem Raj <raj.khem@gmail.com> wrote:
>> 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.
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>   meta/recipes-devtools/gcc/gcc-7.3.inc     | 4 +++-
>>   meta/recipes-devtools/gcc/gcc-runtime.inc | 4 +++-
>>   2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc
>> index d968c322d2..7e52afc643 100644
>> --- a/meta/recipes-devtools/gcc/gcc-7.3.inc
>> +++ b/meta/recipes-devtools/gcc/gcc-7.3.inc
>> @@ -93,10 +93,12 @@ FORTRAN = ""
>>   JAVA = ""
>>
>>   LTO = "--enable-lto"
>> +SSP ?= "--disable-libssp"
>> +SSP_mingw = "--enable-libssp"
>>
>>   EXTRA_OECONF_BASE = "\
>>       ${LTO} \
>> -    --enable-libssp \
>> +    ${SSP} \
>>       --enable-libitm \
>>       --disable-bootstrap \
>>       --disable-libmudflap \
>> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
>> index 97365a21dc..b4e5539575 100644
>> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
>> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
>> @@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = ""
>>   RUNTIMELIBITM_microblaze = ""
>>   RUNTIMELIBITM_riscv32 = ""
>>   RUNTIMELIBITM_riscv64 = ""
>> +RUNTIMELIBSSP ?= ""
>> +RUNTIMELIBSSP_mingw ?= "libssp"
>>
>> -RUNTIMETARGET = "libssp libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
>> +RUNTIMETARGET = "libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
>>       ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
>>   "
>>   RUNTIMETARGET_append_x86 = " libmpx"
>> --
>> 2.17.0
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-18  7:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16  6:50 [PATCH 1/4] libssp-nonshared: Add recipe Khem Raj
2018-04-16  6:50 ` [PATCH 2/4] musl: Depend on libssp-nonshared Khem Raj
2018-04-16  6:50 ` [PATCH 3/4] gcc-runtime: Disable gcc version of libssp Khem Raj
2018-04-17 10:12   ` Burton, Ross
2018-04-18  7:37     ` Khem Raj
2018-04-17 10:42   ` Richard Purdie
2018-04-17 13:57     ` Khem Raj
2018-04-16  6:50 ` [PATCH 4/4] libunwind: Drop adding libssp to linker flags Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.