From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id F0035A0A0E;
	Tue, 23 Mar 2021 18:47:47 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D21BA140FB4;
	Tue, 23 Mar 2021 18:47:47 +0100 (CET)
Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61])
 by mails.dpdk.org (Postfix) with ESMTP id 8130C4003D
 for <dev@dpdk.org>; Mon, 22 Mar 2021 21:14:51 +0100 (CET)
Received: from anongoth.pl (unknown [192.168.1.15])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (Client did not present a certificate)
 (Authenticated sender: pkubaj@anongoth.pl)
 by mail.anongoth.pl (Postfix) with ESMTPSA id 89EB8D42B1;
 Mon, 22 Mar 2021 21:14:49 +0100 (CET)
Date: Mon, 22 Mar 2021 21:14:44 +0100
From: Piotr Kubaj <pkubaj@anongoth.pl>
To: David Christensen <drc@linux.vnet.ibm.com>
Cc: nicolas.chautru@intel.com, declan.doherty@intel.com,
 ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com,
 beilei.xing@intel.com, jia.guo@intel.com, haiyue.wang@intel.com,
 jiawenwu@trustnetic.com, jianwang@trustnetic.com, dev@dpdk.org
Message-ID: <YFj6tCMvF+2BKazd@KGPE-D16>
References: <20210311161140.70534-1-pkubaj@FreeBSD.org>
 <2a3387dc-c9b7-2053-16f3-e4b595341eba@linux.vnet.ibm.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature"; boundary="g6mqzVCiOlMTb6gY"
Content-Disposition: inline
In-Reply-To: <2a3387dc-c9b7-2053-16f3-e4b595341eba@linux.vnet.ibm.com>
X-Mailman-Approved-At: Tue, 23 Mar 2021 18:47:46 +0100
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
Subject: Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without
 glibc
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>


--g6mqzVCiOlMTb6gY
Content-Type: multipart/mixed; boundary="zaTZfhG6hjYWhYfY"
Content-Disposition: inline


--zaTZfhG6hjYWhYfY
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Thank you for your input.

I did not have Linux installed on my box previously and assumed
__GLIBC__ is always defined when glibc i used.

I just tested that this patch works on both Linux (Fedora 33) and
FreeBSD (13.0-RC3 powerpc64le).

