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

Guido Günther agx at sigxcpu.org
Tue Aug 20 14:43:39 UTC 2013


On Mon, Aug 19, 2013 at 01:36:36PM -0600, Eric Blake wrote:
> On 08/19/2013 12:07 PM, Guido Günther wrote:
> 
> >>> +    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.
> 
> Oh sure - blame copy-and-paste of bad habits :)

Not actually blaming more following current practice. We're not using
AM_LDFLAGS everywhere. This should be a sperate cleanup in case this is
considered useful. Which I think would be since we're misusing LDADDS in
e.g. tests/Makefile.am for cflags, linkerflags and actually adding
additional libraries.
Cheers,
 -- Guido

> 
> >> 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.
> 
> For a v3, it might be nice to have two patches - one that cleans up the
> bad habits of RELRO handling, and the second that extends it with the
> cleaner idioms.  Thanks for putting up with me :)
> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 





More information about the libvir-list mailing list