Note: copied from Mesa
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- meson.build | 1 + symbols-check | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 symbols-check
diff --git a/meson.build b/meson.build index a725f05d342bbec4df18..c035a00c6747b8d46a9b 100644 --- a/meson.build +++ b/meson.build @@ -272,6 +272,7 @@ pkg.generate(
env_test = environment() env_test.set('NM', find_program('nm').path()) +env_test.set('top_srcdir', meson.source_root())
if with_libkms subdir('libkms') diff --git a/symbols-check b/symbols-check new file mode 100755 index 00000000000000000000..bac466d93dcb45cee0bb --- /dev/null +++ b/symbols-check @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +set -o pipefail + +# Platform specific symbols +# These will simply be ignored +PLAT_FUNCS=" +__bss_start +_init +_fini +_end +_edata + +# From tegra-symbol-check +__bss_end__ +__bss_start__ +__bss_start +__end__ +_bss_end__ +_edata +_end +_fini +_init +" + +if [ -z "$LIB" ]; then + echo "$LIB needs to be defined for autotools to be able to run this test" + exit 1 +fi + +# The lib name is passed in with Meson but autotools doesn't support that +# so it needs to be hardcoded and overwritten here +if [ $# -ge 1 ]; then + LIB=$1 +fi + +if ! [ -f "$LIB" ]; then + echo "lib $LIB doesn't exist" + exit 1 +fi + +if [ -z "$NM" ]; then + echo "$NM is undefined or empty" + exit 1 +elif ! command -v $NM >/dev/null; then + echo "$NM is not a valid command" + exit 1 +fi + +AVAIL_FUNCS="$($NM -D --format=bsd --defined-only $LIB | awk '{print $3}')" + +NEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do + echo "$REQ_FUNCS" | grep -q "^$func$" && continue + echo "$PLAT_FUNCS" | grep -q "^$func$" && continue + + echo $func +done) + +REMOVED_ABI=$(echo "$REQ_FUNCS" | while read func; do + echo "$AVAIL_FUNCS" | grep -q "^$func$" && continue + + echo $func +done) + +if [ -n "$NEW_ABI" ]; then + echo "New ABI detected - If intentional, update the test." + echo "$NEW_ABI" +fi + +if [ -n "$REMOVED_ABI" ]; then + echo "ABI break detected - Required symbol(s) no longer exported!" + echo "$REMOVED_ABI" +fi + +if [ -z "$NEW_ABI" ] && [ -z "$REMOVED_ABI" ]; then + exit 0 +else + exit 1 +fi
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- amdgpu/Makefile.am | 1 + amdgpu/amdgpu-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am index a1b0d05c1457ae681ac8..4ad6949e81ddbd11078e 100644 --- a/amdgpu/Makefile.am +++ b/amdgpu/Makefile.am @@ -47,5 +47,6 @@ libdrm_amdgpuinclude_HEADERS = $(LIBDRM_AMDGPU_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_amdgpu.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = amdgpu-symbol-check EXTRA_DIST = $(TESTS) diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 90b7a1d633c0b2143f29..5ed24b906c0228233f71 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.am/libdrm_amdgpuinclude_HEADERS +LIB=.libs/libdrm_amdgpu.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_amdgpu.so} | awk '{print $3}' | while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" amdgpu_bo_alloc amdgpu_bo_cpu_map amdgpu_bo_cpu_unmap @@ -70,8 +65,6 @@ amdgpu_va_range_free amdgpu_va_range_query amdgpu_vm_reserve_vmid amdgpu_vm_unreserve_vmid -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
On 4 April 2018 at 16:41, Eric Engestrom eric.engestrom@imgtec.com wrote:
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com
amdgpu/Makefile.am | 1 + amdgpu/amdgpu-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am index a1b0d05c1457ae681ac8..4ad6949e81ddbd11078e 100644 --- a/amdgpu/Makefile.am +++ b/amdgpu/Makefile.am @@ -47,5 +47,6 @@ libdrm_amdgpuinclude_HEADERS = $(LIBDRM_AMDGPU_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_amdgpu.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)'
Gut suggests that the absolute abs_foo path will be needed here - not too sure though.
diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 90b7a1d633c0b2143f29..5ed24b906c0228233f71 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.am/libdrm_amdgpuinclude_HEADERS +LIB=.libs/libdrm_amdgpu.so
I think this will break meson - it passes the library name as an arg. One solution is to set LIB (feel free to pick better name), just like NM.
-Emil
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- etnaviv/Makefile.am | 1 + etnaviv/etnaviv-symbol-check | 19 ++++++------------- etnaviv/meson.build | 1 + 3 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/etnaviv/Makefile.am b/etnaviv/Makefile.am index be96ba868f0d3949c9fa..0ceda75049dc400e07c7 100644 --- a/etnaviv/Makefile.am +++ b/etnaviv/Makefile.am @@ -22,5 +22,6 @@ libdrm_etnavivinclude_HEADERS = $(LIBDRM_ETNAVIV_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_etnaviv.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = etnaviv-symbol-check EXTRA_DIST = $(TESTS) diff --git a/etnaviv/etnaviv-symbol-check b/etnaviv/etnaviv-symbol-check index b1598ce52838c847096a..14eb56ce4c5ee00753d0 100755 --- a/etnaviv/etnaviv-symbol-check +++ b/etnaviv/etnaviv-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBDRM_ETNAVIV_H_FILES +LIB=.libs/libdrm_etnaviv.so
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_etnaviv.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" etna_device_new etna_device_new_dup etna_device_ref @@ -46,8 +41,6 @@ etna_perfmon_create etna_perfmon_del etna_perfmon_get_dom_by_name etna_perfmon_get_sig_by_name -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check diff --git a/etnaviv/meson.build b/etnaviv/meson.build index ca2aa544c58924a15d8b..74e3679eaad83db09636 100644 --- a/etnaviv/meson.build +++ b/etnaviv/meson.build @@ -55,5 +55,6 @@ ext_libdrm_etnaviv = declare_dependency( test( 'etnaviv-symbol-check', prog_bash, + env : env_test, args : [files('etnaviv-symbol-check'), libdrm_etnaviv] )
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- exynos/Makefile.am | 1 + exynos/exynos-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/exynos/Makefile.am b/exynos/Makefile.am index f99f8981ff9ef0bf9d4f..9dd1161c6cc4d9f84b64 100644 --- a/exynos/Makefile.am +++ b/exynos/Makefile.am @@ -23,5 +23,6 @@ libdrm_exynosinclude_HEADERS = exynos_drmif.h pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_exynos.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = exynos-symbol-check EXTRA_DIST = $(TESTS) diff --git a/exynos/exynos-symbol-check b/exynos/exynos-symbol-check index e9f1b04d5b0a7a258cf1..f1df6645ec243eccce5b 100755 --- a/exynos/exynos-symbol-check +++ b/exynos/exynos-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.am/libdrm_exynos*_HEADERS +LIB=.libs/libdrm_exynos.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_exynos.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" exynos_bo_create exynos_bo_destroy exynos_bo_from_name @@ -33,8 +28,6 @@ g2d_init g2d_move g2d_scale_and_blend g2d_solid_fill -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- freedreno/Makefile.am | 1 + freedreno/freedreno-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am index cbb0d031816155755bda..571272cb63aee8e427f9 100644 --- a/freedreno/Makefile.am +++ b/freedreno/Makefile.am @@ -27,5 +27,6 @@ libdrm_freedrenocommoninclude_HEADERS = $(LIBDRM_FREEDRENO_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_freedreno.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = freedreno-symbol-check EXTRA_DIST = $(TESTS) diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check index 3b119528c6cfbfd9d4a0..bc03d4e7b01a0453e57d 100755 --- a/freedreno/freedreno-symbol-check +++ b/freedreno/freedreno-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBDRM_FREEDRENO_H_FILES +LIB=.libs/libdrm_freedreno.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_freedreno.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" fd_bo_cpu_fini fd_bo_cpu_prep fd_bo_del @@ -56,8 +51,6 @@ fd_ringmarker_flush fd_ringbuffer_flush2 fd_ringmarker_mark fd_ringmarker_new -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- intel/Makefile.am | 2 ++ intel/intel-symbol-check | 19 ++++++------------- 2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/intel/Makefile.am b/intel/Makefile.am index c52e8c086a86cf523da4..448a79fbc48e97e3f500 100644 --- a/intel/Makefile.am +++ b/intel/Makefile.am @@ -56,6 +56,8 @@ BATCHES = \ tests/gen7-2d-copy.batch \ tests/gen7-3d.batch
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' + TESTS = \ $(BATCHES:.batch=.batch.sh) \ intel-symbol-check diff --git a/intel/intel-symbol-check b/intel/intel-symbol-check index 4d30a4b15feb94e9523d..5962292a91fcfda3788f 100755 --- a/intel/intel-symbol-check +++ b/intel/intel-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBDRM_INTEL_H_FILES +LIB=.libs/libdrm_intel.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_intel.so} | awk '{print $3}' | while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" drm_intel_bo_alloc drm_intel_bo_alloc_for_render drm_intel_bo_alloc_tiled @@ -93,8 +88,6 @@ drm_intel_get_pooled_eu drm_intel_get_reset_stats drm_intel_get_subslice_total drm_intel_reg_read -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- libkms/Makefile.am | 1 + libkms/kms-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/libkms/Makefile.am b/libkms/Makefile.am index 461fc35b6ff08fdd1a7f..2742c9357250b70661cf 100644 --- a/libkms/Makefile.am +++ b/libkms/Makefile.am @@ -39,5 +39,6 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libkms.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = kms-symbol-check EXTRA_DIST = $(TESTS) diff --git a/libkms/kms-symbol-check b/libkms/kms-symbol-check index a5c2120d5ce75616f489..3ff2f98c83a793c53073 100755 --- a/libkms/kms-symbol-check +++ b/libkms/kms-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBKMS_H_FILES +LIB=.libs/libkms.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libkms.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" kms_bo_create kms_bo_destroy kms_bo_get_prop @@ -18,8 +13,6 @@ kms_bo_unmap kms_create kms_destroy kms_get_prop -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- nouveau/Makefile.am | 1 + nouveau/nouveau-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am index 60ebe243d4236e6aa814..5de4bd2a96a57aac74a4 100644 --- a/nouveau/Makefile.am +++ b/nouveau/Makefile.am @@ -28,5 +28,6 @@ libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \ pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_nouveau.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = nouveau-symbol-check EXTRA_DIST = $(TESTS) diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check index b3a24101e52d8aae1bba..5dab5686fe3d9d8790a6 100755 --- a/nouveau/nouveau-symbol-check +++ b/nouveau/nouveau-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBDRM_NOUVEAU_H_FILES +LIB=.libs/libdrm_nouveau.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_nouveau.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" nouveau_bo_map nouveau_bo_name_get nouveau_bo_name_ref @@ -51,8 +46,6 @@ nouveau_pushbuf_reloc nouveau_pushbuf_space nouveau_pushbuf_validate nouveau_setparam -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- omap/Makefile.am | 1 + omap/omap-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/omap/Makefile.am b/omap/Makefile.am index 599bb9ded5003f17a2f7..bdb809907df0c12aa3ac 100644 --- a/omap/Makefile.am +++ b/omap/Makefile.am @@ -20,5 +20,6 @@ libdrm_omapinclude_HEADERS = omap_drmif.h pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_omap.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = omap-symbol-check EXTRA_DIST = $(TESTS) diff --git a/omap/omap-symbol-check b/omap/omap-symbol-check index 0fb4a0f2664cf9edbc27..843b410933e49889552d 100755 --- a/omap/omap-symbol-check +++ b/omap/omap-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.am/libdrm_omap*HEADERS +LIB=.libs/libdrm_omap.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_omap.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" omap_bo_cpu_fini omap_bo_cpu_prep omap_bo_del @@ -28,8 +23,6 @@ omap_device_new omap_device_ref omap_get_param omap_set_param -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- radeon/Makefile.am | 1 + radeon/radeon-symbol-check | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/radeon/Makefile.am b/radeon/Makefile.am index e241531488c719ae5bde..7f8198bfc7fa74590749 100644 --- a/radeon/Makefile.am +++ b/radeon/Makefile.am @@ -43,5 +43,6 @@ libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_radeon.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = radeon-symbol-check EXTRA_DIST = $(LIBDRM_RADEON_BOF_FILES) $(TESTS) diff --git a/radeon/radeon-symbol-check b/radeon/radeon-symbol-check index 7d79d90127bd6d27d050..0f01c23905cd1f7cb5aa 100755 --- a/radeon/radeon-symbol-check +++ b/radeon/radeon-symbol-check @@ -1,15 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBDRM_RADEON_H_FILES +LIB=.libs/libdrm_radeon.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_radeon.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_start -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" radeon_bo_debug radeon_bo_get_handle radeon_bo_get_src_domain @@ -54,8 +49,6 @@ radeon_surface_best radeon_surface_init radeon_surface_manager_free radeon_surface_manager_new -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com --- tegra/Makefile.am | 1 + tegra/tegra-symbol-check | 22 ++++++---------------- 2 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/tegra/Makefile.am b/tegra/Makefile.am index fb40be55a3b807fcfb6d..a88bea5225efcc942d12 100644 --- a/tegra/Makefile.am +++ b/tegra/Makefile.am @@ -21,5 +21,6 @@ libdrm_tegrainclude_HEADERS = tegra.h pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_tegra.pc
+AM_TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' TESTS = tegra-symbol-check EXTRA_DIST = $(TESTS) diff --git a/tegra/tegra-symbol-check b/tegra/tegra-symbol-check index 509b678c37b899a25f0a..4a340df2567e45792f98 100755 --- a/tegra/tegra-symbol-check +++ b/tegra/tegra-symbol-check @@ -1,18 +1,10 @@ #!/bin/bash +set -eu
-# The following symbols (past the first nine) are taken from tegra.h. +LIB=.libs/libdrm_tegra.so
-FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_tegra.so} | awk '{print $3}'| while read func; do -( grep -q "^$func$" || echo $func ) <<EOF -__bss_end__ -__bss_start__ -__bss_start -__end__ -_bss_end__ -_edata -_end -_fini -_init +# Official ABI, taken from the header. +REQ_FUNCS=" drm_tegra_bo_get_flags drm_tegra_bo_get_handle drm_tegra_bo_get_tiling @@ -26,8 +18,6 @@ drm_tegra_bo_unref drm_tegra_bo_wrap drm_tegra_close drm_tegra_new -EOF -done) +"
-test ! -n "$FUNCS" || echo $FUNCS -test ! -n "$FUNCS" +source "$top_srcdir"/symbols-check
On Wednesday, 2018-04-04 16:41:35 +0100, Eric Engestrom wrote:
Note: copied from Mesa
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com
meson.build | 1 + symbols-check | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 symbols-check
diff --git a/meson.build b/meson.build index a725f05d342bbec4df18..c035a00c6747b8d46a9b 100644 --- a/meson.build +++ b/meson.build @@ -272,6 +272,7 @@ pkg.generate(
env_test = environment() env_test.set('NM', find_program('nm').path()) +env_test.set('top_srcdir', meson.source_root())
if with_libkms subdir('libkms') diff --git a/symbols-check b/symbols-check new file mode 100755 index 00000000000000000000..bac466d93dcb45cee0bb --- /dev/null +++ b/symbols-check @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +set -o pipefail
+# Platform specific symbols +# These will simply be ignored +PLAT_FUNCS=" +__bss_start +_init +_fini +_end +_edata
+# From tegra-symbol-check +__bss_end__ +__bss_start__ +__bss_start +__end__ +_bss_end__ +_edata +_end +_fini +_init
Haha, oops... I had noticed that one of the old scripts had more platform symbols than the rest, and I wanted to check if/when those were needed so I just stuffed them here in the mean time, but then I forgot :]
I'll check this when I have the time (not this week), or if anyone knows..?
In the mean time, please review the rest and ignore these 10 lines :)
+"
+if [ -z "$LIB" ]; then
- echo "$LIB needs to be defined for autotools to be able to run this test"
- exit 1
+fi
+# The lib name is passed in with Meson but autotools doesn't support that +# so it needs to be hardcoded and overwritten here +if [ $# -ge 1 ]; then
- LIB=$1
+fi
+if ! [ -f "$LIB" ]; then
- echo "lib $LIB doesn't exist"
- exit 1
+fi
+if [ -z "$NM" ]; then
- echo "$NM is undefined or empty"
- exit 1
+elif ! command -v $NM >/dev/null; then
- echo "$NM is not a valid command"
- exit 1
+fi
+AVAIL_FUNCS="$($NM -D --format=bsd --defined-only $LIB | awk '{print $3}')"
+NEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do
- echo "$REQ_FUNCS" | grep -q "^$func$" && continue
- echo "$PLAT_FUNCS" | grep -q "^$func$" && continue
- echo $func
+done)
+REMOVED_ABI=$(echo "$REQ_FUNCS" | while read func; do
- echo "$AVAIL_FUNCS" | grep -q "^$func$" && continue
- echo $func
+done)
+if [ -n "$NEW_ABI" ]; then
- echo "New ABI detected - If intentional, update the test."
- echo "$NEW_ABI"
+fi
+if [ -n "$REMOVED_ABI" ]; then
- echo "ABI break detected - Required symbol(s) no longer exported!"
- echo "$REMOVED_ABI"
+fi
+if [ -z "$NEW_ABI" ] && [ -z "$REMOVED_ABI" ]; then
- exit 0
+else
- exit 1
+fi
Cheers, Eric
On 4 April 2018 at 17:28, Eric Engestrom eric.engestrom@imgtec.com wrote:
On Wednesday, 2018-04-04 16:41:35 +0100, Eric Engestrom wrote:
Note: copied from Mesa
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com
meson.build | 1 + symbols-check | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 symbols-check
diff --git a/meson.build b/meson.build index a725f05d342bbec4df18..c035a00c6747b8d46a9b 100644 --- a/meson.build +++ b/meson.build @@ -272,6 +272,7 @@ pkg.generate(
env_test = environment() env_test.set('NM', find_program('nm').path()) +env_test.set('top_srcdir', meson.source_root())
if with_libkms subdir('libkms') diff --git a/symbols-check b/symbols-check new file mode 100755 index 00000000000000000000..bac466d93dcb45cee0bb --- /dev/null +++ b/symbols-check @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +set -o pipefail
+# Platform specific symbols +# These will simply be ignored +PLAT_FUNCS=" +__bss_start +_init +_fini +_end +_edata
+# From tegra-symbol-check +__bss_end__ +__bss_start__ +__bss_start +__end__ +_bss_end__ +_edata +_end +_fini +_init
Haha, oops... I had noticed that one of the old scripts had more platform symbols than the rest, and I wanted to check if/when those were needed so I just stuffed them here in the mean time, but then I forgot :]
I'll check this when I have the time (not this week), or if anyone knows..?
In the mean time, please review the rest and ignore these 10 lines :)
The extra __ suffix/prefixed ones are ARM specific. They seems to be introduced from day 1 in glibc, without any obvious reason. They're just aliases - __end__, _bss_end__, etc are identical to _end
If you want to cater for GNU/Hurd - the following three should be listed as well.
_fbss _fdata _ftext
I haven't had time to read through the patches, although +1 on the overall idea. Will try to get to it sometime tomorrow.
-Emil
On Wednesday, 2018-04-04 18:39:48 +0100, Emil Velikov wrote:
On 4 April 2018 at 17:28, Eric Engestrom eric.engestrom@imgtec.com wrote:
On Wednesday, 2018-04-04 16:41:35 +0100, Eric Engestrom wrote:
Note: copied from Mesa
Signed-off-by: Eric Engestrom eric.engestrom@imgtec.com
meson.build | 1 + symbols-check | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 symbols-check
diff --git a/meson.build b/meson.build index a725f05d342bbec4df18..c035a00c6747b8d46a9b 100644 --- a/meson.build +++ b/meson.build @@ -272,6 +272,7 @@ pkg.generate(
env_test = environment() env_test.set('NM', find_program('nm').path()) +env_test.set('top_srcdir', meson.source_root())
if with_libkms subdir('libkms') diff --git a/symbols-check b/symbols-check new file mode 100755 index 00000000000000000000..bac466d93dcb45cee0bb --- /dev/null +++ b/symbols-check @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +set -o pipefail
+# Platform specific symbols +# These will simply be ignored +PLAT_FUNCS=" +__bss_start +_init +_fini +_end +_edata
+# From tegra-symbol-check +__bss_end__ +__bss_start__ +__bss_start +__end__ +_bss_end__ +_edata +_end +_fini +_init
Haha, oops... I had noticed that one of the old scripts had more platform symbols than the rest, and I wanted to check if/when those were needed so I just stuffed them here in the mean time, but then I forgot :]
I'll check this when I have the time (not this week), or if anyone knows..?
In the mean time, please review the rest and ignore these 10 lines :)
The extra __ suffix/prefixed ones are ARM specific. They seems to be introduced from day 1 in glibc, without any obvious reason. They're just aliases - __end__, _bss_end__, etc are identical to _end
If you want to cater for GNU/Hurd - the following three should be listed as well.
_fbss _fdata _ftext
Thanks for the explanation! I think I'll just add all these to the platform-specific list on both mesa and libdrm, they have specific enough names (beginning with underscore, for starters) that no entrypoint of ours should ever match.
I haven't had time to read through the patches, although +1 on the overall idea. Will try to get to it sometime tomorrow.
Thanks, but I won't have time to push anything until next week anyway, so there's no rush ^^
-Emil
On 4 April 2018 at 16:41, Eric Engestrom eric.engestrom@imgtec.com wrote:
--- /dev/null +++ b/symbols-check @@ -0,0 +1,79 @@ +#!/bin/sh +set -eu +set -o pipefail
We could drop the execute bit, shebang and set. Pretty much all of it is handled by the callers (modulo pipefail)
+if [ -z "$LIB" ]; then
- echo "$LIB needs to be defined for autotools to be able to run this test"
- exit 1
+fi
+# The lib name is passed in with Meson but autotools doesn't support that +# so it needs to be hardcoded and overwritten here +if [ $# -ge 1 ]; then
- LIB=$1
+fi
+if ! [ -f "$LIB" ]; then
- echo "lib $LIB doesn't exist"
- exit 1
+fi
+if [ -z "$NM" ]; then
- echo "$NM is undefined or empty"
- exit 1
I would drop all these - set -u will provide reasonable error handling
HTH Emil
dri-devel@lists.freedesktop.org