[PATCH 4/5] xen: build: add support for CFLAGS_REMOVE variable

Volodymyr Babchuk posted 5 patches 3 weeks, 6 days ago
[PATCH 4/5] xen: build: add support for CFLAGS_REMOVE variable
Posted by Volodymyr Babchuk 3 weeks, 6 days ago
This variable can be used in cases when we need to remove certain
CFLAGS for particular object file. One such case is
-mgeneral-regs-only flags that should be omitted when we are building
an object file that uses not only general registers.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 xen/Rules.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d759cccee3..478318537f 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -179,7 +179,7 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))
 # Calculation of flags, first the generic flags, then the arch specific flags,
 # and last the flags modified for a target or a directory.
 
-c_flags = -MMD -MP -MF $(depfile) $(XEN_CFLAGS)
+c_flags = -MMD -MP -MF $(depfile) $(filter-out $(CFLAGS_REMOVE),$(XEN_CFLAGS))
 a_flags = -MMD -MP -MF $(depfile) $(XEN_AFLAGS)
 
 include $(srctree)/arch/$(SRCARCH)/Rules.mk
-- 
2.47.0
Re: [PATCH 4/5] xen: build: add support for CFLAGS_REMOVE variable
Posted by Jan Beulich 3 weeks, 6 days ago
On 29.11.2024 02:49, Volodymyr Babchuk wrote:
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -179,7 +179,7 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))
>  # Calculation of flags, first the generic flags, then the arch specific flags,
>  # and last the flags modified for a target or a directory.
>  
> -c_flags = -MMD -MP -MF $(depfile) $(XEN_CFLAGS)
> +c_flags = -MMD -MP -MF $(depfile) $(filter-out $(CFLAGS_REMOVE),$(XEN_CFLAGS))

This looks rather fragile to me. Plus see the comment on the next patch,
where this is actually used.

Jan