On 21-03-15 12:48:19, David Christensen wrote:
>=20
>=20
> On 3/11/21 8:11 AM, Piotr Kubaj wrote:
> > There are couple of issues when building with Clang:
> > 1. vector is a keyword and should not be used in code. I undefined it,
> > but it would probably be better to just change the variable name.
> > 2. vector long is deprecated by Clang and should not be used. I switched
> > here to vector int.
> > 3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
> > available in other libc's. Use the portable method of reading TBR when
> > glibc is not used.  Taken from
> > https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob;f=3Dsysdeps/powerpc/=
sys/platform/ppc.h
> >=20
> > Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> > ---
>=20
> Build with patch on my POWER9 system with RHEL 8.3 (gcc 8.3.1 20191121)=
=20
> generates the following errors:
>=20
>=20
> ninja -C build
> ninja: Entering directory `build'
> [1221/2455] Compiling C object=20
> 'drivers/a715181@@tmp_rte_net_i40e@sta/net_i40e_i40e_rxtx_vec_altivec.c.o=
'.
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c: In function=20
> =E2=80=98_recv_raw_pkts_vec=E2=80=99:
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:243:35: warning: conversion=
=20
> from =E2=80=98long long unsigned int=E2=80=99 to =E2=80=98unsigned int=E2=
=80=99 changes value from=20
> =E2=80=984294967297=E2=80=99 to =E2=80=981=E2=80=99 [-Woverflow]
>    dd_check =3D (vector unsigned int){0x0000000100000001ULL,
>                                     ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:244:8: warning: conversion=20
> from =E2=80=98long long unsigned int=E2=80=99 to =E2=80=98unsigned int=E2=
=80=99 changes value from=20
> =E2=80=984294967297=E2=80=99 to =E2=80=981=E2=80=99 [-Woverflow]
>          0x0000000100000001ULL};
>          ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:247:36: warning: conversion=
=20
> from =E2=80=98long long unsigned int=E2=80=99 to =E2=80=98unsigned int=E2=
=80=99 changes value from=20
> =E2=80=988589934594=E2=80=99 to =E2=80=982=E2=80=99 [-Woverflow]
>    eop_check =3D (vector unsigned int){0x0000000200000002ULL,
>                                      ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:248:9: warning: conversion=20
> from =E2=80=98long long unsigned int=E2=80=99 to =E2=80=98unsigned int=E2=
=80=99 changes value from=20
> =E2=80=988589934594=E2=80=99 to =E2=80=982=E2=80=99 [-Woverflow]
>           0x0000000200000002ULL};
>           ^~~~~~~~~~~~~~~~~~~~~
> [1736/2455] Compiling C object=20
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'.
> In file included from ../drivers/event/dsw/dsw_evdev.c:7:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function =E2=80=98rte_rdts=
c=E2=80=99:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit=20
> declaration of function =E2=80=98__ppc_get_timebase=E2=80=99; did you mea=
n=20
> =E2=80=98__builtin_ppc_get_timebase=E2=80=99? [-Wimplicit-function-declar=
ation]
>    return __ppc_get_timebase();
>           ^~~~~~~~~~~~~~~~~~
>           __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern=
=20
> declaration of =E2=80=98__ppc_get_timebase=E2=80=99 [-Wnested-externs]
> [1862/2455] Compiling C object=20
> 'app/a172ced@@dpdk-testpmd@exe/test-pmd_ieee1588fwd.c.o'.
> In file included from ../app/test-pmd/ieee1588fwd.c:6:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function =E2=80=98rte_rdts=
c=E2=80=99:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit=20
> declaration of function =E2=80=98__ppc_get_timebase=E2=80=99; did you mea=
n=20
> =E2=80=98__builtin_ppc_get_timebase=E2=80=99? [-Wimplicit-function-declar=
ation]
>    return __ppc_get_timebase();
>           ^~~~~~~~~~~~~~~~~~
>           __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern=
=20
> declaration of =E2=80=98__ppc_get_timebase=E2=80=99 [-Wnested-externs]
> [2330/2455] Linking target drivers/librte_event_dsw.so.21.2.
> FAILED: drivers/librte_event_dsw.so.21.2
> cc  -o drivers/librte_event_dsw.so.21.2=20
> 'drivers/a715181@@rte_event_dsw@sha/meson-generated_.._rte_event_dsw.pmd.=
c.o'=20
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'=20
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_event.c.o'=20
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_xstats.c.o'=20
> -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC=20
> -Wl,--start-group -Wl,-soname,librte_event_dsw.so.21 -Wl,--no-as-needed=
=20
> -pthread -lm -ldl -lnuma lib/librte_eventdev.so.21.2=20
> lib/librte_eal.so.21.2 lib/librte_kvargs.so.21.2=20
> lib/librte_telemetry.so.21.2 lib/librte_ring.so.21.2=20
> lib/librte_ethdev.so.21.2 lib/librte_net.so.21.2 lib/librte_mbuf.so.21.2=
=20
> lib/librte_mempool.so.21.2 lib/librte_meter.so.21.2=20
> lib/librte_hash.so.21.2 lib/librte_rcu.so.21.2 lib/librte_timer.so.21.2=
=20
> lib/librte_cryptodev.so.21.2 drivers/librte_bus_vdev.so.21.2=20
> -Wl,--end-group=20
> -Wl,--version-script=3D/home/drc/src/dpdk/drivers/event/dsw/version.map=
=20
> '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/'=20
> -Wl,-rpath-link,/home/drc/src/dpdk/build/lib:/home/drc/src/dpdk/build/dri=
vers
> drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o: In=20
> function `dsw_start':
> dsw_evdev.c:(.text+0x1078): undefined reference to `__ppc_get_timebase'
> collect2: error: ld returned 1 exit status
> [2359/2455] Compiling C object=20
> 'app/test/3062f5d@@dpdk-test@exe/test_trace_perf.c.o'.
> In file included from ../app/test/test_trace_perf.c:5:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function =E2=80=98rte_rdts=
c=E2=80=99:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit=20
> declaration of function =E2=80=98__ppc_get_timebase=E2=80=99; did you mea=
n=20
> =E2=80=98__builtin_ppc_get_timebase=E2=80=99? [-Wimplicit-function-declar=
ation]
>    return __ppc_get_timebase();
>           ^~~~~~~~~~~~~~~~~~
>           __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern=
=20
> declaration of =E2=80=98__ppc_get_timebase=E2=80=99 [-Wnested-externs]
> [2366/2455] Compiling C object=20
> 'drivers/a715181@@tmp_rte_event_octeontx2@sta/event_octeontx2_otx2_worker=
_dual.c.o'.
> ninja: build stopped: subcommand failed.

--zaTZfhG6hjYWhYfY--

--g6mqzVCiOlMTb6gY--