]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libuafs: Stop clobbering CFLAGS
authorAndrew Deason <adeason@sinenomine.net>
Thu, 26 Jul 2018 22:57:38 +0000 (17:57 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Mon, 10 Jun 2019 11:15:39 +0000 (07:15 -0400)
Currently, in the libuafs MakefileProto for every platform, CFLAGS is
set to a bunch of flags, ignoring any CFLAGS set by the 'make'
command-line provided by the user. Since most of the rest of the tree
honors CFLAGS, it is confusing and can cause errors when src/libuafs
ignore the user-set CFLAGS.

One example of this breaking the build is when building RHEL RPMs for
certain sub-architectures of the current machine. If you try to
'rpmbuild --target=i686' on 32-bit x86 RHEL 5, we will build with
-march=i686 in the CFLAGS, which will be used to build most objects
and is used in our configure tests. As a result, our configure tests
will say that gcc atomic intrinsics are available. But when we go to
build libuafs objects, we will not have -march=i686 in our CFLAGS,
which causes (on RHEL 5) gcc to default to building for i386, which
does not have gcc atomic intrinsics available. This causes build
errors like this:

    libuafs.a(rx.o): In function `rx_atomic_test_and_clear_bit':
    [...]/BUILD/openafs-1.8.0/src/rx/rx_atomic.h:462: undefined reference to `__sync_fetch_and_and_4'

To fix this, change the libuafs MakefileProtos to not set CFLAGS
directly; instead, set them in a new variable UAFS_CFLAGS.
Makefile.common then pulls those flags into MODULE_CFLAGS, which is
used in our *_CCRULE build rules.

While we are here, also move the common set of CFLAGS set by each
platform's MakefileProto into Makefile.common. Now, each MakefileProto
only needs to set CFLAGS that are specific to that platform, which
ends up being very few (since most platforms were using the exact same
set of CFLAGS).

Relevant issue identified and analyzed by mbarbosa@sinenomine.net.

Reviewed-on: https://gerrit.openafs.org/13262
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit ee66819a0c1a9efa98b76a1c18af6233bda1e233)

Change-Id: Ia38d4701aeb4f690b12a6ffdbb42b8ec8c499486
Reviewed-on: https://gerrit.openafs.org/13544
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/libuafs/Makefile.common.in
src/libuafs/MakefileProto.AIX.in
src/libuafs/MakefileProto.DARWIN.in
src/libuafs/MakefileProto.DFBSD.in
src/libuafs/MakefileProto.FBSD.in
src/libuafs/MakefileProto.HPUX.in
src/libuafs/MakefileProto.IRIX.in
src/libuafs/MakefileProto.LINUX.in
src/libuafs/MakefileProto.NBSD.in
src/libuafs/MakefileProto.OBSD.in
src/libuafs/MakefileProto.SOLARIS.in

index daf09494c25325995ded66ec770708398677aaa4..e062c7c2eb3def1824f99c38f25eb174eb496a08 100644 (file)
@@ -10,7 +10,7 @@
 
 # Each MakefileProto includes Makefile.config, so we should only need
 # minor tweaks here.
-MODULE_CFLAGS=-DKERNEL
+MODULE_CFLAGS=${UAFS_CFLAGS} -DKERNEL -I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 LT_objs = \
        afs_atomlist.lo \
@@ -216,7 +216,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
 
 linktest: libuafs.a
-       $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) \
+       $(CC) $(CFLAGS) $(TEST_CFLAGS) $(TEST_LDFLAGS) \
                $(LDFLAGS_roken) $(LDFLAGS_hcrypto) -o linktest \
                ${srcdir}/linktest.c $(MODULE_INCLUDE) -DUKERNEL \
                libuafs.a ${TOP_LIBDIR}/libcmd.a \
index 6a27a7506e39f3d3b87b8a3d57806e2d2f278935..881b3c935f872d28fc67ebbe19bb2302c6d51608 100644 (file)
@@ -16,7 +16,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 
 # System specific build commands and flags
 DEFINES= -DKERNEL -DUKERNEL
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 AR = /usr/bin/ar
 ARFLAGS = -r
 RANLIB = /bin/ranlib
