Skip to contentSkip to conversation

nss: Fix build for 64bit targets

PATCH Applied Khem Raj 2 participants 2 messages Jan 9, 2013 – Jan 10, 2013

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 nss: Fix build for 64bit targets

it would fair to compile for x86-64 since native flags would pass 64bit flags but internally it would append 32bit flags to linker cmdline since we did not ask for 64bit build.

This patch asks for 64bit build on x86_64 and additionally nullifies ARCHFLAG when NATIVE_CC is set, ARCHFLAG is one which sets the 32bit/64bit ness of ABI

---
 recipes-support/nss/nss-3.13.3/native_cc.patch |   27 ++++++++++++++++++++----
 recipes-support/nss/nss_3.13.3.bb              |   11 +++++++---
 2 files changed, 31 insertions(+), 7 deletions(-)
recipes-support/nss/nss-3.13.3/native_cc.patch +23 -4
index e0c2232..41d4980 100644
@@ -1,7 +1,12 @@
+we need to override ARCHFLAG as well since this is set to either -m32 or -m64
+and LDFLAGS add it explicitly which means when NATIVE_CC is defined then we build
+the objects as 64bit but link them to be 32bit binary which may not fly
+
+Signed-off-by: Khem Raj <[email protected]>
 Index: mozilla/security/coreconf/mkdepend/Makefile
 ===================================================================
---- mozilla.orig/security/coreconf/mkdepend/Makefile	2012-02-20 18:18:35.237845874 +0100
-+++ mozilla/security/coreconf/mkdepend/Makefile	2012-02-20 18:19:15.977844984 +0100
+--- mozilla.orig/security/coreconf/mkdepend/Makefile	2013-01-09 13:23:51.747694602 -0800
++++ mozilla/security/coreconf/mkdepend/Makefile	2013-01-09 13:56:27.003734720 -0800
 @@ -64,11 +64,11 @@
  endif
  
@@ -18,8 +23,8 @@ Index: mozilla/security/coreconf/mkdepend/Makefile
  include $(DEPTH)/coreconf/rules.mk
 Index: mozilla/security/coreconf/nsinstall/Makefile
 ===================================================================
---- mozilla.orig/security/coreconf/nsinstall/Makefile	2012-02-20 18:18:28.693846017 +0100
-+++ mozilla/security/coreconf/nsinstall/Makefile	2012-02-20 18:19:40.881844444 +0100
+--- mozilla.orig/security/coreconf/nsinstall/Makefile	2013-01-09 13:23:51.747694602 -0800
++++ mozilla/security/coreconf/nsinstall/Makefile	2013-01-09 13:56:11.775734407 -0800
 @@ -58,11 +58,11 @@
  endif
  
@@ -34,3 +39,17 @@ Index: mozilla/security/coreconf/nsinstall/Makefile
  endif
  
  include $(DEPTH)/coreconf/rules.mk
+Index: mozilla/security/coreconf/Linux.mk
+===================================================================
+--- mozilla.orig/security/coreconf/Linux.mk	2013-01-09 13:50:01.427726808 -0800
++++ mozilla/security/coreconf/Linux.mk	2013-01-09 13:55:58.815734141 -0800
+@@ -98,6 +98,9 @@
+ endif
+ endif
+ 
++ifdef NATIVE_FLAGS
++    override ARCHFLAG=
++endif
+ 
+ LIBC_TAG		= _glibc
+ 
recipes-support/nss/nss_3.13.3.bb +8 -3
index bb602b1..8b5c663 100644
@@ -1,7 +1,7 @@
 DESCRIPTION = "Mozilla's SSL and TLS implementation"
 HOMEPAGE = "http://www.mozilla.org/projects/security/pki/nss/"
 
-PR = "r1"
+PR = "r2"
 
 LICENSE = "MPL1.1 GPL LGPL"
 LIC_FILES_CHKSUM = "file://security/nss/manifest.mn;md5=d71978748f23eae3156c38ac2a691924"
@@ -24,6 +24,9 @@ TD = "${S}/tentative-dist"
 
 PARALLEL_MAKE = ""
 
+USE64BIT_x86-64 = "USE_64=1"
+USE64BIT ?= ""
+
 do_compile() {
 #	sed -e 's:SOURCE_PREFIX = $(CORE_DEPTH)/\.\./dist:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' -i ${S}/security/coreconf/source.mk
 	make -C security/nss \
@@ -49,7 +52,8 @@ do_compile() {
 		CXX="${CXX}" \
 		RANLIB="${RANLIB}" \
 		NATIVE_CC="${BUILD_CC}" \
-		NATIVE_FLAGS="${BUILD_CFLAGS}"
+		NATIVE_FLAGS="${BUILD_CFLAGS}" \
+		${USE64BIT}
 }
 
 do_install() {
@@ -67,7 +71,8 @@ do_install() {
 		NSS_USE_SYSTEM_SQLITE=1 \
 		NSS_ENABLE_ECC=1 \
 		SOURCE_LIB_DIR="${TD}/${libdir}" \
-		SOURCE_BIN_DIR="${TD}/${bindir}"
+		SOURCE_BIN_DIR="${TD}/${bindir}" \
+		${USE64BIT}
 
 	install -d ${D}/${libdir}
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 10 lines · Khem Raj

it would fair to compile for x86-64 since native flags would pass 64bit flags but internally it would append 32bit flags to linker cmdline since we did not ask for 64bit build.

This patch asks for 64bit build on x86_64 and additionally nullifies ARCHFLAG when NATIVE_CC is set, ARCHFLAG is one which sets the 32bit/64bit ness of ABI

Applied.

--
Otavio Salvador O.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br