Skip to contentSkip to conversation

*-symbol-checks hard-code the nm executable

Bug 105163 In review [email protected] 4 participants 8 messages Feb 19, 2018 – Feb 26, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=105163

Bug ID: 105163
Summary: *-symbol-checks hard-code the nm executable
Product: DRI
Version: XOrg git
Hardware: All
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: libdrm
Assignee: [email protected]
Reporter: [email protected]

Created attachment 137439
--> https://bugs.freedesktop.org/attachment.cgi?id=137439&action=edit
libdrm-symbol-check-Don-t-hard-code-nm-executable.patch

Currently the *-symbol-checks hard-code the nm executable which may result in build failures when using a prefixed toolchain, e.g. /usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-nm.

There was a patch suggested in 2016 and sent to the mailing list but it hasn't been fixed yet:

https://lists.freedesktop.org/archives/dri-devel/2016-October/119999.html

Attached is the patch in question for the sake of completeness.

It would be nice to get this fixed upstream.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

PATCH v2 1/1 *-symbol-check: Don't hard-code nm executable

From: Heiko Becker <[email protected]>

Helpful if your nm executable has a prefix based on the architecture, for example.

Cc Timo Gurr <[email protected]>
[Eric: v2: rebase and add Meson support]
---
 amdgpu/amdgpu-symbol-check       | 2 +-
 amdgpu/meson.build               | 1 +
 configure.ac                     | 1 +
 exynos/exynos-symbol-check       | 2 +-
 exynos/meson.build               | 1 +
 freedreno/freedreno-symbol-check | 2 +-
 freedreno/meson.build            | 1 +
 intel/intel-symbol-check         | 2 +-
 intel/meson.build                | 1 +
 libkms/kms-symbol-check          | 2 +-
 libkms/meson.build               | 1 +
 meson.build                      | 3 +++
 nouveau/meson.build              | 1 +
 nouveau/nouveau-symbol-check     | 2 +-
 omap/meson.build                 | 1 +
 omap/omap-symbol-check           | 2 +-
 radeon/meson.build               | 1 +
 radeon/radeon-symbol-check       | 2 +-
 tegra/meson.build                | 1 +
 tegra/tegra-symbol-check         | 2 +-
 20 files changed, 22 insertions(+), 9 deletions(-)
