On x86 GNU assembler will consider '/' as the start of comment marker for
some ELF targets.  This is incorrect with Xen's usage, which does use '/'
in assembly files as a mathematical operator.

The behavior of the assembler can be altered by passing the --divide
option; unconditionally pass this option when available to force the
expected behavior.

Reported-by: Jan Beulich <[email protected]>
Signed-off-by: Roger Pau Monné <[email protected]>
---
Changes since v1:
 - Guard option setting to x86 only.
 - Adjust comment.
---
 xen/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/Makefile b/xen/Makefile
index a054315fa4a2..4c83e2a46477 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -413,6 +413,13 @@ ifneq ($(CONFIG_CC_IS_CLANG),y)
 CFLAGS += -Wa,--strip-local-absolute
 endif
 
+ifeq ($(CONFIG_X86),y)
+# The GNU assembler will interpret '/' as a comment start marker instead of a
+# divide for some ELF targets.  Pass --divide when when available to signal '/'
+# is always used as an operator in assembly.
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
+endif
+
 $(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
 
 LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
-- 
2.51.0


Reply via email to