[libvirt] [PATCH v2] Check for --no-copy-dt-needed linker flag

Eric Blake eblake at redhat.com
Mon Aug 19 17:37:24 UTC 2013


On 08/19/2013 11:28 AM, Guido Günther wrote:
> and use it when available
> ---
>  configure.ac                  |  1 +
>  m4/virt-linker-no-indirect.m4 | 30 ++++++++++++++++++++++++++++++
>  src/Makefile.am               |  9 +++++++++
>  tests/Makefile.am             |  1 +
>  4 files changed, 41 insertions(+)
>  create mode 100644 m4/virt-linker-no-indirect.m4
> 

> +AC_DEFUN([LIBVIRT_LINKER_NO_INDIRECT],[
> +    AC_MSG_CHECKING([for how to avoid indirect lib deps])
> +
> +    NO_INDIRECT_LDFLAGS=
> +    `$LD --help 2>&1 | grep -- "--no-copy-dt-needed-entries" >/dev/null` && \

Doesn't do what you think (it tries to execute the output of grep -
which is thankfully empty on both success and failure).  Also wastes a
fork on grep, compared to the simpler:

case `$LD --help 2>&1` in
  *--no-copy-dt-needed-entries*) NO_INDIRECT_LDFLAGS=... ;;
esac

> +++ b/src/Makefile.am
> @@ -1813,6 +1813,7 @@ libvirt_la_LDFLAGS = \
>  		$(LIBVIRT_NODELETE) \
>  		$(AM_LDFLAGS) \
>  		$(RELRO_LDFLAGS) \
> +		$(NO_INDIRECT_LDFLAGS) \

Why aren't you building this directly into $(AM_LDFLAGS) once, rather
than having to copy it into each and every library recipe?

Why only src/ and tests/? What about tools/ and daemon/?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130819/c80ad2d8/attachment-0001.sig>


More information about the libvir-list mailing list