diff mbox series

[XEN,v8,39/47] RFC, no-VPATH: x86/boot: workaround gcc including the wrong file

Message ID 20211125134006.1076646-40-anthony.perard@citrix.com (mailing list archive)
State Superseded
Headers show
Series xen: Build system improvements, now with out-of-tree build! | expand

Commit Message

Anthony PERARD Nov. 25, 2021, 1:39 p.m. UTC
From: Anthony PERARD <anthony.perard@gmail.com>

we generate cmdline.S and reloc.S, so we should include those
generated file as presented in the build tree, but for file included
with quote, gcc will first look into the directory where the source
file is, that is where head.S is located and thus include cmdline.S
that is present in the source tree when it is dirty. But that the
wrong file as we want to include the file from the build tree. Work
around by using <> to include those file as if the come from the
system, as gcc will first look in directories listed with '-I' on the
command line.

So now we also need to add -I when building in the source tree.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/boot/Makefile | 4 +++-
 xen/arch/x86/boot/head.S   | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 04ee9da83333..4fc6b1d8ffc2 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -8,7 +8,9 @@  targets += $(head-objs:.S=.o)
 head-objs := $(addprefix $(obj)/, $(head-objs))
 
 ifdef building_out_of_srctree
-$(obj)/head.o: CFLAGS-y += -iquote $(obj)
+$(obj)/head.o: CFLAGS-y += -I$(obj)
+else
+$(obj)/head.o: CFLAGS-y += -I$(src)
 endif
 $(obj)/head.o: $(head-objs)
 
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index dd1bea0d10b3..66acd2e9bfc0 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -772,10 +772,10 @@  trampoline_setup:
         lret
 
 cmdline_parse_early:
-#include "cmdline.S"
+#include <cmdline.S>
 
 reloc:
-#include "reloc.S"
+#include <reloc.S>
 
 ENTRY(trampoline_start)
 #include "trampoline.S"