libssp-nonshared: Add recipe
PATCH 1/4 libssp-nonshared: Add recipe
libssp-nonshared is a minimal gcc runtime piece which is needed on non-glibc systems which do implement libssp APIs in libc
--- 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
meta/recipes-core/musl/libssp-nonshared.bb new file +39 -0
@@ -0,0 +1,39 @@ +# Copyright (C) 2018 Khem Raj <[email protected]> +# 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.*"
meta/recipes-core/musl/libssp-nonshared/ssp-local.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.17.0
PATCH 2/4 musl: Depend on libssp-nonshared
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
--- meta/recipes-core/musl/musl_git.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/musl/musl_git.bb +2 -1
@@ -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)"
Signature · 1 line
2.17.0
PATCH 3/4 gcc-runtime: Disable gcc version of libssp
In reply to Khem Rajlibssp 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.
--- meta/recipes-devtools/gcc/gcc-7.3.inc | 4 +++- meta/recipes-devtools/gcc/gcc-runtime.inc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
meta/recipes-devtools/gcc/gcc-7.3.inc +3 -1
@@ -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 \
meta/recipes-devtools/gcc/gcc-runtime.inc +3 -1
@@ -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"
Signature · 1 line
2.17.0
Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
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
Quoted 74 lines · Khem Raj
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_nonsharedpiece 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 scriptGROUP (
/usr/lib/libc.so.6/usr/lib/libc_nonshared.aAS_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_nonsharedwhich generate the needed runtime stub and gcc is already carrying patch to link to libssp_nonshared.a on muslThis 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 <[email protected]>--- meta/recipes-devtools/gcc/gcc-7.3.inc | 4 +++- meta/recipes-devtools/gcc/gcc-runtime.inc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)meta/recipes-devtools/gcc/gcc-7.3.inc +3
-1@@ -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 \meta/recipes-devtools/gcc/gcc-runtime.inc +3
-2@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
Quoted 11 lines · Ross
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
Sent a V2, which should fix it.
https://patchwork.openembedded.org/patch/150197/
Quoted 77 lines
Ross
Quoted 74 lines · Khem Raj
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_nonsharedpiece 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 scriptGROUP (
/usr/lib/libc.so.6/usr/lib/libc_nonshared.aAS_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_nonsharedwhich generate the needed runtime stub and gcc is already carrying patch to link to libssp_nonshared.a on muslThis 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 <[email protected]>--- meta/recipes-devtools/gcc/gcc-7.3.inc | 4 +++- meta/recipes-devtools/gcc/gcc-runtime.inc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)meta/recipes-devtools/gcc/gcc-7.3.inc +3
-1@@ -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 \meta/recipes-devtools/gcc/gcc-runtime.inc +3
-2@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
In reply to Khem RajQuoted 11 lines · Khem Raj
meta/recipes-devtools/gcc/gcc-runtime.inc +0
-0@@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = ""RUNTIMELIBITM_microblaze = ""
RUNTIMELIBITM_riscv32 = ""
RUNTIMELIBITM_riscv64 = ""meta/recipes-devtools/gcc/gcc-runtime.inc +2
-0+RUNTIMELIBSSP ?= "" +RUNTIMELIBSSP_mingw ?= "libssp"
Quoted 8 lines
-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
Re: [PATCH 3/4] gcc-runtime: Disable gcc version of libssp
Quoted 13 lines · Richard Purdie
Quoted 12 lines · Khem Raj
meta/recipes-devtools/gcc/gcc-runtime.inc +2
-0@@ -24,8 +24,10 @@ RUNTIMELIBITM_nios2 = "" RUNTIMELIBITM_microblaze = "" RUNTIMELIBITM_riscv32 = "" RUNTIMELIBITM_riscv64 = "" +RUNTIMELIBSSP ?= "" +RUNTIMELIBSSP_mingw ?= "libssp"
Quoted 11 lines
Quoted 7 lines
meta/recipes-devtools/gcc/gcc-runtime.inc +1
-1-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
Quoted 7 lines
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_compileaddition...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.
Quoted 3 lines
Cheers,
Richard
PATCH 4/4 libunwind: Drop adding libssp to linker flags
In reply to Khem RajThis is no longer needed as gcc provided libssp
is not built
--- meta/recipes-support/libunwind/libunwind.inc | 2 -- 1 file changed, 2 deletions(-)
meta/recipes-support/libunwind/libunwind.inc +0 -2
@@ -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 }
Signature · 1 line
2.17.0