On Fri, Oct 8, 2021 at 10:07 AM Peng, ZhihongX <zhihongx.p...@intel.com> wrote: > > > -----Original Message----- > > From: David Marchand <david.march...@redhat.com> > > Sent: Thursday, September 30, 2021 4:20 PM > > To: Peng, ZhihongX <zhihongx.p...@intel.com>; Richardson, Bruce > > <bruce.richard...@intel.com> > > Cc: Burakov, Anatoly <anatoly.bura...@intel.com>; Ananyev, Konstantin > > <konstantin.anan...@intel.com>; Stephen Hemminger > > <step...@networkplumber.org>; dev <dev@dpdk.org>; Lin, Xueqin > > <xueqin....@intel.com>; Thomas Monjalon <tho...@monjalon.net> > > Subject: Re: [dpdk-dev] [PATCH v6 1/2] Enable ASan for memory detector on > > DPDK > > > > Hello, > > > > I see v6 is superseded in pw, I have been cleaning my queue... maybe my > > fault. > >
[snip] > > > V7 version will be modified. Ok, let's forget about *v6 bis* and go with v7... > > > Something like (only quickly tested): > > > > diff --git a/config/meson.build b/config/meson.build index > > 4cdf589e20..7d8b71da79 100644 > > --- a/config/meson.build > > +++ b/config/meson.build > > @@ -411,6 +411,33 @@ if get_option('b_lto') > > endif > > endif > > > > +if get_option('b_sanitize') == 'address' > > + asan_dep = cc.find_library('asan', required: true) > > + if (not cc.links('int main(int argc, char *argv[]) { return 0; }', > > + dependencies: asan_dep)) > > + error('broken dependency, "libasan"') > > + endif > > + add_project_link_arguments('-lasan', language: 'c') > > + dpdk_extra_ldflags += '-lasan' > > +endif > > + > > if get_option('default_library') == 'both' > > error( ''' > > Unsupported value "both" for "default_library" option. > > > > > > Bruce, do you see an issue with this approach? > > It seems clearer to get the ASan switch in the c code. This is a feature the developper asked for at configuration time. We have other condition to fulfill to get ASan linking correctly (wrt lundef workaround and presence of libasan on Centos/RHEL 7). It's not a matter of being clearer (which I fail to see how it is), it's a matter of putting the check at the right place. -- David Marchand