amdgpu/amdgpu-symbol-check +1 -1
index 17de0c3b48f48710cde2..90b7a1d633c0b2143f29 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_amdgpu.so} | awk '{print $3}' | while read func; do
+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
amdgpu/meson.build +1 -0
index 7040ebab86e271022323..f39d7bf6d284534dc660 100644
@@ -61,5 +61,6 @@ ext_libdrm_amdgpu = declare_dependency(
 test(
   'amdgpu-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('amdgpu-symbol-check'), libdrm_amdgpu]
 )
configure.ac +1 -0
index cea0b9dda3ccc1b86061..a695cce9d48c16fbcc8e 100644
@@ -45,6 +45,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 # Check for programs
 AC_PROG_CC
 AC_PROG_CC_C99
+AC_PROG_NM
 
 if test "x$ac_cv_prog_cc_c99" = xno; then
 	AC_MSG_ERROR([Building libdrm requires C99 enabled compiler])
exynos/exynos-symbol-check +1 -1
index 9692caa685b4cd93ec4a..e9f1b04d5b0a7a258cf1 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_exynos.so} | awk '{print $3}'| while read func; do
+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
exynos/meson.build +1 -0
index c96ad4e0cd7194a9c902..30d36405d6ef725b7e10 100644
@@ -49,5 +49,6 @@ pkg.generate(
 test(
   'exynos-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('exynos-symbol-check'), libdrm_exynos]
 )
freedreno/freedreno-symbol-check +1 -1
index 6b81040c797aeed11dca..56e3d3eeace6f9deb280 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_freedreno.so} | awk '{print $3}'| while read func; do
+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
freedreno/meson.build +1 -0
index da993c10355578838f29..015b7fb1c02706916e9d 100644
@@ -72,5 +72,6 @@ pkg.generate(
 test(
   'freedreno-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('freedreno-symbol-check'), libdrm_freedreno]
 )
intel/intel-symbol-check +1 -1
index 2aa2d8192cea761a7cda..4d30a4b15feb94e9523d 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_intel.so} | awk '{print $3}' | while read func; do
+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
intel/meson.build +1 -0
index 42402f60e38cd5e7359f..53c7fce4ef97828bd63c 100644
@@ -101,5 +101,6 @@ test(
 test(
   'intel-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('intel-symbol-check'), libdrm_intel]
 )
libkms/kms-symbol-check +1 -1
index 658b269265676de25270..a5c2120d5ce75616f489 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libkms.so} | awk '{print $3}'| while read func; do
+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
libkms/meson.build +1 -0
index 9eff43136397b101fa1b..86d1a4ee6c795a186d66 100644
@@ -70,5 +70,6 @@ pkg.generate(
 test(
   'kms-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('kms-symbol-check'), libkms]
 )
meson.build +3 -0
index 23a892a318c5628eb36e..baf43701e3ab77b08ac1 100644
@@ -321,6 +321,9 @@ pkg.generate(
   description : 'Userspace interface to kernel DRM services',
 )
 
+env_test = environment()
+env_test.set('NM', find_program('nm').path())
+
 if with_libkms
   subdir('libkms')
 endif
nouveau/meson.build +1 -0
index b8affd9ef776c99ba896..51c9a7123d3b34a250ea 100644
@@ -54,5 +54,6 @@ pkg.generate(
 test(
   'nouveau-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('nouveau-symbol-check'), libdrm_nouveau]
 )
nouveau/nouveau-symbol-check +1 -1
index b265cea466af600a7751..b3a24101e52d8aae1bba 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_nouveau.so} | awk '{print $3}'| while read func; do
+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
omap/meson.build +1 -0
index f89436f0e99970b381aa..e57b8f5da03618d94720 100644
@@ -49,5 +49,6 @@ pkg.generate(
 test(
   'omap-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('omap-symbol-check'), libdrm_omap]
 )
omap/omap-symbol-check +1 -1
index 759c84bd3d98d19c2d33..0fb4a0f2664cf9edbc27 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_omap.so} | awk '{print $3}'| while read func; do
+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
radeon/meson.build +1 -0
index 557a878042bb78df4096..b08c744219c0c36c5d93 100644
@@ -59,5 +59,6 @@ pkg.generate(
 test(
   'radeon-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('radeon-symbol-check'), libdrm_radeon]
 )
radeon/radeon-symbol-check +1 -1
index 0bf2ffcbeebce4f0c230..7d79d90127bd6d27d050 100755
@@ -3,7 +3,7 @@
 # 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
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_radeon.so} | awk '{print $3}'| while read func; do
+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
tegra/meson.build +1 -0
index 7ac815177718d301b76c..1f5c74b38d0506d1816d 100644
@@ -48,5 +48,6 @@ pkg.generate(
 test(
   'tegra-symbol-check',
   prog_bash,
+  env : env_test,
   args : [files('tegra-symbol-check'), libdrm_tegra]
 )
tegra/tegra-symbol-check +1 -1
index 420469f4130119188161..509b678c37b899a25f0a 100755
@@ -2,7 +2,7 @@
 
 # The following symbols (past the first nine) are taken from tegra.h.
 
-FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_tegra.so} | awk '{print $3}'| while read func; do
+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__
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 1/1
#2 lore raw

Re: [PATCH libdrm v2] *-symbol-check: Don't hard-code nm executable

Quoted 9 lines · Eric Engestrom

From: Heiko Becker <[email protected]>

Helpful if your nm executable has a prefix based on the architecture, for example.

Cc Timo Gurr <[email protected]>
[Eric: v2: rebase and add Meson support]

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH libdrm v2] *-symbol-check: Don't hard-code nm executable

In reply to Eric Engestrom

meson.build pkg.generate( · line 326

Quoted 9 lines · Eric Engestrom

From: Heiko Becker <[email protected]>

Helpful if your nm executable has a prefix based on the architecture, for example.

meson.build +3 -0
+env_test = environment()
+env_test.set('NM', find_program('nm').path())
+

Everything else is great, just not too sure about this hunk. Are you sure it does what the commit message says?

I know meson needs special configuration file for cross compilation - one example where nm has prefix.
Yet the manual [1] does not say anything about nm. I cannot find any instances of nm in the docs all together :-\

If Meson does not handle it currently, please open a bug and add a comment with the bug number/link.

Thanks
Emil
[1] http://mesonbuild.com/Cross-compilation.html
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH libdrm v2] *-symbol-check: Don't hard-code nm executable

Quoted 7 lines · Emil Velikov
Quoted 5 lines · Eric Engestrom

From: Heiko Becker <[email protected]>

Helpful if your nm executable has a prefix based on the architecture, for example.

Quoted 5 lines

