[dpdk-dev,1/4] app: add LDFLAGS -latomic to link atomic lib
Checks
Commit Message
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 <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
---
mk/rte.app.mk | 1 +
1 file changed, 1 insertion(+)
Comments
On Tue, May 15, 2018 at 04:28:41AM -0400, Gavin Hu wrote:
> 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 <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> ---
Is an equivalent change also needed for the meson build too?
/Bruce
-----Original Message-----
> Date: Tue, 15 May 2018 04:28:41 -0400
> From: Gavin Hu <gavin.hu@arm.com>
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/4] app: add LDFLAGS -latomic to link atomic lib
> X-Mailer: git-send-email 2.1.4
>
> 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 <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Following patch is part of upstream. Are you testing with following
patch/upstream.
commit 55fbc92d7800100628579643c9ee2770614fef10
Author: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
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 <arybchenko@solarflare.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> mk/rte.app.mk | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
> index 438f99d..bca8325 100644
> --- a/mk/rte.app.mk
> +++ b/mk/rte.app.mk
> @@ -51,6 +51,7 @@ endif
>
> # Link only the libraries used in the application
> LDFLAGS += --as-needed
> +LDFLAGS += -latomic
>
> # default path for libs
> _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
> --
> 2.1.4
>
Hi Bruce,
CC=clang Meson build did not hit this issue.
The GNU Makefile using clang hit this issue:
make config T=arm64-armv8a-linuxapp-clang
Best Regards,
Gavin
-----Original Message-----
From: Bruce Richardson <bruce.richardson@intel.com>
Sent: Tuesday, May 15, 2018 5:00 PM
To: Gavin Hu <Gavin.Hu@arm.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/4] app: add LDFLAGS -latomic to link atomic lib
On Tue, May 15, 2018 at 04:28:41AM -0400, Gavin Hu wrote:
> 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 <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> ---
Is an equivalent change also needed for the meson build too?
/Bruce
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
@@ -51,6 +51,7 @@ endif
# Link only the libraries used in the application
LDFLAGS += --as-needed
+LDFLAGS += -latomic
# default path for libs
_LDLIBS-y += -L$(RTE_SDK_BIN)/lib