Hi,

I get the following build failure on debian unstable with GCC 9.3.0:

tar xf tboot-1.9.12.tar.gz
cd tboot-1.9.12/
env CFLAGS="-g" make
...
cc -z noexecstack -z relo -z now -c -o obj/mem_primitives_lib.o safeclib/mem_primitives_lib.c -g -Wall -Wformat-security -Werror -Wstrict-prototypes -Wextra -Winit-self -Wswitch-default -Wunused-parameter -Wwrite-strings -Wlogical-op -Wno-missing-field-initializers -Wno-address-of-packed-member -fno-strict-aliasing -std=gnu99 -Wno-array-bounds -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -I/home/lindi/tboot-1.9.12/safestringlib/include -Wall -Wformat-security -Werror -Wstrict-prototypes -Wextra -Winit-self -Wswitch-default -Wunused-parameter -Wwrite-strings -Wlogical-op -Wno-missing-field-initializers -Wno-address-of-packed-member -fno-strict-aliasing -std=gnu99 -Wno-array-bounds -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -I/home/lindi/tboot-1.9.12/safestringlib/include -Iinclude -fstack-protector-strong -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -DSTDC_HEADERS
safeclib/mem_primitives_lib.c: In function \u2018mem_prim_set\u2019:
safeclib/mem_primitives_lib.c:111:25: error: this statement may fall through [-Werror=implicit-fallthrough=]
  111 |         case 15:  *lp++ = value32;
      |                   ~~~~~~^~~~~~~~~
safeclib/mem_primitives_lib.c:112:9: note: here
  112 |         case 14:  *lp++ = value32;
      |         ^~~~


It seems that Config.mk adds -Werror and -Wextra that cause this to happen. Why doesn't this happen when CFLAGS is not set as an
environment variable? Apparently because

CFLAGS += $(CFLAGS_WARN) -fno-strict-aliasing -std=gnu99

behaves differently with recursive makefiles if CFLAGS is in the environment:

"By default, only variables that came from the environment or the command line are passed to recursive invocations."

 https://www.gnu.org/software/make/manual/html_node/Environment.html

Is the intent here that CFLAGS_WARN should be used for the whole build? If yes, then we need to add "export CFLAGS" to ensure that it is passed to other makefiles and also fix that build failure.

If not, we need to add "unexport CFLAGS" and don't necessary need to fix the switch-case statement.


-Timo


_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to