> Date: Thu, 23 Mar 2017 14:34:48 +1100
> From: Jonathan Gray <j...@jsg.id.au>
> 
> Backport a change to add "(compatible with GNU linkers)" to the lld
> version output to avoid having to regenerate a large number of configure
> scripts.
> 
> https://reviews.llvm.org/D31199?id=
> http://llvm.org/viewvc/llvm-project?view=revision&revision=298532
> 
> The output is now
> 
> LLD 4.0.0 (compatible with GNU linkers)
> 
> Among other things this is required to build xenocara on arm64 without
> patching libtool and regenerating the configure script for Mesa.

Go for it.

> Index: ELF/Driver.cpp
> ===================================================================
> RCS file: /cvs/src/gnu/llvm/tools/lld/ELF/Driver.cpp,v
> retrieving revision 1.5
> diff -u -p -r1.5 Driver.cpp
> --- ELF/Driver.cpp    18 Mar 2017 16:36:56 -0000      1.5
> +++ ELF/Driver.cpp    23 Mar 2017 00:34:19 -0000
> @@ -281,11 +281,27 @@ void LinkerDriver::main(ArrayRef<const c
>      return;
>    }
>  
> -  // GNU linkers disagree here. Though both -version and -v are mentioned
> -  // in help to print the version information, GNU ld just normally exits,
> -  // while gold can continue linking. We are compatible with ld.bfd here.
> +  // Handle -v or -version.
> +  //
> +  // A note about "compatible with GNU linkers" message: this is a hack for
> +  // scripts generated by GNU Libtool 2.4.6 (released in February 2014 and
> +  // still the newest version in March 2017) or earlier to recognize LLD as
> +  // a GNU compatible linker. As long as an output for the -v option
> +  // contains "GNU" or "with BFD", they recognize us as GNU-compatible.
> +  //
> +  // This is somewhat ugly hack, but in reality, we had no choice other
> +  // than doing this. Considering the very long release cycle of Libtool,
> +  // it is not easy to improve it to recognize LLD as a GNU compatible
> +  // linker in a timely manner. Even if we can make it, there are still a
> +  // lot of "configure" scripts out there that are generated by old version
> +  // of Libtool. We cannot convince every software developer to migrate to
> +  // the latest version and re-generate scripts. So we have this hack.
>    if (Args.hasArg(OPT_version) || Args.hasArg(OPT_v))
> -    outs() << getLLDVersion() << "\n";
> +    outs() << getLLDVersion() << " (compatible with GNU linkers)\n";
> +
> +  // ld.bfd always exits after printing out the version string.
> +  // ld.gold proceeds if a given option is -v. Because gold's behavior
> +  // is more permissive than ld.bfd, we chose what gold does here.
>    if (Args.hasArg(OPT_version))
>      return;
>  
> 
> 

Reply via email to