Skip to contentSkip to conversation

eal/windows: fix symbol export

PATCH Superseded David Marchand 4 participants 14 messages Oct 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 eal/windows: fix symbol export

The incriminated commit forgot to clean the Windows export file.

Fixes 3cd73a1a1c4d ("eal: simplify exit functions")
---
 lib/librte_eal/rte_eal_exports.def | 1 -
 1 file changed, 1 deletion(-)
lib/librte_eal/rte_eal_exports.def +0 -1
index 16f8e33874..975acb8ffe 100644
@@ -32,7 +32,6 @@ EXPORTS
 	rte_devargs_remove
 	rte_devargs_type_count
 	rte_dump_physmem_layout
-	rte_dump_registers
 	rte_dump_stack
 	rte_dump_tailq
 	rte_eal_alarm_cancel
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/2 devtools: check Windows export files

Updating export files (supposed to disappear at some point, but still there) might be missed when removing symbols in the API / map files. Add a check for this case.

---
 devtools/check-symbol-maps.sh | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
devtools/check-symbol-maps.sh +23 -1
index 7fdfaa11c4..4a77fde12b 100755
@@ -7,6 +7,8 @@ cd $(dirname $0)/..
 # speed up by ignoring Unicode details
 export LC_ALL=C
 
+ret=0
+
 find_orphan_symbols ()
 {
     for map in $(find lib drivers -name '*.map') ; do
@@ -30,5 +32,25 @@ orphan_symbols=$(find_orphan_symbols)
 if [ -n "$orphan_symbols" ] ; then
     echo "Found only in symbol map file:"
     echo "$orphan_symbols" | sed 's,^,\t,'
-    exit 1
+    ret=1
+fi
+
+validate_windows_exports ()
+{
+    for map in $(find lib drivers -name '*.map') ; do
+        def=${map/_version.map}_exports.def
+        [ -e $def ] || continue
+        for sym in $(grep -v ^EXPORTS $def); do
+            grep -q $sym $map || echo $sym
+        done
+    done
+}
+
+unknown_windows_symbols=$(validate_windows_exports)
+if [ -n "$unknown_windows_symbols" ] ; then
+    echo "Found only in Windows export file:"
+    echo "$unknown_windows_symbols" | sed 's,^,\t,'
+    ret=1
 fi
+
+exit $ret
Signature · 1 line
2.23.0
#2 lore raw

Re: [dpdk-dev] [PATCH 2/2] devtools: check Windows export files

devtools/check-symbol-maps.sh orphan_symbols=$(find_orphan_symbols) · line 42

Quoted 5 lines · David Marchand
devtools/check-symbol-maps.sh +5 -0
+validate_windows_exports ()
+{
+    for map in $(find lib drivers -name '*.map') ; do
+        def=${map/_version.map}_exports.def
+        [ -e $def ] || continue

I should have inverted this logic and look for exports.def files. I'll respin.

Signature · 1 line
David marchand
#4 lore raw

PATCH v2 1/2 eal/windows: fix symbol export

In reply to David Marchand

The incriminated commit forgot to clean the Windows export file.

Fixes 3cd73a1a1c4d ("eal: simplify exit functions")
---
 lib/librte_eal/rte_eal_exports.def | 1 -
 1 file changed, 1 deletion(-)
lib/librte_eal/rte_eal_exports.def +0 -1
index 16f8e33874..975acb8ffe 100644
@@ -32,7 +32,6 @@ EXPORTS
 	rte_devargs_remove
 	rte_devargs_type_count
 	rte_dump_physmem_layout
-	rte_dump_registers
 	rte_dump_stack
 	rte_dump_tailq
 	rte_eal_alarm_cancel
Signature · 1 line
2.23.0
#5 lore raw

PATCH v2 2/2 devtools: check Windows export files

Updating export files (supposed to disappear at some point, but still there) might be missed when removing symbols in the API / map files. Add a check for this case.

---
Changelog since v1:
- invert logic, as .def files are the exception,
- reuse orphan denomination,

---
 devtools/check-symbol-maps.sh | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
devtools/check-symbol-maps.sh +22 -1
index 7fdfaa11c4..dae92f77a4 100755
@@ -7,6 +7,8 @@ cd $(dirname $0)/..
 # speed up by ignoring Unicode details
 export LC_ALL=C
 
+ret=0
+
 find_orphan_symbols ()
 {
     for map in $(find lib drivers -name '*.map') ; do
@@ -30,5 +32,24 @@ orphan_symbols=$(find_orphan_symbols)
 if [ -n "$orphan_symbols" ] ; then
     echo "Found only in symbol map file:"
     echo "$orphan_symbols" | sed 's,^,\t,'
-    exit 1
+    ret=1
 fi
+
+find_orphan_windows_symbols ()
+{
+    for def in $(find lib drivers -name '*_exports.def') ; do
+        map=${def/_exports.def}_version.map
+        for sym in $(grep -v ^EXPORTS $def); do
+            grep -q $sym $map || echo $sym
+        done
+    done
+}
+
+orphan_windows_symbols=$(find_orphan_windows_symbols)
+if [ -n "$orphan_windows_symbols" ] ; then
+    echo "Found only in Windows export file:"
+    echo "$orphan_windows_symbols" | sed 's,^,\t,'
+    ret=1
+fi
+
+exit $ret
Signature · 1 line
2.23.0
Acked-by on v2 2/2
#6 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] devtools: check Windows export files

16/10/2020 12:27, David Marchand:

Quoted 9 lines

Updating export files (supposed to disappear at some point, but still there) might be missed when removing symbols in the API / map files. Add a check for this case.

---
Changelog since v1:
- invert logic, as .def files are the exception,
- reuse orphan denomination,

#7 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] devtools: check Windows export files

Quoted 8 lines · Thomas Monjalon

16/10/2020 12:27, David Marchand:

Quoted 5 lines

Updating export files (supposed to disappear at some point, but still there) might be missed when removing symbols in the API / map files. Add a check for this case.

Series applied.

Signature · 1 line
David Marchand
Acked-by on v2 1/2
#8 lore raw
In reply to David Marchand

The windows exports and the map files, feels like duplication of effort. Could we massage one into the other during the build?

Quoted 16 lines · David Marchand

The incriminated commit forgot to clean the Windows export file.

Fixes 3cd73a1a1c4d ("eal: simplify exit functions")
---
 lib/librte_eal/rte_eal_exports.def | 1 -
 1 file changed, 1 deletion(-)
lib/librte_eal/rte_eal_exports.def +0 -0
index 16f8e33874..975acb8ffe 100644

lib/librte_eal/rte_eal_exports.def EXPORTS · line 37

Quoted 7 lines
lib/librte_eal/rte_eal_exports.def +0 -1
@@ -32,7 +32,6 @@ EXPORTS
 	rte_devargs_remove
 	rte_devargs_type_count
 	rte_dump_physmem_layout
-	rte_dump_registers
 	rte_dump_stack
 	rte_dump_tailq
 	rte_eal_alarm_cancel
#11 lore raw
In reply to David Marchand
Quoted 12 lines · David Marchand
Quoted 4 lines · Ray

The windows exports and the map files, feels like duplication of effort. Could we massage one into the other during the build?

That's what is done with map-to-win.py, unless we have one exception when the full library is not ready, like EAL.

https://git.dpdk.org/dpdk/tree/lib/meson.build#n152
https://git.dpdk.org/dpdk/tree/buildtools/map_to_win.py#n27

Thinking about this again - future work might be to check if a .def exists. And then to warn in checkpatch if one is modified without the other?

Ray K

#12 lore raw
Quoted 11 lines · Ray
Quoted 9 lines · David Marchand
Quoted 4 lines · Ray

The windows exports and the map files, feels like duplication of effort. Could we massage one into the other during the build?

That's what is done with map-to-win.py, unless we have one exception when the full library is not ready, like EAL.

Quoted 7 lines
Quoted 3 lines

https://git.dpdk.org/dpdk/tree/lib/meson.build#n152
https://git.dpdk.org/dpdk/tree/buildtools/map_to_win.py#n27

Thinking about this again - future work might be to check if a .def exists. And then to warn in checkpatch if one is modified without the other?

Possibly, but right now there is only the one .def override file, for EAL, and a better use of effort is to close the gap between windows and other versions so that it can be removed completely.

$ find lib/ drivers/ -name *.def
lib/librte_eal/rte_eal_exports.def

/Bruce

#13 lore raw
In reply to Kinsella, Ray

16/10/2020 17:48, Kinsella, Ray:

Quoted 6 lines · David Marchand
Quoted 5 lines · Ray
Quoted 3 lines

The windows exports and the map files, feels like duplication of effort. Could we massage one into the other during the build?

Quoted 8 lines
Quoted 5 lines

That's what is done with map-to-win.py, unless we have one exception when the full library is not ready, like EAL.

https://git.dpdk.org/dpdk/tree/lib/meson.build#n152
https://git.dpdk.org/dpdk/tree/buildtools/map_to_win.py#n27

Thinking about this again - future work might be to check if a .def exists. And then to warn in checkpatch if one is modified without the other?

It would not have avoided this miss,
because the symbol has been added in the .def after I've sent my patch removing the function. What missed was a check to run before pushing, and this is what David did in the patch 2 of this series.