From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: dev Digest, Vol 195, Issue 45 Date: Wed, 16 May 2018 10:35:06 +0530 Message-ID: <20180516050505.GA16248@jerin> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "dev@dpdk.org" , "Jacob, Jerin" To: Gavin Hu Return-path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0046.outbound.protection.outlook.com [104.47.40.46]) by dpdk.org (Postfix) with ESMTP id 06E731B6B3 for ; Wed, 16 May 2018 07:05:28 +0200 (CEST) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- > Date: Wed, 16 May 2018 02:08:48 +0000 > From: Gavin Hu > To: "dev@dpdk.org" , "Jacob, Jerin" > > Subject: Re: [dpdk-dev] dev Digest, Vol 195, Issue 45 > > > > > For ARM64 platform, libdpdk.a includes the > > librte_pmd_octeontx_ssovf.a, which requires the libatomic.a > > support.The atomic lib is built-in in the gcc toolchain, but for clang it has to be explicitly linked. > > For more details, please refer to > > https://clang.llvm.org/docs/Toolchain.html > > > > ~/dpdk/build/lib/librte_pmd_octeontx_ssovf.a(timvf_worker.o): In function `timvf_timer_cancel_burst': > > timvf_worker.c:(.text+0x80): undefined reference to `__atomic_fetch_add_8' > > /home/gavin/arm_repo/dpdk/build/lib/librte_pmd_octeontx_ssovf.a(timvf_worker.o): In function `timvf_timer_arm_burst_sp': > > timvf_worker.c:(.text+0x200): undefined reference to `__atomic_fetch_add_8' > > timvf_worker.c:(.text+0x244): undefined reference to `__atomic_store_2' > > timvf_worker.c:(.text+0x278): undefined reference to `__atomic_fetch_add_4' > > timvf_worker.c:(.text+0x30c): undefined reference to `__atomic_store_2' > > > > Signed-off-by: Gavin Hu > > Reviewed-by: Honnappa Nagarahalli > > > > Following patch is part of upstream. Are you testing with following patch/upstream. > > With this patch from Nikhilesh, this __ atomic__ compiling issue was gone. > The two patches fix the same issue. > Should I abandon my patch? The root cause is analyzed, the -latomic needs only when atomic operations on variable are not aligned. The fix added to align variable where it was not correct.This fix the performance issue as well, adding -latomic will simply hide the problem by not letting to know the alignment/performance issue. IMO, If there is no dependency with -latomic in current code base then we should NOT add new dependency. > > I see this note on: https://clang.llvm.org/docs/Toolchain.html > Note > Clang does not currently automatically link against libatomic when using libgcc_s. You may need to manually add -latomic to support this configuration when using non-native atomic operations (if you see link errors referring to __atomic_* functions). > > commit 55fbc92d7800100628579643c9ee2770614fef10 > Author: Pavan Nikhilesh > Date: Wed May 9 02:56:00 2018 +0530 > > event/octeontx: fix build with clang 6 > > Clang 6 & 7 fail to naturally align packed structs due to this clang > can't use 8byte atomic primitives and splits them into lesser atomic > primitives. To use lesser atomic primitives we need to link libatomic > (-latomic), instead supply alignment attribute to the compiler. > > timvf_worker.c:(.text+0x498): undefined reference to `__atomic_fetch_add_8' > timvf_worker.c:(.text+0x525): undefined reference to `__atomic_store_2' > timvf_worker.c:(.text+0x557): undefined reference to `__atomic_fetch_add_4' > timvf_worker.c:(.text+0x5de): undefined reference to `__atomic_store_2' > > Fixes: f874c1eb1519 ("event/octeontx: create and free timer > adapter") > > Reported-by: Andrew Rybchenko > Signed-off-by: Pavan Nikhilesh > Acked-by: Jerin Jacob