Skip to content

Commit

Permalink
checkconf.mk: do not use full path to generate guard symbol in conf.h
Browse files Browse the repository at this point in the history
The combination of building with -g3 (which emits definitions of all
defined preprocessor macros to the debug info) and using a full path
to define the name of this preprocessor guard means that the output is
not binary reproducible across different build hosts. For example, in
my Yocto build, the string

  __home_ravi_yocto_tmp_glibc_work_stm32mp135fdk_oe_linux_gnueabi_optee_os_stm32mp_3_19_0_stm32mp_r1_1_build_stm32mp135f_dk_include_generated_conf_h_

appears in several build artifacts. Another developer or buildbot
would not build in some /home/ravi/... directory.

In order to increase binary reproducibility, only use the path sans
the $(out-dir)/ prefix of the conf.h file.

Reviewed-by: Jens Wiklander <[email protected]>
Signed-off-by: Rasmus Villemoes <[email protected]>
  • Loading branch information
Rasmus Villemoes authored and jforissier committed Jun 11, 2024
1 parent 09bbd26 commit c8a2a65
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mk/checkconf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ define check-conf-h
cnf='$(strip $(foreach var, \
$(call cfg-vars-by-prefix,$1), \
$(call cfg-make-define,$(var))))'; \
guard="_`echo $@ | tr -- -/.+ _`_"; \
guardpath="$(patsubst $(out-dir)/%,%,$@)" \
guard="_`echo "$${guardpath}" | tr -- -/.+ _`_"; \
mkdir -p $(dir $@); \
echo "#ifndef $${guard}" >[email protected]; \
echo "#define $${guard}" >>[email protected]; \
Expand Down

0 comments on commit c8a2a65

Please sign in to comment.