From 47570b4cf5a050c08b647f902b5ff6859a937d59 Mon Sep 17 00:00:00 2001 From: Lucian Cristian Date: Thu, 14 May 2020 16:26:08 +0300 Subject: [PATCH] nss: add -flto and makefile cleanup Signed-off-by: Lucian Cristian --- libs/nss/Makefile | 49 ++++++++++++-------------- libs/nss/patches/003-openwrt_fix.patch | 9 +++++ 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/libs/nss/Makefile b/libs/nss/Makefile index e1b5ba8233..a005a15db2 100644 --- a/libs/nss/Makefile +++ b/libs/nss/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nss PKG_VERSION:=3.52 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= \ @@ -62,37 +62,34 @@ ifeq ($(CONFIG_CPU_TYPE),"xscale") TARGET_CFLAGS+= -mfloat-abi=softfp endif -TARGET_CFLAGS += -D_GNU_SOURCE -TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed - -export CROSS_COMPILE=1 -export BUILD_OPT=1 +TARGET_CFLAGS += -D_GNU_SOURCE -flto export NATIVE_CC=$(HOSTCC) export NATIVE_FLAGS=$(HOST_CFLAGS) -export NSDISTMODE=copy -export NSS_ENABLE_WERROR=0 -export NSS_DISABLE_GTESTS=1 -export NSS_USE_SYSTEM_SQLITE=1 -export OS_TARGET=Linux -export OS_ARCH=Linux -export OS_TEST=$(ARCH) -export CPU_ARCH=$(ARCH) -export fpic=$(FPIC) -export NSPR_INCLUDE_DIR=$(STAGING_DIR)/usr/include/nspr -export SEED_ONLY_DEV_URANDOM=1 -export OS_REL_CFLAGS=$(TARGET_CFLAGS) -export NS_USE_GCC=1 -export FREEBL_NO_DEPEND=1 -#size optimisation, seems to not impact speed -export NSS_DISABLE_DBM=1 -export NSS_PKIX_NO_LDAP=1 -export ALLOW_OPT_CODE_SIZE=1 -export OPT_CODE_SIZE=1 + +MAKE_FLAGS += \ + CROSS_COMPILE=1 \ + BUILD_OPT=1 \ + NSDISTMODE=copy \ + NSS_DISABLE_GTESTS=1 \ + NSS_USE_SYSTEM_SQLITE=1 \ + OS_ARCH=Linux \ + OS_TEST=$(ARCH) \ + fpic=$(FPIC) \ + NSPR_INCLUDE_DIR=$(STAGING_DIR)/usr/include/nspr \ + SEED_ONLY_DEV_URANDOM=1 \ + NS_USE_GCC=1 \ + FREEBL_NO_DEPEND=1 \ + NSS_DISABLE_DBM=1 \ + NSS_PKIX_NO_LDAP=1 \ + ALLOW_OPT_CODE_SIZE=1 \ + OPT_CODE_SIZE=1 \ + OS_REL_CFLAGS="$(TARGET_CFLAGS)" #native compile nsinstall define Build/Prepare $(call Build/Prepare/Default) - USE_NATIVE=1 OS_REL_CFLAGS="$(HOST_CFLAGS)" LDFLAGS="$(HOST_LDFLAGS)" CC="$(HOSTCC)" \ + USE_NATIVE=1 OS_REL_CFLAGS="$(HOST_CFLAGS)" LDFLAGS="$(HOST_LDFLAGS)" \ + CC="$(HOSTCC)" CPU_ARCH="$(HOST_ARCH)" \ $(MAKE) -C $(PKG_BUILD_DIR)/nss/coreconf/nsinstall endef diff --git a/libs/nss/patches/003-openwrt_fix.patch b/libs/nss/patches/003-openwrt_fix.patch index 747860f520..e3eb2ceddd 100644 --- a/libs/nss/patches/003-openwrt_fix.patch +++ b/libs/nss/patches/003-openwrt_fix.patch @@ -65,6 +65,15 @@ ifdef MOZ_DEBUG_SYMBOLS ifdef MOZ_DEBUG_FLAGS OPTIMIZER += $(MOZ_DEBUG_FLAGS) +@@ -192,7 +192,7 @@ + endif + endif + +-MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) ++MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH) $(fpic) -Wl,--gc-sections,--as-needed + + ifdef MAPFILE + MKSHLIB += -Wl,--version-script,$(MAPFILE) --- a/nss/coreconf/UNIX.mk 2019-04-06 20:34:24.284157646 +0300 +++ b/nss/coreconf/UNIX.mk 2019-04-06 20:34:34.760485327 +0300 @@ -10,7 +10,6 @@ -- 2.30.2