--Wl, -z, relro in LDFLAGS required?/Inconsistency when not using %configure
Michael Schwendt
mschwendt at gmail.com
Mon Oct 21 12:08:28 UTC 2013
On Mon, 21 Oct 2013 04:01:15 +0200, Kevin Kofler wrote:
> Till Maas wrote:
> > https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Compiler_flags
> >
> > mentions only %optflags to be required for packages but I noticed that
> > %configure sets LDFLAGS to a value different than %optflags:
> >
> > rpm --eval %configure
> > [...]
> > LDFLAGS="${LDFLAGS:--Wl,-z,relro }"; export LDFLAGS;
> > [...]
> >
> > Also using '%global _hardened_build 1' modifies %configure to add
> > -specs=/usr/lib/rpm/redhat/redhat-hardened-ld to LDFLAGS.
> >
> > Therefore it seems that packages with a single Makefile where a package
> > maintainers set the CFLAGS according to the current guidelines are built
> > differently than packages using autoconf.
> >
> > Do we need a %ldflags macro for packages not using %configure (or other
> > build systems with proper RPM macros)? Or do the LDFLAGS not matter if
> > CFLAGS are set properly?
>
> We already have one, it's called %{__global_ldflags}. You are indeed
> supposed to set LDFLAGS of handwritten makefiles to that. The guidelines
> need to be updated.
Also raises the question whether we want more such packages to do
%configure || :
or the less sloppy
[ -f configure ] && exit -1
echo '#!/bin/sh' > configure
%configure
for exporting the flags?
More information about the devel
mailing list