]> code.ossystems Code Review - openembedded-core.git/commitdiff
nss: Fix build with clang
authorKhem Raj <raj.khem@gmail.com>
Wed, 13 Jul 2016 06:38:49 +0000 (23:38 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 20 Jul 2016 09:24:51 +0000 (10:24 +0100)
Add a patch to disable a clang specific warning
and avoid passing clang options to gcc when we have
cross compiler is clang but host compiler is gcc
We do not need to use target cflags when building
native pieces and hence avoid the inter-mixing of
compiler options

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-support/nss/nss/disable-Wvarargs-with-clang.patch [new file with mode: 0644]
meta/recipes-support/nss/nss/nss-fix-nsinstall-build.patch
meta/recipes-support/nss/nss_3.24.bb

diff --git a/meta/recipes-support/nss/nss/disable-Wvarargs-with-clang.patch b/meta/recipes-support/nss/nss/disable-Wvarargs-with-clang.patch
new file mode 100644 (file)
index 0000000..86b1b60
--- /dev/null
@@ -0,0 +1,33 @@
+clang 3.9 add this warning to rightly flag undefined
+behavior, we relegate this to be just a warning instead
+of error and keep the behavior as it was. Right fix would
+be to not pass enum to the function with variadic arguments
+as last named argument
+
+Fixes errors like
+ocsp.c:2220:22: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
+        va_start(ap, responseType0);
+                     ^
+ocsp.c:2200:43: note: parameter of type 'SECOidTag' is declared here
+                                SECOidTag responseType0, ...)
+
+see
+https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start
+for more details
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: nss-3.24/nss/coreconf/Werror.mk
+===================================================================
+--- nss-3.24.orig/nss/coreconf/Werror.mk
++++ nss-3.24/nss/coreconf/Werror.mk
+@@ -54,7 +54,7 @@ ifndef WARNING_CFLAGS
+     ifdef CC_IS_CLANG
+       # -Qunused-arguments : clang objects to arguments that it doesn't understand
+       #    and fixing this would require rearchitecture
+-      WARNING_CFLAGS += -Qunused-arguments
++      WARNING_CFLAGS += -Qunused-arguments -Wno-error=varargs
+       # -Wno-parentheses-equality : because clang warns about macro expansions
+       WARNING_CFLAGS += $(call disable_warning,parentheses-equality)
+       ifdef BUILD_OPT
index 866de07ea8f2eda570ccc96865bc030f5ed51293..181c69adb048301d91bccaade30f0a2f29822234 100644 (file)
@@ -16,11 +16,11 @@ Upstream-Status: Pending
 
 Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
 ===================================================
-diff --git a/nss/coreconf/nsinstall/Makefile b/nss/coreconf/nsinstall/Makefile
-index 1850bcb..5aee84f 100644
---- a/nss/coreconf/nsinstall/Makefile
-+++ b/nss/coreconf/nsinstall/Makefile
-@@ -18,6 +18,12 @@ INTERNAL_TOOLS  = 1
+Index: nss-3.24/nss/coreconf/nsinstall/Makefile
+===================================================================
+--- nss-3.24.orig/nss/coreconf/nsinstall/Makefile
++++ nss-3.24/nss/coreconf/nsinstall/Makefile
+@@ -18,6 +18,13 @@ INTERNAL_TOOLS  = 1
  
  include $(DEPTH)/coreconf/config.mk
  
@@ -29,6 +29,7 @@ index 1850bcb..5aee84f 100644
 +# to clean the '-m64' from ARCHFLAG and LDFLAGS.
 +ARCHFLAG =
 +LDFLAGS =
++CFLAGS =
 +
  ifeq (,$(filter-out OS2 WIN%,$(OS_TARGET)))
  PROGRAM               =
index 95a33f27d3cb137e390e86db20861e26eb61bf08..caed7fa894e7c87f3d8c9dea1b4ba1a3222e73bc 100644 (file)
@@ -20,6 +20,7 @@ SRC_URI = "\
     file://nss-no-rpath-for-cross-compiling.patch \
     file://nss-fix-incorrect-shebang-of-perl.patch \
     file://nss-fix-nsinstall-build.patch \
+    file://disable-Wvarargs-with-clang.patch \
     file://nss.pc.in \
     file://signlibs.sh \
 "
@@ -62,6 +63,7 @@ do_compile_prepend_class-native() {
 do_compile() {
     export CROSS_COMPILE=1
     export NATIVE_CC="gcc"
+    export NATIVE_FLAGS="${HOST_CFLAGS}"
     export BUILD_OPT=1
 
     export FREEBL_NO_DEPEND=1