nss: Fix build with clang
PATCH 1/2 nss: Fix build with clang
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
--- .../nss/nss/disable-Wvarargs-with-clang.patch | 33 ++++++++++++++++++++++ .../nss/nss/nss-fix-nsinstall-build.patch | 11 ++++---- meta/recipes-support/nss/nss_3.24.bb | 2 ++ 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 meta/recipes-support/nss/nss/disable-Wvarargs-with-clang.patch
meta/recipes-support/nss/nss/disable-Wvarargs-with-clang.patch new file +33 -0
@@ -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 <[email protected]> +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
meta/recipes-support/nss/nss/nss-fix-nsinstall-build.patch +6 -5
@@ -16,11 +16,11 @@ Upstream-Status: Pending Signed-off-by: Wenzong Fan <[email protected]> =================================================== -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 =
meta/recipes-support/nss/nss_3.24.bb +2 -0
@@ -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
Signature · 1 line
2.9.0
PATCH 2/2 site: Move rsync_cv_HAVE_C99_VSNPRINTF to common-linux
If we do not cache is then configure in distcc will try to compute it using AC_TRY_RUN which will give some result on x86-64 host when target is x86-64 but it generally is wrong for cross compilation. We therefore cache it for all linux targets.
This issue is highlighted by clang when compiling distcc where it figures that its cross compiling and therefore triggers it to include its own implementation of snprintf() which does not go well with clang, gcc compiles it fine thats why we never saw the problem thus far.
--- meta/site/arm-common | 1 - meta/site/common-linux | 3 +++ meta/site/ix86-common | 1 - meta/site/nios2-linux | 1 - meta/site/sh-common | 1 - 5 files changed, 3 insertions(+), 4 deletions(-)
meta/site/arm-common +0 -1
@@ -113,7 +113,6 @@ rsync_cv_HAVE_SHORT_INO_T=${rsync_cv_HAVE_SHORT_INO_T=no} rsync_cv_HAVE_UNSIGNED_CHAR=${rsync_cv_HAVE_UNSIGNED_CHAR=no} rsync_cv_HAVE_BROKEN_READDIR=${rsync_cv_HAVE_BROKEN_READDIR=no} rsync_cv_HAVE_GETTIMEOFDAY_TZ=${rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes} -rsync_cv_HAVE_C99_VSNPRINTF=${rsync_cv_HAVE_C99_VSNPRINTF=yes} rsync_cv_HAVE_SECURE_MKSTEMP=${rsync_cv_HAVE_SECURE_MKSTEMP=yes} rsync_cv_REPLACE_INET_NTOA=${rsync_cv_REPLACE_INET_NTOA=no} rsync_cv_REPLACE_INET_ATON=${rsync_cv_REPLACE_INET_ATON=no}
meta/site/common-linux +3 -0
@@ -61,3 +61,6 @@ ac_cv_have_long_long_format=yes # apache ac_cv_o_nonblock_inherited=${ac_cv_o_nonblock_inherited=no} + +# rsync +rsync_cv_HAVE_C99_VSNPRINTF=${rsync_cv_HAVE_C99_VSNPRINTF=yes}
meta/site/ix86-common +0 -1
@@ -154,7 +154,6 @@ rsync_cv_HAVE_SHORT_INO_T=${rsync_cv_HAVE_SHORT_INO_T=no} rsync_cv_HAVE_UNSIGNED_CHAR=${rsync_cv_HAVE_UNSIGNED_CHAR=no} rsync_cv_HAVE_BROKEN_READDIR=${rsync_cv_HAVE_BROKEN_READDIR=no} rsync_cv_HAVE_GETTIMEOFDAY_TZ=${rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes} -rsync_cv_HAVE_C99_VSNPRINTF=${rsync_cv_HAVE_C99_VSNPRINTF=yes} rsync_cv_HAVE_SECURE_MKSTEMP=${rsync_cv_HAVE_SECURE_MKSTEMP=yes} rsync_cv_REPLACE_INET_NTOA=${rsync_cv_REPLACE_INET_NTOA=no} rsync_cv_REPLACE_INET_ATON=${rsync_cv_REPLACE_INET_ATON=no}
meta/site/nios2-linux +0 -1
@@ -171,7 +171,6 @@ rsync_cv_HAVE_SHORT_INO_T=${rsync_cv_HAVE_SHORT_INO_T=no} rsync_cv_HAVE_UNSIGNED_CHAR=${rsync_cv_HAVE_UNSIGNED_CHAR=no} rsync_cv_HAVE_BROKEN_READDIR=${rsync_cv_HAVE_BROKEN_READDIR=no} rsync_cv_HAVE_GETTIMEOFDAY_TZ=${rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes} -rsync_cv_HAVE_C99_VSNPRINTF=${rsync_cv_HAVE_C99_VSNPRINTF=yes} rsync_cv_HAVE_SECURE_MKSTEMP=${rsync_cv_HAVE_SECURE_MKSTEMP=yes} rsync_cv_REPLACE_INET_NTOA=${rsync_cv_REPLACE_INET_NTOA=no} rsync_cv_REPLACE_INET_ATON=${rsync_cv_REPLACE_INET_ATON=no}
meta/site/sh-common +0 -1
@@ -216,7 +216,6 @@ rsync_cv_HAVE_SHORT_INO_T=${rsync_cv_HAVE_SHORT_INO_T=no} rsync_cv_HAVE_UNSIGNED_CHAR=${rsync_cv_HAVE_UNSIGNED_CHAR=no} rsync_cv_HAVE_BROKEN_READDIR=${rsync_cv_HAVE_BROKEN_READDIR=no} rsync_cv_HAVE_GETTIMEOFDAY_TZ=${rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes} -rsync_cv_HAVE_C99_VSNPRINTF=${rsync_cv_HAVE_C99_VSNPRINTF=yes} rsync_cv_HAVE_SECURE_MKSTEMP=${rsync_cv_HAVE_SECURE_MKSTEMP=yes} rsync_cv_REPLACE_INET_NTOA=${rsync_cv_REPLACE_INET_NTOA=no} rsync_cv_REPLACE_INET_ATON=${rsync_cv_REPLACE_INET_ATON=no}
Signature · 1 line
2.9.0