[patch] Nettle add missing cflags to some objects

Niels Möller nisse at lysator.liu.se
Wed Aug 3 12:45:38 UTC 2016


Tomas Chvatal <TChvatal at suse.com> writes:

> we have checks that verify all objects are compiled with respecting
> cflags set in the distribution (hardening, optimization, etc.).

I see. And you can't easily exclude executables which are never installed?
Note that the Makefile rules where CC_FOR_BUILD is used produce
executables directly from a .c file, with no explicit object files.

> Hmm with the cross-compilation I am not sure how that should be handled
> properly but simply ignoring all other cflags on those objects does not
> seem like right solution.

I see two reasonable solutions. If possible, try both and report what
works. Either explicitly pass CC_FOR_BUILD="gcc
--whatever-flags-you-want" on the configure command line produced by
your build scripts. Or change the no-cross default, like

--- a/aclocal.m4
+++ b/aclocal.m4
@@ -514,7 +514,7 @@ elif test -n "$HOST_CC"; then
     [AC_MSG_ERROR([Specified HOST_CC doesn't seem to work])])
 else
   if test $cross_compiling = no ; then
-    CC_FOR_BUILD="$CC"  
+    CC_FOR_BUILD="$(CC) $(CFLAGS)"  
   else
     for i in gcc cc c89 c99; do
       GMP_PROG_CC_FOR_BUILD_WORKS($i,

(untested, not sure if this makefile syntax in CC_FOR_BUILD breaks any
use outside of Makefile).

And I guess you'll have the same problem when building gmp, so I'm
cc:ing the gmp-devel list as well.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list