When building share library, thread-local storage model will be changed to global-dynamic. It will cost additional protect for read thread local variable. By now only lcore id is this kind of varaible and not need to dynamic share with other threads. So make TLS model back to initial-exec like static library for better performance.
Signed-off-by: Marvin Liu <yong....@intel.com> diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index 7e4531b..7b5e71c 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -43,6 +43,10 @@ ifeq (,$(findstring -O0,$(EXTRA_CFLAGS))) endif endif +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 -- 1.9.3