Message ID | 20180219163533.8943-1-eric.engestrom@imgtec.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Eric Engestrom <eric.engestrom@imgtec.com> writes: > From: Heiko Becker <heirecka@exherbo.org> > > Helpful if your nm executable has a prefix based on the > architecture, for example. > > Signed-off-by: Heiko Becker <heirecka@exherbo.org> > Cc: Timo Gurr <timo.gurr@gmail.com> > [Eric: v2: rebase and add Meson support] > Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Eric Anholt <eric@anholt.net>
On 19 February 2018 at 16:35, Eric Engestrom <eric.engestrom@imgtec.com> wrote: > From: Heiko Becker <heirecka@exherbo.org> > > Helpful if your nm executable has a prefix based on the > architecture, for example. > > +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
On Friday, 2018-02-23 00:25:27 +0000, Emil Velikov wrote: > On 19 February 2018 at 16:35, Eric Engestrom <eric.engestrom@imgtec.com> wrote: > > From: Heiko Becker <heirecka@exherbo.org> > > > > Helpful if your nm executable has a prefix based on the > > architecture, for example. > > > > > +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 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? :) > > 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
On Friday, 2018-02-23 15:02:44 +0000, Eric Engestrom wrote: > On Friday, 2018-02-23 00:25:27 +0000, Emil Velikov wrote: > > On 19 February 2018 at 16:35, Eric Engestrom <eric.engestrom@imgtec.com> wrote: > > > From: Heiko Becker <heirecka@exherbo.org> > > > > > > Helpful if your nm executable has a prefix based on the > > > architecture, for example. > > > > > > > > +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 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? :) > > > > > 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.
On 23 February 2018 at 15:02, Eric Engestrom <eric.engestrom@imgtec.com> wrote: > On Friday, 2018-02-23 00:25:27 +0000, Emil Velikov wrote: >> On 19 February 2018 at 16:35, Eric Engestrom <eric.engestrom@imgtec.com> wrote: >> > From: Heiko Becker <heirecka@exherbo.org> >> > >> > Helpful if your nm executable has a prefix based on the >> > architecture, for example. >> > >> >> > +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. >> >> 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? :) > Great, I'll let you do the honours of tweaking Meson/its documentation. Thank you very much for the clarification. The patch is Reviewed-by: Emil Velikov <emil.velikov@collabora.com> -Emil
diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 17de0c3b48f48710cde2..90b7a1d633c0b2143f29 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -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 diff --git a/amdgpu/meson.build b/amdgpu/meson.build index 7040ebab86e271022323..f39d7bf6d284534dc660 100644 --- a/amdgpu/meson.build +++ b/amdgpu/meson.build @@ -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] ) diff --git a/configure.ac b/configure.ac index cea0b9dda3ccc1b86061..a695cce9d48c16fbcc8e 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/exynos/exynos-symbol-check b/exynos/exynos-symbol-check index 9692caa685b4cd93ec4a..e9f1b04d5b0a7a258cf1 100755 --- a/exynos/exynos-symbol-check +++ b/exynos/exynos-symbol-check @@ -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 diff --git a/exynos/meson.build b/exynos/meson.build index c96ad4e0cd7194a9c902..30d36405d6ef725b7e10 100644 --- a/exynos/meson.build +++ b/exynos/meson.build @@ -49,5 +49,6 @@ pkg.generate( test( 'exynos-symbol-check', prog_bash, + env : env_test, args : [files('exynos-symbol-check'), libdrm_exynos] ) diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check index 6b81040c797aeed11dca..56e3d3eeace6f9deb280 100755 --- a/freedreno/freedreno-symbol-check +++ b/freedreno/freedreno-symbol-check @@ -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 diff --git a/freedreno/meson.build b/freedreno/meson.build index da993c10355578838f29..015b7fb1c02706916e9d 100644 --- a/freedreno/meson.build +++ b/freedreno/meson.build @@ -72,5 +72,6 @@ pkg.generate( test( 'freedreno-symbol-check', prog_bash, + env : env_test, args : [files('freedreno-symbol-check'), libdrm_freedreno] ) diff --git a/intel/intel-symbol-check b/intel/intel-symbol-check index 2aa2d8192cea761a7cda..4d30a4b15feb94e9523d 100755 --- a/intel/intel-symbol-check +++ b/intel/intel-symbol-check @@ -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 diff --git a/intel/meson.build b/intel/meson.build index 42402f60e38cd5e7359f..53c7fce4ef97828bd63c 100644 --- a/intel/meson.build +++ b/intel/meson.build @@ -101,5 +101,6 @@ test( test( 'intel-symbol-check', prog_bash, + env : env_test, args : [files('intel-symbol-check'), libdrm_intel] ) diff --git a/libkms/kms-symbol-check b/libkms/kms-symbol-check index 658b269265676de25270..a5c2120d5ce75616f489 100755 --- a/libkms/kms-symbol-check +++ b/libkms/kms-symbol-check @@ -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 diff --git a/libkms/meson.build b/libkms/meson.build index 9eff43136397b101fa1b..86d1a4ee6c795a186d66 100644 --- a/libkms/meson.build +++ b/libkms/meson.build @@ -70,5 +70,6 @@ pkg.generate( test( 'kms-symbol-check', prog_bash, + env : env_test, args : [files('kms-symbol-check'), libkms] ) diff --git a/meson.build b/meson.build index 23a892a318c5628eb36e..baf43701e3ab77b08ac1 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/nouveau/meson.build b/nouveau/meson.build index b8affd9ef776c99ba896..51c9a7123d3b34a250ea 100644 --- a/nouveau/meson.build +++ b/nouveau/meson.build @@ -54,5 +54,6 @@ pkg.generate( test( 'nouveau-symbol-check', prog_bash, + env : env_test, args : [files('nouveau-symbol-check'), libdrm_nouveau] ) diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check index b265cea466af600a7751..b3a24101e52d8aae1bba 100755 --- a/nouveau/nouveau-symbol-check +++ b/nouveau/nouveau-symbol-check @@ -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 diff --git a/omap/meson.build b/omap/meson.build index f89436f0e99970b381aa..e57b8f5da03618d94720 100644 --- a/omap/meson.build +++ b/omap/meson.build @@ -49,5 +49,6 @@ pkg.generate( test( 'omap-symbol-check', prog_bash, + env : env_test, args : [files('omap-symbol-check'), libdrm_omap] ) diff --git a/omap/omap-symbol-check b/omap/omap-symbol-check index 759c84bd3d98d19c2d33..0fb4a0f2664cf9edbc27 100755 --- a/omap/omap-symbol-check +++ b/omap/omap-symbol-check @@ -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 diff --git a/radeon/meson.build b/radeon/meson.build index 557a878042bb78df4096..b08c744219c0c36c5d93 100644 --- a/radeon/meson.build +++ b/radeon/meson.build @@ -59,5 +59,6 @@ pkg.generate( test( 'radeon-symbol-check', prog_bash, + env : env_test, args : [files('radeon-symbol-check'), libdrm_radeon] ) diff --git a/radeon/radeon-symbol-check b/radeon/radeon-symbol-check index 0bf2ffcbeebce4f0c230..7d79d90127bd6d27d050 100755 --- a/radeon/radeon-symbol-check +++ b/radeon/radeon-symbol-check @@ -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 diff --git a/tegra/meson.build b/tegra/meson.build index 7ac815177718d301b76c..1f5c74b38d0506d1816d 100644 --- a/tegra/meson.build +++ b/tegra/meson.build @@ -48,5 +48,6 @@ pkg.generate( test( 'tegra-symbol-check', prog_bash, + env : env_test, args : [files('tegra-symbol-check'), libdrm_tegra] ) diff --git a/tegra/tegra-symbol-check b/tegra/tegra-symbol-check index 420469f4130119188161..509b678c37b899a25f0a 100755 --- a/tegra/tegra-symbol-check +++ b/tegra/tegra-symbol-check @@ -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__