[2/2] buildtools: fix build with coverage enabled

Message ID 20191125081007.12396-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [1/2] buildtools: fix experimental symbols listing |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues
ci/travis-robot success Travis build: passed

Commit Message

David Marchand Nov. 25, 2019, 8:10 a.m. UTC
  A compiler can reuse a variable name and prefix it when instrumenting
with coverage.

Example:
$ make defconfig T=x86_64-native-linux-gcc O=master
$ make EXTRA_CFLAGS='--coverage' O=master
[...]
    CC rte_flow.o
 rte_flow_dynf_metadata_offs is not flagged as experimental but is listed
 in version map
 Please add __rte_experimental to the definition of
 rte_flow_dynf_metadata_offs

$ objdump -t master/build/lib/librte_ethdev/rte_flow.o |grep _offs$
0000000000000000 l     F .text.startup	000000000000000a
  _GLOBAL__sub_I_65535_0_rte_flow_dynf_metadata_offs
0000000000000620 g     O .data	0000000000000004
  rte_flow_dynf_metadata_offs

Protect against this by adding a space character in the pattern.

Fixes: a4bcd61de82d ("buildtools: add script to check experimental API exports")
Cc: stable@dpdk.org

Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 buildtools/check-experimental-syms.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Andrew Rybchenko Nov. 25, 2019, 8:28 a.m. UTC | #1
On 11/25/19 11:10 AM, David Marchand wrote:
> A compiler can reuse a variable name and prefix it when instrumenting
> with coverage.
> 
> Example:
> $ make defconfig T=x86_64-native-linux-gcc O=master
> $ make EXTRA_CFLAGS='--coverage' O=master
> [...]
>     CC rte_flow.o
>  rte_flow_dynf_metadata_offs is not flagged as experimental but is listed
>  in version map
>  Please add __rte_experimental to the definition of
>  rte_flow_dynf_metadata_offs
> 
> $ objdump -t master/build/lib/librte_ethdev/rte_flow.o |grep _offs$
> 0000000000000000 l     F .text.startup	000000000000000a
>   _GLOBAL__sub_I_65535_0_rte_flow_dynf_metadata_offs
> 0000000000000620 g     O .data	0000000000000004
>   rte_flow_dynf_metadata_offs
> 
> Protect against this by adding a space character in the pattern.
> 
> Fixes: a4bcd61de82d ("buildtools: add script to check experimental API exports")
> Cc: stable@dpdk.org
> 
> Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

David,

thanks a lot, it solves build problem.

It does not solve experimental symbol inconsistency problem in
markup and map file, but it is a separate less critical
problem.

Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
  
David Marchand Nov. 25, 2019, 10:57 a.m. UTC | #2
On Mon, Nov 25, 2019 at 9:29 AM Andrew Rybchenko
<arybchenko@solarflare.com> wrote:
>
> On 11/25/19 11:10 AM, David Marchand wrote:
> > A compiler can reuse a variable name and prefix it when instrumenting
> > with coverage.
> >
> > Example:
> > $ make defconfig T=x86_64-native-linux-gcc O=master
> > $ make EXTRA_CFLAGS='--coverage' O=master
> > [...]
> >     CC rte_flow.o
> >  rte_flow_dynf_metadata_offs is not flagged as experimental but is listed
> >  in version map
> >  Please add __rte_experimental to the definition of
> >  rte_flow_dynf_metadata_offs
> >
> > $ objdump -t master/build/lib/librte_ethdev/rte_flow.o |grep _offs$
> > 0000000000000000 l     F .text.startup        000000000000000a
> >   _GLOBAL__sub_I_65535_0_rte_flow_dynf_metadata_offs
> > 0000000000000620 g     O .data        0000000000000004
> >   rte_flow_dynf_metadata_offs
> >
> > Protect against this by adding a space character in the pattern.
> >
> > Fixes: a4bcd61de82d ("buildtools: add script to check experimental API exports")
> > Cc: stable@dpdk.org
> >
> > Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>
> David,
>
> thanks a lot, it solves build problem.
>
> It does not solve experimental symbol inconsistency problem in
> markup and map file, but it is a separate less critical
> problem.

We have lived with this situation on experimental variables.
So yes, the priority is to fix compilation.

I will see if you can do/need something about the variables.


Thanks for the tests Andrew.
  

Patch

diff --git a/buildtools/check-experimental-syms.sh b/buildtools/check-experimental-syms.sh
index abebb89f12..f3603e5bac 100755
--- a/buildtools/check-experimental-syms.sh
+++ b/buildtools/check-experimental-syms.sh
@@ -25,8 +25,8 @@  objdump -t $OBJFILE >$DUMPFILE
 ret=0
 for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3`
 do
-	if grep -q "\.text.*$SYM$" $DUMPFILE &&
-		! grep -q "\.text\.experimental.*$SYM$" $DUMPFILE
+	if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
+		! grep -q "\.text\.experimental.*[[:space:]]$SYM$" $DUMPFILE
 	then
 		cat >&2 <<- END_OF_MESSAGE
 		$SYM is not flagged as experimental