meson.build pkg.generate( · line 326

Quoted 3 lines
meson.build +3 -0
+env_test = environment()
+env_test.set('NM', find_program('nm').path())
+

Everything else is great, just not too sure about this hunk. Are you sure it does what the commit message says?

It does, I even asked the meson devs to be sure. find_program() respects the crossfile, unless native: true is added [2].

Quoted 5 lines

I know meson needs special configuration file for cross compilation - one example where nm has prefix.
Yet the manual [1] does not say anything about nm. I cannot find any instances of nm in the docs all together :-\

There's nothing special about nm here, it's just a program that can be set via the crossfile, like cc or ar.
I guess the documentation on the cross-compilation page [1] could be improved to make the behaviour of find_program() more explicit; care to send a patch? :)

Quoted 7 lines

If Meson does not handle it currently, please open a bug and add a comment with the bug number/link.

Thanks
Emil
[1] http://mesonbuild.com/Cross-compilation.html

[2] http://mesonbuild.com/Reference-manual.html#find_program
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH libdrm v2] *-symbol-check: Don't hard-code nm executable

Quoted 30 lines · Eric Engestrom
Quoted 7 lines · Emil Velikov
Quoted 5 lines · Eric Engestrom

From: Heiko Becker <[email protected]>

Helpful if your nm executable has a prefix based on the architecture, for example.

Quoted 5 lines

meson.build pkg.generate( · line 326

Quoted 3 lines
meson.build +3 -0
+env_test = environment()
+env_test.set('NM', find_program('nm').path())
+

Everything else is great, just not too sure about this hunk. Are you sure it does what the commit message says?

It does, I even asked the meson devs to be sure. find_program() respects the crossfile, unless native: true is added [2].

Quoted 5 lines

I know meson needs special configuration file for cross compilation - one example where nm has prefix.
Yet the manual [1] does not say anything about nm. I cannot find any instances of nm in the docs all together :-\

There's nothing special about nm here, it's just a program that can be set via the crossfile, like cc or ar.
I guess the documentation on the cross-compilation page [1] could be improved to make the behaviour of find_program() more explicit; care to send a patch? :)

Quoted 1 line
Quoted 8 lines
Quoted 6 lines

If Meson does not handle it currently, please open a bug and add a comment with the bug number/link.

Thanks
Emil
[1] http://mesonbuild.com/Cross-compilation.html

[2] http://mesonbuild.com/Reference-manual.html#find_program

Oh btw, I'm making the same change on Mesa right now, I'll send it out in a bit, or next week if I don't have enough spare time today.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#6 lore raw

Re: [PATCH libdrm v2] *-symbol-check: Don't hard-code nm executable

In reply to Eric Engestrom
Quoted 8 lines · Eric Engestrom
Quoted 7 lines · Emil Velikov
Quoted 5 lines · Eric Engestrom

From: Heiko Becker <[email protected]>

Helpful if your nm executable has a prefix based on the architecture, for example.

Quoted 9 lines
Quoted 5 lines

meson.build pkg.generate( · line 326

Quoted 3 lines
meson.build +3 -0
+env_test = environment()
+env_test.set('NM', find_program('nm').path())
+

Everything else is great, just not too sure about this hunk. Are you sure it does what the commit message says?

It does, I even asked the meson devs to be sure. find_program() respects the crossfile, unless native: true is added [2].

I was thinking of cases where a) you're doing a native build and b) the program name has a prefix.
In reality that shouldn't happen, often, so let's worry if we get multiple bug reports.

Quoted 6 lines
Quoted 5 lines

I know meson needs special configuration file for cross compilation - one example where nm has prefix.
Yet the manual [1] does not say anything about nm. I cannot find any instances of nm in the docs all together :-\

Quoted 6 lines

There's nothing special about nm here, it's just a program that can be set via the crossfile, like cc or ar.
I guess the documentation on the cross-compilation page [1] could be improved to make the behaviour of find_program() more explicit; care to send a patch? :)

Great, I'll let you do the honours of tweaking Meson/its documentation.

Thank you very much for the clarification.

The patch is

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author Reviewed-by Eric Anholt Reviewed-by Emil Velikov
#7 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=105163

Eric Engestrom <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Eric Engestrom <[email protected]> --- Fixed as of:

commit 4f08bfe96da1542f336589edf310d06ebce3cf20

Author: Heiko Becker <[email protected]>
Date:   Mon Feb 19 15:13:15 2018 +0000

*-symbol-check: Don't hard-code nm executable

Helpful if your nm executable has a prefix based on the architecture, for example.

Cc Timo Gurr <[email protected]>
[Eric: v2: rebase and add Meson support]
Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel