[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On Mon, Aug 19, 2013 at 11:37:24AM -0600, Eric Blake wrote:
> 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:

I was looking following virt-linker-relro.m4 and I'm getting the correct
result since the output is always empty but for the non matching case
grep exits with 1. However

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

this looks nicer.

> 
> > +++ 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/?

Again following the above example. I'll come up with a v3.
Cheers,
 -- Guido

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]