summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/newt
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-02-17 08:33:40 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-21 09:32:43 +0000
commitea8c34e976c11757ed9869c51b48f39050e25708 (patch)
treee2aa5bbe3d5c1a0da01b8416f4c80fd1b6c49d6b /meta/recipes-extended/newt
parent66a833a21c1fa600d31295799b0aabc281f40786 (diff)
downloadpoky-ea8c34e976c11757ed9869c51b48f39050e25708.tar.gz
libnewt: Fix build with PIE flags
security flags add -pie -fpie to CFLAGS which is not right options for compiling .so files, they are only useful for compiling executables (From OE-Core rev: 2735d096aef2d039d711c13c311bb6dba979f437) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/newt')
-rw-r--r--meta/recipes-extended/newt/files/pie-flags.patch36
-rw-r--r--meta/recipes-extended/newt/libnewt_0.52.18.bb2
2 files changed, 38 insertions, 0 deletions
diff --git a/meta/recipes-extended/newt/files/pie-flags.patch b/meta/recipes-extended/newt/files/pie-flags.patch
new file mode 100644
index 0000000000..8883e26adf
--- /dev/null
+++ b/meta/recipes-extended/newt/files/pie-flags.patch
@@ -0,0 +1,36 @@
1specify -fPIC after CFLAGS so it can override the CFLAGS containing -pie and -fpie
2this makes sure the objects that go into shared objects are compiled with -fPIC
3and not with -fpie. We can not use -fpie on objects which will go into .so files
4Fixes errors like
5
6| /mnt/oe/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/5.3.0/ld: shared/newt.o: relocation R_X86_64_PC32 against undefined symbol `SLtt_Screen_Rows@@SLANG2' can not be used when making a shared object; recompile with -fPIC
7| /mnt/oe/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/5.3.0/ld: final link failed: Bad value
8| collect2: error: ld returned 1 exit status
9| make: *** [libnewt.so.0.52.18] Error 1
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Upstream-Status: Pending
13Index: newt-0.52.18/Makefile.in
14===================================================================
15--- newt-0.52.18.orig/Makefile.in
16+++ newt-0.52.18/Makefile.in
17@@ -96,8 +96,8 @@ _snack.$(SOEXT): snack.c $(LIBNEWTSH)
18 PIFLAGS=`$$pyconfig --includes`; \
19 PLDFLAGS=`$$pyconfig --ldflags`; \
20 PLFLAGS=`$$pyconfig --libs`; \
21- echo $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
22- $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
23+ echo $(CC) $(CPPFLAGS) $(SHCFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
24+ $(CC) $(CPPFLAGS) $(SHCFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
25 echo $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
26 $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
27 done || :
28@@ -135,7 +135,7 @@ $(LIBNEWTSH): $(SHAREDOBJS)
29 ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
30
31 $(SHAREDDIR)/%.o : %.c $(SHAREDDIR)
32- $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
33+ $(CC) -c $(CFLAGS) $(CPPFLAGS) $(SHCFLAGS) -o $@ $<
34
35 install: $(LIBNEWT) install-sh whiptail
36 [ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)
diff --git a/meta/recipes-extended/newt/libnewt_0.52.18.bb b/meta/recipes-extended/newt/libnewt_0.52.18.bb
index 293c1a8a5a..9a2964be19 100644
--- a/meta/recipes-extended/newt/libnewt_0.52.18.bb
+++ b/meta/recipes-extended/newt/libnewt_0.52.18.bb
@@ -22,6 +22,7 @@ SRC_URI = "https://fedorahosted.org/releases/n/e/newt/newt-${PV}.tar.gz \
22 file://fix_SHAREDDIR.patch \ 22 file://fix_SHAREDDIR.patch \
23 file://cross_ar.patch \ 23 file://cross_ar.patch \
24 file://Makefile.in-Add-tinfo-library-to-the-linking-librari.patch \ 24 file://Makefile.in-Add-tinfo-library-to-the-linking-librari.patch \
25 file://pie-flags.patch \
25" 26"
26 27
27SRC_URI[md5sum] = "685721bee1a318570704b19dcf31d268" 28SRC_URI[md5sum] = "685721bee1a318570704b19dcf31d268"
@@ -37,6 +38,7 @@ CLEANBROKEN = "1"
37 38
38export STAGING_INCDIR 39export STAGING_INCDIR
39export STAGING_LIBDIR 40export STAGING_LIBDIR
41export CPPFLAGS
40 42
41export BUILD_SYS 43export BUILD_SYS
42export HOST_SYS 44export HOST_SYS