index 19920e2f6a180cfa4f7cbb77b46dffd329ea81b5..c5f99fbef537b27258c95b9f63bd4ba3ae40dbed 100644 (file)
@@ -16,7 +16,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 # System specific build commands and flags
 DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
 KOPTS=
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS) $(ARCHFLAGS)
+UAFS_CFLAGS=$(ARCHFLAGS)
 
 TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV $(XCFLAGS) $(ARCHFLAGS)
 TEST_LDFLAGS=$(XLDFLAGS) $(ARCHFLAGS)
index 0c49f05ee4a7b4b550098d7fb2e55b919a089415..fac1a852d44a970da163f52840eb88be0914a704 100644 (file)
@@ -16,7 +16,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 CC = @CC@
 DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
 KOPTS=
-CFLAGS=-I. -I..  -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_DFFBSD_ENV $(XCFLAGS)
 TEST_LDFLAGS=
index c7dfea65996f5f4aaf4e120591617e3835e3026e..2c910f5932f7e05c58b6a7fc4ce961c345b635a9 100644 (file)
@@ -17,7 +17,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 CC = @CC@
 DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
 KOPTS=
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_FBSD50_ENV $(XCFLAGS)
 TEST_LDFLAGS=
index d8dc557d5b15149f8139a206d8c16233287dc6d0..109c2197016a7d14e0f498a62cafc73c9a6851c9 100644 (file)
@@ -19,9 +19,6 @@ DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
 KOPTS=-Wp,-H200000 -Wl,-a,archive +DA1.0 +z
 <ia64_hpux1122 ia64_hpux1123>
 KOPTS=-Wp,-H200000 -Wl,-a,archive_shared
-<all>
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
-
 <hp_ux102 hp_ux110 hp_ux11i>
 TEST_CFLAGS= -Wp,-H200000 +DA1.0 +z -D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -Dhpux -DAFS_HPUX_ENV $(XCFLAGS)
 <ia64_hpux1122 ia64_hpux1123>
index 757e71bf621bc7f40a7645008c64b419c9adafd6..3b1b67c8ee7e27868902502d4abb1607d8c656e0 100644 (file)
@@ -15,7 +15,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 # System specific build commands and flags
 CC = cc
 DEFINES=-D_SGI_MP_SOURCE -DKERNEL -DUKERNEL
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -Dirix -DAFS_SGI_ENV $(XCFLAGS)
 TEST_LDFLAGS=-ignore_minor
index d415a4a163309923a0542a106132b977442960a3..3647a4d5fa0715ba912bc5562a14f577f548c551 100644 (file)
@@ -19,11 +19,8 @@ DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
 KOPTS=
 SYS_NAME=@AFS_SYSNAME@
 ifeq (${SYS_NAME}, ppc64_linux26)
-CFLAGS=-fPIC
-else
-CFLAGS=
+UAFS_CFLAGS=-fPIC
 endif
-CFLAGS+= -I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=-pthread -D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_LINUX22_ENV $(XCFLAGS)
 TEST_LDFLAGS=
index 6a2150861d86212d1a1de511a8b098477b8a0e16..f2883268f5e1532c3c3751db0c19c682dd177426 100644 (file)
@@ -17,7 +17,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 CC = gcc
 DEFINES= -DKERNEL -DUKERNEL
 KOPTS=
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=   -DAFS_NBSD_ENV $(XCFLAGS)
 TEST_LDFLAGS=
index 8db60b07fccbfe41e87e41ccf0df1ce7a1ad85ee..9bd7be191c80f7dc01746c7ba90e10621e5a0525 100644 (file)
@@ -17,7 +17,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 CC = gcc
 DEFINES= -DKERNEL -DUKERNEL
 KOPTS=
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=   -DAFS_OBSD_ENV $(XCFLAGS)
 TEST_LDFLAGS=
index 8e51a9525059e17b82ec5da223b6b6009c3e1160..3be917b99a9fe8dcea64661506bcfbdca43180fa 100644 (file)
@@ -14,7 +14,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 
 # System specific build commands and flags
 DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG} $(XCFLAGS)
 
 TEST_CFLAGS=-mt -DAFS_PTHREAD_ENV -Dsolaris -DAFS_SUN5_ENV $(XCFLAGS)
 TEST_LDFLAGS=