configure: Silence lld-link when getting the version number

Message ID 1478175353-21384-1-git-send-email-martin@martin.st
State Committed
Commit d1ef1b9eaa45043ea5df5a004fb37243e05da61d
Headers show

Commit Message

Martin Storsjö Nov. 3, 2016, 12:15 p.m.
In recent lld-link versions, this command prints the version to
stdout, but also prints an error to stderr:

$ lld-link -flavor gnu --version
LLD 4.0.0 (trunk 285641)
lld-link: error: no input files
lld-link: error: target emulation unknown: -m or at least one .o file required
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luca Barbato Nov. 3, 2016, 12:34 p.m. | #1
On 03/11/2016 13:15, Martin Storsjö wrote:
> In recent lld-link versions, this command prints the version to
> stdout, but also prints an error to stderr:
> 
> $ lld-link -flavor gnu --version
> LLD 4.0.0 (trunk 285641)
> lld-link: error: no input files
> lld-link: error: target emulation unknown: -m or at least one .o file required
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 9264bb5..23be425 100755
> --- a/configure
> +++ b/configure
> @@ -3291,7 +3291,7 @@ probe_cc(){
>          _type=lld-link
>          # The link.exe mode doesn't have a switch for getting the version,
>          # but we can force it back to gnu mode and get the version from there.
> -        _ident=$($_cc -flavor gnu --version)
> +        _ident=$($_cc -flavor gnu --version 2>/dev/null)
>          _ld_o='-out:$@'
>          _flags_filter=msvc_flags
>          _ld_lib='lib%.a'
> 

Sure.

Patch

diff --git a/configure b/configure
index 9264bb5..23be425 100755
--- a/configure
+++ b/configure
@@ -3291,7 +3291,7 @@  probe_cc(){
         _type=lld-link
         # The link.exe mode doesn't have a switch for getting the version,
         # but we can force it back to gnu mode and get the version from there.
-        _ident=$($_cc -flavor gnu --version)
+        _ident=$($_cc -flavor gnu --version 2>/dev/null)
         _ld_o='-out:$@'
         _flags_filter=msvc_flags
         _ld_lib='lib%.a'