devtools: catch symbol duplicates in version map
PATCH 1/1 devtools: catch symbol duplicates in version map
Add a check on versioned symbol duplicates in map files.
---
This check could be added to buildtools/check-symbols.sh so that regular developers catch the issue when building their changes... Opinions?
--- devtools/check-symbol-maps.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
devtools/check-symbol-maps.sh +15 -0
@@ -35,6 +35,21 @@ if [ -n "$orphan_symbols" ] ; then ret=1 fi +find_duplicate_symbols () +{ + for map in $(find lib drivers -name '*.map') ; do + ! buildtools/map-list-symbol.sh $map | \ + sort | uniq -c | grep -v " 1 $map" + done +} + +duplicate_symbols=$(find_duplicate_symbols) +if [ -n "$duplicate_symbols" ] ; then + echo "Found duplicates in symbol map file:" + echo "$duplicate_symbols" + ret=1 +fi + find_orphan_windows_symbols () { for def in $(find lib drivers -name '*_exports.def') ; do
Signature · 1 line
2.23.0
25/02/2021 12:14, David Marchand:
Quoted 7 lines
Add a check on versioned symbol duplicates in map files.
Signed-off-by David Marchand <[email protected]>---
This check could be added tobuildtools/check-symbols.shso that regular developers catch the issue when building their changes... Opinions?
In general I am against adding developer tools in the build process, because it could cause more issues for normal users.
Quoted 12 lines · Thomas Monjalon
25/02/2021 12:14, David Marchand:
Quoted 7 lines
Add a check on versioned symbol duplicates in map files.
Signed-off-by David Marchand <[email protected]>---
This check could be added tobuildtools/check-symbols.shso that regular developers catch the issue when building their changes... Opinions?In general I am against adding developer tools in the build process, because it could cause more issues for normal users.
Is this really likely to cause issues for normal users? If we add this to the build process any issues will surely be caught be developers before merge.
25/02/2021 12:57, Bruce Richardson:
Quoted 10 lines · Thomas Monjalon
Quoted 9 lines
25/02/2021 12:14, David Marchand:
Quoted 7 lines
Add a check on versioned symbol duplicates in map files.
Signed-off-by David Marchand <[email protected]>---
This check could be added tobuildtools/check-symbols.shso that regular developers catch the issue when building their changes... Opinions?
Quoted 4 lines
Quoted 3 lines
In general I am against adding developer tools in the build process, because it could cause more issues for normal users.
Is this really likely to cause issues for normal users?
Yes because some users will have a different shell, or other weird setup we don't think about yet.
Quoted 3 lines
If we add this to
the build process any issues will surely be caught be developers before merge.
If we want the checks to be more popular, we should write a script to help running the right script at the right time,
and ideally help in the contribution process.
Quoted 11 lines · Thomas Monjalon
25/02/2021 12:57, Bruce Richardson:
Quoted 10 lines · Thomas Monjalon
Quoted 9 lines
25/02/2021 12:14, David Marchand:
Quoted 7 lines
Add a check on versioned symbol duplicates in map files.
Signed-off-by David Marchand <[email protected]>---
This check could be added tobuildtools/check-symbols.shso that regular developers catch the issue when building their changes... Opinions?
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
In general I am against adding developer tools in the build process, because it could cause more issues for normal users.
Is this really likely to cause issues for normal users?
Yes because some users will have a different shell, or other weird setup we don't think about yet.
I think it unlikely, but ok.
Now that meson (from version 0.53 onwards) has a "filesystem" module, with an "exists" function, we can perhaps look to introduce a "developer mode" build again, based off the presence of the .git folder. Alternatively, we could make "developer mode" a regular meson option rather than trying to be too smart about it. [Or combine both and have developer mode option with "enabled"/"disabled"/"auto-detect" values]
/Bruce
25/02/2021 13:05, Bruce Richardson:
Quoted 15 lines · Thomas Monjalon
Quoted 14 lines
25/02/2021 12:57, Bruce Richardson:
Quoted 13 lines · Thomas Monjalon
Quoted 12 lines
25/02/2021 12:14, David Marchand:
Quoted 7 lines
Add a check on versioned symbol duplicates in map files.
Signed-off-by David Marchand <[email protected]>---
This check could be added tobuildtools/check-symbols.shso that regular developers catch the issue when building their changes... Opinions?In general I am against adding developer tools in the build process, because it could cause more issues for normal users.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Is this really likely to cause issues for normal users?
Yes because some users will have a different shell, or other weird setup we don't think about yet.
I think it unlikely, but ok.
You would be surprised.
I'm going to send a fix for running buildtools/check-symbols.sh on busybox.
Quoted 6 lines
Now that meson (from version 0.53 onwards) has a "filesystem" module, with an "exists" function, we can perhaps look to introduce a "developer mode" build again, based off the presence of the .git folder. Alternatively, we could make "developer mode" a regular meson option rather than trying to be too smart about it. [Or combine both and have developer mode option with "enabled"/"disabled"/"auto-detect" values]
Yes, a developer mode is a good idea.
PATCH v2 1/2 devtools: catch symbol duplicates in version map
In reply to David MarchandAdd a check on versioned symbol duplicates in map files.
---
Changes since v1:
- rebased,
--- devtools/check-symbol-maps.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
devtools/check-symbol-maps.sh +15 -0
@@ -35,4 +35,19 @@ if [ -n "$orphan_symbols" ] ; then ret=1 fi +find_duplicate_symbols () +{ + for map in $(find lib drivers -name '*.map') ; do + buildtools/map-list-symbol.sh $map | \ + sort | uniq -c | grep -v " 1 $map" || true + done +} + +duplicate_symbols=$(find_duplicate_symbols) +if [ -n "$duplicate_symbols" ] ; then + echo "Found duplicates in symbol map file:" + echo "$duplicate_symbols" + ret=1 +fi + exit $ret
Signature · 1 line
2.23.0
PATCH v2 2/2 buildtools: check symbol maps in developer mode
Hook check-symbol-maps.sh in the symbol check when in developer mode to help developers catch issues before submitting their changes.
---
Changes since v1:
- now that we have the developer mode, added this check in the build process,
--- buildtools/check-symbols.sh | 9 ++++++++- devtools/check-symbol-maps.sh | 12 ++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-)
buildtools/check-symbols.sh +8 -1
@@ -5,7 +5,9 @@ MAPFILE=$1 OBJFILE=$2 -LIST_SYMBOL=$(dirname $(readlink -f $0))/map-list-symbol.sh +ROOTDIR=$(readlink -f $(dirname $(readlink -f $0))/..) +LIST_SYMBOL=$ROOTDIR/buildtools/map-list-symbol.sh +CHECK_SYMBOL_MAPS=$ROOTDIR/devtools/check-symbol-maps.sh # added check for "make -C test/" usage if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
@@ -23,6 +25,11 @@ trap 'rm -f "$DUMPFILE"' EXIT objdump -t $OBJFILE >$DUMPFILE ret=0 + +if ! $CHECK_SYMBOL_MAPS $MAPFILE; then + ret=1 +fi + for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3` do if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
devtools/check-symbol-maps.sh +8 -4
@@ -7,11 +7,15 @@ cd $(dirname $0)/.. # speed up by ignoring Unicode details export LC_ALL=C +if [ $# = 0 ] ; then + set -- $(find lib drivers -name '*.map') +fi + ret=0 find_orphan_symbols () { - for map in $(find lib drivers -name '*.map') ; do + for map in $@ ; do for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do if echo $sym | grep -q '^per_lcore_' ; then symsrc=${sym#per_lcore_}
@@ -28,7 +32,7 @@ find_orphan_symbols () done } -orphan_symbols=$(find_orphan_symbols) +orphan_symbols=$(find_orphan_symbols $@) if [ -n "$orphan_symbols" ] ; then echo "Found only in symbol map file:" echo "$orphan_symbols" | sed 's,^,\t,'
@@ -37,13 +41,13 @@ fi find_duplicate_symbols () { - for map in $(find lib drivers -name '*.map') ; do + for map in $@ ; do buildtools/map-list-symbol.sh $map | \ sort | uniq -c | grep -v " 1 $map" || true done } -duplicate_symbols=$(find_duplicate_symbols) +duplicate_symbols=$(find_duplicate_symbols $@) if [ -n "$duplicate_symbols" ] ; then echo "Found duplicates in symbol map file:" echo "$duplicate_symbols"
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH v2 2/2] buildtools: check symbol maps in developer mode
Quoted 78 lines · David Marchand
Hook
check-symbol-maps.shin the symbol check when in developer mode to help developers catch issues before submitting their changes.Signed-off-by David Marchand <[email protected]>---
Changes since v1:
- now that we have the developer mode, added this check in the build process,--- buildtools/check-symbols.sh | 9 ++++++++- devtools/check-symbol-maps.sh | 12 ++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-)buildtools/check-symbols.sh +8
-1@@ -5,7 +5,9 @@ MAPFILE=$1 OBJFILE=$2 -LIST_SYMBOL=$(dirname $(readlink -f $0))/map-list-symbol.sh +ROOTDIR=$(readlink -f $(dirname $(readlink -f $0))/..) +LIST_SYMBOL=$ROOTDIR/buildtools/map-list-symbol.sh +CHECK_SYMBOL_MAPS=$ROOTDIR/devtools/check-symbol-maps.sh # added check for "make -C test/" usage if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]@@ -23,6 +25,11 @@ trap 'rm -f "$DUMPFILE"' EXIT objdump -t $OBJFILE >$DUMPFILE ret=0 + +if ! $CHECK_SYMBOL_MAPS $MAPFILE; then + ret=1 +fi + for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3` do if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&devtools/check-symbol-maps.sh +7
-3@@ -7,11 +7,15 @@ cd $(dirname $0)/.. # speed up by ignoring Unicode details export LC_ALL=C +if [ $# = 0 ] ; then + set -- $(find lib drivers -name '*.map') +fi + ret=0 find_orphan_symbols () { - for map in $(find lib drivers -name '*.map') ; do + for map in $@ ; do for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do if echo $sym | grep -q '^per_lcore_' ; then symsrc=${sym#per_lcore_}@@ -28,7 +32,7 @@ find_orphan_symbols () done } -orphan_symbols=$(find_orphan_symbols) +orphan_symbols=$(find_orphan_symbols $@) if [ -n "$orphan_symbols" ] ; then echo "Found only in symbol map file:" echo "$orphan_symbols" | sed 's,^,\t,'@@ -37,13 +41,13 @@ fi find_duplicate_symbols () { - for map in $(find lib drivers -name '*.map') ; do + for map in $@ ; do
devtools/check-symbol-maps.sh fi · line 53
Quoted 10 lines
devtools/check-symbol-maps.sh +1
-1buildtools/map-list-symbol.sh $map | \ sort | uniq -c | grep -v " 1 $map" || true done } -duplicate_symbols=$(find_duplicate_symbols) +duplicate_symbols=$(find_duplicate_symbols $@) if [ -n "$duplicate_symbols" ] ; then echo "Found duplicates in symbol map file:" echo "$duplicate_symbols"
+1
Re: [dpdk-dev] [PATCH v2 2/2] buildtools: check symbol maps in developer mode
Quoted 7 lines
Quoted 4 lines
Hook
check-symbol-maps.shin the symbol check when in developer mode to help developers catch issues before submitting their changes.Signed-off-by David Marchand <[email protected]>+1
Reviewed-by Ray Kinsella <[email protected]>
Series applied, thanks
Re: [dpdk-dev] [PATCH v2 2/2] buildtools: check symbol maps in developer mode
12/05/2021 22:24, Thomas Monjalon:
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Hook
check-symbol-maps.shin the symbol check when in developer mode to help developers catch issues before submitting their changes.Signed-off-by David Marchand <[email protected]>+1
Reviewed-by Ray Kinsella <[email protected]>Series applied, thanks
Oops, sorry no it cannot be merged as-is because of an incompatibility with Busybox grep: unrecognized option: exclude=version.map
I think it is because of the old function find_orphan_symbols() using the option --exclude.
Re: [dpdk-dev] [PATCH v2 2/2] buildtools: check symbol maps in developer mode
Quoted 10 lines · Thomas Monjalon
12/05/2021 22:24, Thomas Monjalon:
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Hook
check-symbol-maps.shin the symbol check when in developer mode to help developers catch issues before submitting their changes.Signed-off-by David Marchand <[email protected]>+1
Reviewed-by Ray Kinsella <[email protected]>
Quoted 7 lines
Quoted 1 line
Series applied, thanks
Oops, sorry no it cannot be merged as-is because of an incompatibility with Busybox grep: unrecognized option: exclude=version.map
I think it is because of the old function
find_orphan_symbols()using the option --exclude.
This could be fixed with:
- if ! grep -q -r --exclude=$(basename $map) \
- -w $symsrc $(dirname $map) ; then
+ if [ -z "$(grep -rlw $symsrc $(dirname $map) |grep -v
$map)" ] ; then
Do you want a v3 with this change?
Signature · 1 line
David Marchand
PATCH v3 1/3 devtools: fix orphan symbols check with busybox
In reply to David MarchandAvoid relying on GNU grep --exclude option.
--- devtools/check-symbol-maps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
devtools/check-symbol-maps.sh +1 -2
@@ -20,8 +20,7 @@ find_orphan_symbols () else symsrc=$sym fi - if ! grep -q -r --exclude=$(basename $map) \ - -w $symsrc $(dirname $map) ; then + if [ -z "$(grep -rlw $symsrc $(dirname $map) |grep -v $map)" ] ; then echo "$map: $sym" fi done
Signature · 1 line
2.23.0
PATCH v3 2/3 devtools: catch symbol duplicates in version map
Add a check on versioned symbol duplicates in map files.
---
Changes since v1:
- rebased,
--- devtools/check-symbol-maps.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
devtools/check-symbol-maps.sh +15 -0
@@ -34,4 +34,19 @@ if [ -n "$orphan_symbols" ] ; then ret=1 fi +find_duplicate_symbols () +{ + for map in $(find lib drivers -name '*.map') ; do + buildtools/map-list-symbol.sh $map | \ + sort | uniq -c | grep -v " 1 $map" || true + done +} + +duplicate_symbols=$(find_duplicate_symbols) +if [ -n "$duplicate_symbols" ] ; then + echo "Found duplicates in symbol map file:" + echo "$duplicate_symbols" + ret=1 +fi + exit $ret
Signature · 1 line
2.23.0
PATCH v3 3/3 build: check symbol maps in developer mode
In reply to David MarchandHook check-symbol-maps.sh in the symbol check when in developer mode to help developers catch issues before submitting their changes.
---
Changes since v1:
- now that we have the developer mode, added this check in the build process,
--- buildtools/check-symbols.sh | 9 ++++++++- devtools/check-symbol-maps.sh | 12 ++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-)
buildtools/check-symbols.sh +8 -1
@@ -5,7 +5,9 @@ MAPFILE=$1 OBJFILE=$2 -LIST_SYMBOL=$(dirname $(readlink -f $0))/map-list-symbol.sh +ROOTDIR=$(readlink -f $(dirname $(readlink -f $0))/..) +LIST_SYMBOL=$ROOTDIR/buildtools/map-list-symbol.sh +CHECK_SYMBOL_MAPS=$ROOTDIR/devtools/check-symbol-maps.sh # added check for "make -C test/" usage if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
@@ -23,6 +25,11 @@ trap 'rm -f "$DUMPFILE"' EXIT objdump -t $OBJFILE >$DUMPFILE ret=0 + +if ! $CHECK_SYMBOL_MAPS $MAPFILE; then + ret=1 +fi + for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3` do if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
devtools/check-symbol-maps.sh +8 -4
@@ -7,11 +7,15 @@ cd $(dirname $0)/.. # speed up by ignoring Unicode details export LC_ALL=C +if [ $# = 0 ] ; then + set -- $(find lib drivers -name '*.map') +fi + ret=0 find_orphan_symbols () { - for map in $(find lib drivers -name '*.map') ; do + for map in $@ ; do for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do if echo $sym | grep -q '^per_lcore_' ; then symsrc=${sym#per_lcore_}
@@ -27,7 +31,7 @@ find_orphan_symbols () done } -orphan_symbols=$(find_orphan_symbols) +orphan_symbols=$(find_orphan_symbols $@) if [ -n "$orphan_symbols" ] ; then echo "Found only in symbol map file:" echo "$orphan_symbols" | sed 's,^,\t,'
@@ -36,13 +40,13 @@ fi find_duplicate_symbols () { - for map in $(find lib drivers -name '*.map') ; do + for map in $@ ; do buildtools/map-list-symbol.sh $map | \ sort | uniq -c | grep -v " 1 $map" || true done } -duplicate_symbols=$(find_duplicate_symbols) +duplicate_symbols=$(find_duplicate_symbols $@) if [ -n "$duplicate_symbols" ] ; then echo "Found duplicates in symbol map file:" echo "$duplicate_symbols"
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH v3 3/3] build: check symbol maps in developer mode
13/05/2021 10:34, David Marchand:
Quoted 5 lines
Hook
check-symbol-maps.shin the symbol check when in developer mode to help developers catch issues before submitting their changes.Signed-off-by David Marchand <[email protected]>Reviewed-by Ray Kinsella <[email protected]>
Series applied, thanks.