summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-02-06 11:17:24 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-04 11:11:58 +0000
commit7a04ee894197e2506569b6944bf8acba7fb8684c (patch)
tree86b9874d1190d26f99ac6f78ca61408374086227
parentc1e1633bf1788a83dac73c5aae8bf1e4b9231657 (diff)
downloadpoky-7a04ee894197e2506569b6944bf8acba7fb8684c.tar.gz
distutils-base.bbclass: Do not use -pie with hardening
Fix build when PIE is turned on. It tries to build .so file using -pie and -shared flags together because its doing compile and link in same step CFLAGS and LDFLAGS are combined and does not work, ending in errors e.g. | /mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-musleabi/python-pygpgme/0.3-r0/recipe-sysroot/usr/l ib/Scrt1.o: In function `_start_c': | /usr/src/debug/musl/1.1.16+gitAUTOINC+179766aa2e-r0/git/crt/crt1.c:17: undefined reference to `main' | collect2: error: ld returned 1 exit status This error while cryptic is due to the fact that we are building a shared library but also pass -pie flag to the link step after specify LDHSARED ( which is -shared linker flags ) we can not use -pie when doing shared libs. This is true for all the python modules inheriting setup tools Disable the pie flags thusly for all modules using setuptools since this setting is done in setuptools makefiles which are then used during module compiles Backport notes: In master, this commit is reverted in master in favor of using GCCPIE = "--enable-default-pie" in security_flags.inc. However, backporting that change introduces many merge conflicts and will be a serious maintenance issue, so I think it's safest to just backport this small change, which fixes build failures in python-cffi and likely other recipes. For completeness, this is the list of commits in OE-core master that will supersede this change: - 1c7e195c94764d680a12a49b870f04cd58860f81 "gcc: Introduce a knob to configure gcc to default to PIE" - e93765ffb5718b0fce84f0b8123963176dea95e4 "security_flags.inc: Delete pinnings for SECURITY_NO_PIE_CFLAGS" - fcfe6d4ab4460f8358e13023022a5e909941ca93 distutils,setuptools: Delete use of SECURITY_NO_PIE_CFLAGS (From OE-Core rev: 739c69e8eb464d184ef652e7e7a4d4b234a5b5f9) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Martin Kelly <mkelly@xevo.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/distutils-common-base.bbclass2
1 files changed, 2 insertions, 0 deletions
diff --git a/meta/classes/distutils-common-base.bbclass b/meta/classes/distutils-common-base.bbclass
index 824a1b68b1..fa733c672c 100644
--- a/meta/classes/distutils-common-base.bbclass
+++ b/meta/classes/distutils-common-base.bbclass
@@ -11,3 +11,5 @@ FILES_${PN}-dev += "\
11 ${libdir}/pkgconfig \ 11 ${libdir}/pkgconfig \
12 ${PYTHON_SITEPACKAGES_DIR}/*.la \ 12 ${PYTHON_SITEPACKAGES_DIR}/*.la \
13" 13"
14
15SECURITY_CFLAGS = "${SECURITY_NO_PIE_CFLAGS}"