From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id B9D034C97 for ; Thu, 5 Jul 2018 08:27:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2018 23:27:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,310,1526367600"; d="scan'208";a="69771531" Received: from dpdk-test32.sh.intel.com ([10.67.119.193]) by fmsmga001.fm.intel.com with ESMTP; 04 Jul 2018 23:27:53 -0700 From: Marvin Liu To: zhiyong.yang@intel.com, thomas@monjalon.net, dev@dpdk.org Cc: Marvin Liu Date: Thu, 5 Jul 2018 22:13:21 +0800 Message-Id: <20180705141321.129989-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.0 Subject: [dpdk-dev] [PATCH] mk: using initial-exec model for thread local variable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 06:27:57 -0000 When building share library, thread-local storage model will be changed to global-dynamic. It will add additional cost for reading thread local variable. On the other hand, dynamically load share library with static TLS will request additional DTV slot which is limited by loader. By now only librte_pmd_eal.so contain thread local variable. So that can make TLS model back to initial-exec like static library for better performance. Signed-off-by: Marvin Liu diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index 7e4531bab..19d5e11ef 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -43,6 +43,13 @@ ifeq (,$(findstring -O0,$(EXTRA_CFLAGS))) endif endif +# Initial execution TLS model has better performane compared to dynamic +# global. But this model require for addtional slot on DTV when dlopen +# object with thread local variable. +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +TOOLCHAIN_CFLAGS += -ftls-model=initial-exec +endif + WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual -- 2.17.0