From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: 16.07-rc2 issue with rte_rtm_init(void) constructor Date: Thu, 14 Jul 2016 13:30:14 +0200 Message-ID: <8960687.gEONPgFZ8H@xps13> References: <2746154.p2WhExbrR9@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: "Damjan Marion (damarion)" Return-path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 329633989 for ; Thu, 14 Jul 2016 13:30:16 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id i5so109273089wmg.0 for ; Thu, 14 Jul 2016 04:30:16 -0700 (PDT) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-07-14 09:36, Damjan Marion: >=20 > > On 14 Jul 2016, at 10:20, Thomas Monjalon wrote: > >=20 > > 2016-07-13 22:58, Damjan Marion: > >> I have issues with linking application to 16.07-rc2. > >>=20 > >> Looks like reason is constructor function in include file, > >> so our unit test apps are failing to link as they are not linked w= ith dpdk libs. > >> (and they should not be as they are not calling any dpdk function)= . > >=20 > > I don't understand: > > Why are you linking DPDK if you do not use any DPDK function? >=20 > If i simplify it, i have 4 components: >=20 > 1. libdpdk > 2. libXXX > 3. app-A > 4. app-B >=20 > libXXX includes some dpdk headers, mainly because of data structures = like rte_mbuf, and some functions are calling > functions form libdpdk. >=20 > app-A links against libdpdk and libXXX > app-B links against libXXX only and only uses functions from libXXX w= hich doesn=E2=80=99t have dpdk dependency >=20 > This is working fine in 14.04. In 14.07 rte_rtm_init() implants himse= lf into libXXX as it is defined > in header file, and that causes linking to fail due to missing rte_cp= u_get_flag_enabled(). OK I better understand :) > >> static inline void __attribute__((constructor)) > >> rte_rtm_init(void) > >> { > >> rtm_supported =3D rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM)= ; > >> } > >>=20 > >> linking fails with: > >> dpdk/include/rte_spinlock.h:103: undefined reference to `rte_cpu_g= et_flag_enabled=E2=80=99 > >>=20 > >> Is there any chance that this one is moved to some .c file, so it = is loaded > >> only when it is really needed? > >=20 > > Yes it could be moved to lib/librte_eal/common/arch/x86/. >=20 > Any chance to get this in 16.07 ? Yes maybe if you submit a patch quickly and it is clean enough.