Re: [PATCH 1/2] Makefile: Fix distcc compilation with x86 macros
From: Ingo Molnar
Date: Tue Nov 13 2018 - 06:30:07 EST
* Nadav Amit <namit@xxxxxxxxxx> wrote:
> Introducing the use of asm macros in c-code broke distcc, since it only
> sends the preprocessed source file. The solution is to break the
> compilation into two separate phases of compilation and assembly, and
> between the two concatanate the assembly macros and the compiled (yet
s/concatenate
> not assembled) source file. Since this is less efficient, this
> compilation mode is only used when make is called with the "DISTCC=y"
> parameter.
>
> Note that the assembly stage should also be distributed, if distcc is
> configured using "CFLAGS=-DENABLE_REMOTE_ASSEMBLE".
It's a bit sad that we regressed distcc performance ...
> +# If distcc is used, then when an assembly macro files is needed, the
> +# compilation stage and the assembly stage need to be separated. Providing
> +# "DISTCC=y" option enables the separate compilation and assembly.
Let's fix the various typos:
> +# If distcc is used, and when assembly macro files are needed, the
> +# compilation stage and the assembly stage needs to be separated.
> +# Providing the "DISTCC=y" option enables separate compilation and
> +# assembly.
> +cmd_cc_o_c_direct = $(CC) $(c_flags) -c -o $(1) $<
> +
> +ifeq ($(DISTCC),y)
> +a_flags_no_debug = $(filter-out $(AFLAGS_DEBUG_INFO), $(a_flags))
> +c_flags_no_macros = $(filter-out $(ASM_MACRO_FLAGS), $(c_flags))
> +
> +cmd_cc_o_c_two_steps = \
> + $(CC) $(c_flags_no_macros) $(DISABLE_LTO) -fverbose-asm -S \
> + -o $(@D)/.$(@F:.o=.s) $< ; \
> + cat $(ASM_MACRO_FILE) $(@D)/.$(@F:.o=.s) > \
> + $(@D)/.tmp_$(@F:.o=.s); \
> + $(CC) $(a_flags_no_debug) -c -o $(1) $(@D)/.tmp_$(@F:.o=.s) ; \
> + rm -f $(@D)/.$(@F:.o=.s) $(@D)/.tmp_$(@F:.o=.s) \
> +
> +cmd_cc_o_c_helper = \
> + $(if $(findstring $(ASM_MACRO_FLAGS),$(c_flags)), \
> + $(call cmd_cc_o_c_two_steps, $(1)), \
> + $(call cmd_cc_o_c_direct, $(1)))
There are various stray <space>+<tab> whitespace noise errors in the
chunks above.
Thanks,
Ingo