All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] distutils-base.bbclass: Do not use -pie with hardening
@ 2017-06-02 14:50 Khem Raj
  0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2017-06-02 14:50 UTC (permalink / raw)
  To: openembedded-core

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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v1 -> v2:
- Move the change to distutils-base to include both python2 and 3

 meta/classes/distutils-base.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/distutils-base.bbclass b/meta/classes/distutils-base.bbclass
index 9f398d7051..3adbd5c643 100644
--- a/meta/classes/distutils-base.bbclass
+++ b/meta/classes/distutils-base.bbclass
@@ -2,3 +2,5 @@ DEPENDS  += "${@["${PYTHON_PN}-native ${PYTHON_PN}", ""][(d.getVar('PACKAGES') =
 RDEPENDS_${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}"
 
 inherit distutils-common-base pythonnative
+
+SECURITY_CFLAGS = "${SECURITY_NO_PIE_CFLAGS}
-- 
2.13.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-02 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 14:50 [PATCH V2] distutils-base.bbclass: Do not use -pie with hardening 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.