[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen: always consider '/' as a division in assembly


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 10 Feb 2026 16:53:53 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DmEvUZ1QKiHEzh84BWVqPOTp3oiFgQGTjg0LCZbwrMU=; b=LuygTHrbv6zuD/93PotxiWqszMY4269E1aeSMhNDiNb5A9bNc+ekPZwljWO0g6isJvL0GQdulnhGufmGBC9imcnRM/2fWgakRtlG4ks9Gp98RJIYY9h6YOnU0Rd4tfI1AfIoWz5TXoD4QkFfmmxSsAwViuXh698U8r2ueoiUaqBRtTGfb6+gLGgf53N5HKLB+8Lhbiwo+vpuudFhTExqsw6UY+mSB8rcurG9YugxurEU8ZGrfzYa8lUyyglGykh8Ih93rGTGWdC/XmTXFBGeQXcmHrFEj21WK4kAUAZxFnHa4JEnuGCFsfndHwzqT9CTxvJtJaBfiNVQR4j7SRJVHA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CadJeKJ3iLT0VdPcUaxaCrzW25RUdsQNJ+LwIVjsJxva9UiwmhnDuW3grF9RTAZPLrA/igVAIFrmSCEVvrS2FZOahdfUc955wGd+/2sLT9007QU39J6mqNl3eAd+40LfRx6nMT9D6Za6KT1TLwfIz4JOicsnMawQOhjvZMVViNt8ejc1AdZ61OgiI68dBv9jX9rRtSFRmBmZUnJwzBF/wW/lnYssnZZBEqUlRDOcifuNc/1N5Zy8M8iMAF+GrOsC4ZLvezOwzDdSWzyPcGCOvso8t4rYCz4VdaKvI54lsUmwmnsPqvtGGrpQOJYP52oeyvVfGxyQ0Dm3tCMWfxW9DQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 10 Feb 2026 15:54:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Feb 10, 2026 at 04:27:33PM +0100, Jan Beulich wrote:
> On 10.02.2026 16:11, Roger Pau Monne wrote:
> > GNU assembler will consider '/' as the start of comment marker on some
> > platforms.  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.
> 
> I'm fine with this in principle, but I wonder: What about Clang? If it's
> properly compatible, it ought to also take '/' as a comment char for
> those same targets (in particular for the plain "x86_64-elf" one).
> According to godbolt it can't deal with -Wa,--divide, yet there I also
> can't control what exact target the toolchain supports (i.e. this may be
> only a weak indication of lack of support / compatibility).

Hm, I'm unsure I can get such a Clang build to properly test it.  Note
the checking for the presence of the option would also be done in
Clang.  I would like to think if Clang integrated assembler has this
behavior the option to select our expected behavior will also be
--divide.  I think that's the best I can do ATM.

> > --- a/xen/Makefile
> > +++ b/xen/Makefile
> > @@ -405,6 +405,11 @@ $(call cc-option-add,CFLAGS,CC,-Winit-self)
> >  CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h
> >  CFLAGS-$(CONFIG_DEBUG_INFO) += -g
> >  
> > +# The GNU assembler will interpret '/' as a comment start marker instead 
> > of a
> > +# divide on some platforms.
> 
> Could I talk you into s/on some platforms/for some ELF targets/ ?

Yes, that's fine IMO.

> A more fundamental question is: Do we really mean to support (allow)
> building with arbitrary-target toolchains? There are other subtle
> differences, which may be hard to evaluate as to them possibly affecting
> the Xen build.

Hm, TBH I wasn't aware of such subtle and annoying differences until
today, so I'm not sure what to reply here.  I haven't tested the x86
image yet, as I'm still attempting to resolve some non-POSIX options
usage in check-endbr.sh.

We might want to state which ELF targets we do explicitly support for
production usage.  TBH I doubt anyone would use a Darwin build for
production.

> >  Pass --divide when when available to signal '/' is
> > +# always used as an operator in assembly.
> > +$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
> 
> I don't think this should be done here: --divide is an x86-specific
> option.

Oh, that wasn't clear from the output of as.  I can make it
x86-specific then.  However, is there any chance of this behavior
escaping outside of x86, and hence would we like to ensure this
behavior on all possible arches?

Or is it possible that other arches re-use the --divide option for
some other functionality?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.