7388f24 Fix HOST_LDFLAGS to include the hardening flags.

Authored and Committed by pjones 4 years ago
1 file changed. 40 lines added. 18 lines removed.
    Fix HOST_LDFLAGS to include the hardening flags.
    
    rpmdiff noticed the following:
    
    Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
    Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage.  Run with -v to list.
    Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
    Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
    Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
    ' on ppc64le
    
    This is because while we made the CFLAGS get some new options, LDFLAGS never
    got the same treatement, and we disabled %{_hardened_build} to avoid getting
    its options in the TARGET_{C,LD}FLAGS variables.
    
    This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
    {HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
    %{_hardening_cflags} to both HOST_{C,LD}FLAGS.
    
    Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
    CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
    well, since they're always used in concert.
    
    Signed-off-by: Peter Jones <pjones@redhat.com>
    
        
file modified
+40 -18