UKERNEL: Build linktest with COMMON_CFLAGS

Currently, 'linktest' in libuafs is built with a weird custom rule
that specifies several various CFLAGS and LDFLAGS, etc. One
side-effect of this is that linktest is built without specifying -O,
even if optimization is otherwise enabled.

Normally nobody would care about the optimization of linktest, since
it's never supposed to be run, but this can cause an error when
building with -D_FORTIFY_SOURCE=1 on some systems (such as RHEL7):

    In file included from /usr/include/sys/types.h:25:0,
                     from /.../src/config/afsconfig.h:1485,
                     from /.../src/libuafs/linktest.c:15:
    /usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
     #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
        ^
    cc1: all warnings being treated as errors
    make[3]: *** [linktest] Error 1

For now, to fix this just include $(COMMON_CFLAGS) in the flags we
give for linktest, so $(OPTMZ) also gets pulled in, and building
linktest gets a little closer to a normal compilation step.

Change-Id: I3362dcfe8407825ab88854ae59da4188ed16be9d
Reviewed-on: https://gerrit.openafs.org/14324
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2020-08-26 15:41:00 -05:00 committed by Benjamin Kaduk
parent 696f2ec67b
commit c4f853aa00

View File

@ -212,7 +212,7 @@ ${TOP_LIBDIR}/perl/AFS/ukernel.pm: setup_perllib PERLUAFS/ukernel.pm
LIBUAFS_BUILD_PERL: ${TOP_LIBDIR}/perl/ukernel.so ${TOP_LIBDIR}/perl/AFS/ukernel.pm LIBUAFS_BUILD_PERL: ${TOP_LIBDIR}/perl/ukernel.so ${TOP_LIBDIR}/perl/AFS/ukernel.pm
linktest: libuafs.a linktest: libuafs.a
$(CC) $(CFLAGS) $(TEST_CFLAGS) $(TEST_LDFLAGS) \ $(CC) $(COMMON_CFLAGS) $(TEST_CFLAGS) $(TEST_LDFLAGS) \
$(LDFLAGS_roken) $(LDFLAGS_hcrypto) -o linktest \ $(LDFLAGS_roken) $(LDFLAGS_hcrypto) -o linktest \
${srcdir}/linktest.c $(MODULE_INCLUDE) -DUKERNEL \ ${srcdir}/linktest.c $(MODULE_INCLUDE) -DUKERNEL \
libuafs.a ${TOP_LIBDIR}/libcmd.a \ libuafs.a ${TOP_LIBDIR}/libcmd.a \