[libvirt] [PATCH v2] Check for --no-copy-dt-needed linker flag
Daniel P. Berrange
berrange at redhat.com
Tue Aug 20 09:55:32 UTC 2013
On Mon, Aug 19, 2013 at 08:07:42PM +0200, Guido Günther wrote:
> 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,
Personally I prefer to see things explicitly listed rather than hide
them behind AM_LDFLAGS.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list