[v2,2/2] build: hide local symbols in shared libraries

Message ID 20220308142412.2069408-3-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series add missing local symbols catch-all |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing fail Testing issues
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing fail Testing issues
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing warning Testing issues

Commit Message

Thomas Monjalon March 8, 2022, 2:24 p.m. UTC
  The symbols which are not listed in the version script
are exported by default.
Adding a local section with a wildcard make non-listed functions
and variables as hidden, as it should be in all version.map files.

These are the changes done in the shared libraries:
- DF .text  Base          auxiliary_add_device
- DF .text  Base          auxiliary_dev_exists
- DF .text  Base          auxiliary_dev_iterate
- DF .text  Base          auxiliary_insert_device
- DF .text  Base          auxiliary_is_ignored_device
- DF .text  Base          auxiliary_match
- DF .text  Base          auxiliary_on_scan
- DF .text  Base          auxiliary_scan
- DO .bss   Base          auxiliary_bus_logtype
- DO .data  Base          auxiliary_bus
- DO .bss   Base          gpu_logtype

There is no impact on regexdev library.

Because these local symbols were exported as non-internal
in DPDK 21.11, any change in these functions would break the ABI.
Exception rules are added for these experimental libraries,
so the ABI check will skip them until the next ABI version.

A check is added to avoid such miss in future.

Fixes: 1afce3086cf4 ("bus/auxiliary: introduce auxiliary bus")
Fixes: 8b8036a66e3d ("gpudev: introduce GPU device class library")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/check-symbol-maps.sh     | 7 +++++++
 devtools/libabigail.abignore      | 8 ++++++++
 drivers/bus/auxiliary/version.map | 2 ++
 lib/gpudev/version.map            | 2 ++
 lib/regexdev/version.map          | 2 ++
 5 files changed, 21 insertions(+)
  

Comments

Kevin Traynor March 9, 2022, 10:58 a.m. UTC | #1
Hi Thomas,

On 08/03/2022 14:24, Thomas Monjalon wrote:
> The symbols which are not listed in the version script
> are exported by default.
> Adding a local section with a wildcard make non-listed functions
> and variables as hidden, as it should be in all version.map files.
> 
> These are the changes done in the shared libraries:
> - DF .text  Base          auxiliary_add_device
> - DF .text  Base          auxiliary_dev_exists
> - DF .text  Base          auxiliary_dev_iterate
> - DF .text  Base          auxiliary_insert_device
> - DF .text  Base          auxiliary_is_ignored_device
> - DF .text  Base          auxiliary_match
> - DF .text  Base          auxiliary_on_scan
> - DF .text  Base          auxiliary_scan
> - DO .bss   Base          auxiliary_bus_logtype
> - DO .data  Base          auxiliary_bus
> - DO .bss   Base          gpu_logtype
> 
> There is no impact on regexdev library.
> 
> Because these local symbols were exported as non-internal
> in DPDK 21.11, any change in these functions would break the ABI.
> Exception rules are added for these experimental libraries,
> so the ABI check will skip them until the next ABI version.
> 
> A check is added to avoid such miss in future.
> 
> Fixes: 1afce3086cf4 ("bus/auxiliary: introduce auxiliary bus")
> Fixes: 8b8036a66e3d ("gpudev: introduce GPU device class library")
> Cc: stable@dpdk.org
> 

If I take this 2/2 for 21.11.1, then I also need to backport [0] so I 
won't have errors for common_mlx5.

Any problem with taking both?

[0]
commit c2e3059a10f2389b791d5d485fe71e666984c193
Author: Michael Baum <michaelba@nvidia.com>
Date:   Fri Feb 25 01:25:06 2022 +0200

     common/mlx5: consider local functions as internal


> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>   devtools/check-symbol-maps.sh     | 7 +++++++
>   devtools/libabigail.abignore      | 8 ++++++++
>   drivers/bus/auxiliary/version.map | 2 ++
>   lib/gpudev/version.map            | 2 ++
>   lib/regexdev/version.map          | 2 ++
>   5 files changed, 21 insertions(+)
> 
> diff --git a/devtools/check-symbol-maps.sh b/devtools/check-symbol-maps.sh
> index 5bd290ac97..8266fdf9ea 100755
> --- a/devtools/check-symbol-maps.sh
> +++ b/devtools/check-symbol-maps.sh
> @@ -53,4 +53,11 @@ if [ -n "$duplicate_symbols" ] ; then
>       ret=1
>   fi
>   
> +local_miss_maps=$(grep -L 'local: \*;' $@)
> +if [ -n "$local_miss_maps" ] ; then
> +    echo "Found maps without local catch-all:"
> +    echo "$local_miss_maps"
> +    ret=1
> +fi
> +
>   exit $ret
> diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
> index 18c11c80c6..c618f20032 100644
> --- a/devtools/libabigail.abignore
> +++ b/devtools/libabigail.abignore
> @@ -32,3 +32,11 @@
>   ; Ignore changes in common mlx5 driver, should be all internal
>   [suppress_file]
>           soname_regexp = ^librte_common_mlx5\.
> +
> +; Ignore visibility fix of local functions in experimental auxiliary driver
> +[suppress_file]
> +        soname_regexp = ^librte_bus_auxiliary\.
> +
> +; Ignore visibility fix of local functions in experimental gpudev library
> +[suppress_file]
> +        soname_regexp = ^librte_gpudev\.
> diff --git a/drivers/bus/auxiliary/version.map b/drivers/bus/auxiliary/version.map
> index a52260657c..dc993e84ff 100644
> --- a/drivers/bus/auxiliary/version.map
> +++ b/drivers/bus/auxiliary/version.map
> @@ -4,4 +4,6 @@ EXPERIMENTAL {
>   	# added in 21.08
>   	rte_auxiliary_register;
>   	rte_auxiliary_unregister;
> +
> +	local: *;
>   };
> diff --git a/lib/gpudev/version.map b/lib/gpudev/version.map
> index b23e3fd6eb..a2c8ce5759 100644
> --- a/lib/gpudev/version.map
> +++ b/lib/gpudev/version.map
> @@ -39,4 +39,6 @@ INTERNAL {
>   	rte_gpu_get_by_name;
>   	rte_gpu_notify;
>   	rte_gpu_release;
> +
> +	local: *;
>   };
> diff --git a/lib/regexdev/version.map b/lib/regexdev/version.map
> index 988b909638..3c6e9fffa1 100644
> --- a/lib/regexdev/version.map
> +++ b/lib/regexdev/version.map
> @@ -26,6 +26,8 @@ EXPERIMENTAL {
>   	rte_regexdev_xstats_get;
>   	rte_regexdev_xstats_names_get;
>   	rte_regexdev_xstats_reset;
> +
> +	local: *;
>   };
>   
>   INTERNAL {
  
Thomas Monjalon March 9, 2022, 6:54 p.m. UTC | #2
09/03/2022 11:58, Kevin Traynor:
> Hi Thomas,
> 
> On 08/03/2022 14:24, Thomas Monjalon wrote:
> > The symbols which are not listed in the version script
> > are exported by default.
> > Adding a local section with a wildcard make non-listed functions
> > and variables as hidden, as it should be in all version.map files.
> > 
> > These are the changes done in the shared libraries:
> > - DF .text  Base          auxiliary_add_device
> > - DF .text  Base          auxiliary_dev_exists
> > - DF .text  Base          auxiliary_dev_iterate
> > - DF .text  Base          auxiliary_insert_device
> > - DF .text  Base          auxiliary_is_ignored_device
> > - DF .text  Base          auxiliary_match
> > - DF .text  Base          auxiliary_on_scan
> > - DF .text  Base          auxiliary_scan
> > - DO .bss   Base          auxiliary_bus_logtype
> > - DO .data  Base          auxiliary_bus
> > - DO .bss   Base          gpu_logtype
> > 
> > There is no impact on regexdev library.
> > 
> > Because these local symbols were exported as non-internal
> > in DPDK 21.11, any change in these functions would break the ABI.
> > Exception rules are added for these experimental libraries,
> > so the ABI check will skip them until the next ABI version.
> > 
> > A check is added to avoid such miss in future.
> > 
> > Fixes: 1afce3086cf4 ("bus/auxiliary: introduce auxiliary bus")
> > Fixes: 8b8036a66e3d ("gpudev: introduce GPU device class library")
> > Cc: stable@dpdk.org
> > 
> 
> If I take this 2/2 for 21.11.1, then I also need to backport [0] so I 
> won't have errors for common_mlx5.
> 
> Any problem with taking both?
> 
> [0]
> commit c2e3059a10f2389b791d5d485fe71e666984c193
> Author: Michael Baum <michaelba@nvidia.com>
> Date:   Fri Feb 25 01:25:06 2022 +0200
> 
>      common/mlx5: consider local functions as internal

I think that's fine to backport this as well.
  
Ray Kinsella April 15, 2022, 2:56 p.m. UTC | #3
Thomas Monjalon <thomas@monjalon.net> writes:

> The symbols which are not listed in the version script
> are exported by default.
> Adding a local section with a wildcard make non-listed functions
> and variables as hidden, as it should be in all version.map files.
>
> These are the changes done in the shared libraries:
> - DF .text  Base          auxiliary_add_device
> - DF .text  Base          auxiliary_dev_exists
> - DF .text  Base          auxiliary_dev_iterate
> - DF .text  Base          auxiliary_insert_device
> - DF .text  Base          auxiliary_is_ignored_device
> - DF .text  Base          auxiliary_match
> - DF .text  Base          auxiliary_on_scan
> - DF .text  Base          auxiliary_scan
> - DO .bss   Base          auxiliary_bus_logtype
> - DO .data  Base          auxiliary_bus
> - DO .bss   Base          gpu_logtype
>
> There is no impact on regexdev library.
>
> Because these local symbols were exported as non-internal
> in DPDK 21.11, any change in these functions would break the ABI.
> Exception rules are added for these experimental libraries,
> so the ABI check will skip them until the next ABI version.
>
> A check is added to avoid such miss in future.
>
> Fixes: 1afce3086cf4 ("bus/auxiliary: introduce auxiliary bus")
> Fixes: 8b8036a66e3d ("gpudev: introduce GPU device class library")
> Cc: stable@dpdk.org

Good catch, I see you fixed a few of these recently.

>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  devtools/check-symbol-maps.sh     | 7 +++++++
>  devtools/libabigail.abignore      | 8 ++++++++
>  drivers/bus/auxiliary/version.map | 2 ++
>  lib/gpudev/version.map            | 2 ++
>  lib/regexdev/version.map          | 2 ++
>  5 files changed, 21 insertions(+)
>
> diff --git a/devtools/check-symbol-maps.sh b/devtools/check-symbol-maps.sh
> index 5bd290ac97..8266fdf9ea 100755
> --- a/devtools/check-symbol-maps.sh
> +++ b/devtools/check-symbol-maps.sh
> @@ -53,4 +53,11 @@ if [ -n "$duplicate_symbols" ] ; then
>      ret=1
>  fi
>  
> +local_miss_maps=$(grep -L 'local: \*;' $@)
> +if [ -n "$local_miss_maps" ] ; then
> +    echo "Found maps without local catch-all:"
> +    echo "$local_miss_maps"
> +    ret=1
> +fi
> +
>  exit $ret
> diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
> index 18c11c80c6..c618f20032 100644
> --- a/devtools/libabigail.abignore
> +++ b/devtools/libabigail.abignore
> @@ -32,3 +32,11 @@
>  ; Ignore changes in common mlx5 driver, should be all internal
>  [suppress_file]
>          soname_regexp = ^librte_common_mlx5\.
> +
> +; Ignore visibility fix of local functions in experimental auxiliary driver
> +[suppress_file]
> +        soname_regexp = ^librte_bus_auxiliary\.
> +
> +; Ignore visibility fix of local functions in experimental gpudev library
> +[suppress_file]
> +        soname_regexp = ^librte_gpudev\.
> diff --git a/drivers/bus/auxiliary/version.map b/drivers/bus/auxiliary/version.map
> index a52260657c..dc993e84ff 100644
> --- a/drivers/bus/auxiliary/version.map
> +++ b/drivers/bus/auxiliary/version.map
> @@ -4,4 +4,6 @@ EXPERIMENTAL {
>  	# added in 21.08
>  	rte_auxiliary_register;
>  	rte_auxiliary_unregister;
> +
> +	local: *;
>  };
> diff --git a/lib/gpudev/version.map b/lib/gpudev/version.map
> index b23e3fd6eb..a2c8ce5759 100644
> --- a/lib/gpudev/version.map
> +++ b/lib/gpudev/version.map
> @@ -39,4 +39,6 @@ INTERNAL {
>  	rte_gpu_get_by_name;
>  	rte_gpu_notify;
>  	rte_gpu_release;
> +
> +	local: *;
>  };
> diff --git a/lib/regexdev/version.map b/lib/regexdev/version.map
> index 988b909638..3c6e9fffa1 100644
> --- a/lib/regexdev/version.map
> +++ b/lib/regexdev/version.map
> @@ -26,6 +26,8 @@ EXPERIMENTAL {
>  	rte_regexdev_xstats_get;
>  	rte_regexdev_xstats_names_get;
>  	rte_regexdev_xstats_reset;
> +
> +	local: *;
>  };
>  
>  INTERNAL {
  

Patch

diff --git a/devtools/check-symbol-maps.sh b/devtools/check-symbol-maps.sh
index 5bd290ac97..8266fdf9ea 100755
--- a/devtools/check-symbol-maps.sh
+++ b/devtools/check-symbol-maps.sh
@@ -53,4 +53,11 @@  if [ -n "$duplicate_symbols" ] ; then
     ret=1
 fi
 
+local_miss_maps=$(grep -L 'local: \*;' $@)
+if [ -n "$local_miss_maps" ] ; then
+    echo "Found maps without local catch-all:"
+    echo "$local_miss_maps"
+    ret=1
+fi
+
 exit $ret
diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
index 18c11c80c6..c618f20032 100644
--- a/devtools/libabigail.abignore
+++ b/devtools/libabigail.abignore
@@ -32,3 +32,11 @@ 
 ; Ignore changes in common mlx5 driver, should be all internal
 [suppress_file]
         soname_regexp = ^librte_common_mlx5\.
+
+; Ignore visibility fix of local functions in experimental auxiliary driver
+[suppress_file]
+        soname_regexp = ^librte_bus_auxiliary\.
+
+; Ignore visibility fix of local functions in experimental gpudev library
+[suppress_file]
+        soname_regexp = ^librte_gpudev\.
diff --git a/drivers/bus/auxiliary/version.map b/drivers/bus/auxiliary/version.map
index a52260657c..dc993e84ff 100644
--- a/drivers/bus/auxiliary/version.map
+++ b/drivers/bus/auxiliary/version.map
@@ -4,4 +4,6 @@  EXPERIMENTAL {
 	# added in 21.08
 	rte_auxiliary_register;
 	rte_auxiliary_unregister;
+
+	local: *;
 };
diff --git a/lib/gpudev/version.map b/lib/gpudev/version.map
index b23e3fd6eb..a2c8ce5759 100644
--- a/lib/gpudev/version.map
+++ b/lib/gpudev/version.map
@@ -39,4 +39,6 @@  INTERNAL {
 	rte_gpu_get_by_name;
 	rte_gpu_notify;
 	rte_gpu_release;
+
+	local: *;
 };
diff --git a/lib/regexdev/version.map b/lib/regexdev/version.map
index 988b909638..3c6e9fffa1 100644
--- a/lib/regexdev/version.map
+++ b/lib/regexdev/version.map
@@ -26,6 +26,8 @@  EXPERIMENTAL {
 	rte_regexdev_xstats_get;
 	rte_regexdev_xstats_names_get;
 	rte_regexdev_xstats_reset;
+
+	local: *;
 };
 
 INTERNAL {