All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/2] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK
Date: Thu, 25 Jan 2018 10:15:38 +0000	[thread overview]
Message-ID: <20180125101538.wcaqkb3q2ul4rmle@MacBook-Pro-de-Roger.local> (raw)
In-Reply-To: <20180124165217.6c35apjisrdgioz2@MacBook-Pro-de-Roger.local>

On Wed, Jan 24, 2018 at 04:52:17PM +0000, Roger Pau Monné wrote:
> On Wed, Jan 24, 2018 at 09:23:37AM -0700, Jan Beulich wrote:
> > >>> On 24.01.18 at 16:48, <roger.pau@citrix.com> wrote:
> > > When indirect_thunk_asm.h is instantiated directly into assembly files
> > > CONFIG_INDIRECT_THUNK might not be defined, and thus using .if against
> > > it is wrong.
> > > 
> > > Add a check to define CONFIG_INDIRECT_THUNK to 0 if not defined, so
> > > that using .if CONFIG_INDIRECT_THUNK is always correct.
> > > 
> > > This suppresses the following clang error:
> > > 
> > > <instantiation>:8:9: error: expected absolute expression
> > >     .if CONFIG_INDIRECT_THUNK == 1
> > >         ^
> > > <instantiation>:1:1: note: while in macro instantiation
> > > INDIRECT_BRANCH call %rdx
> > > ^
> > > entry.S:589:9: note: while in macro instantiation
> > >         INDIRECT_CALL %rdx
> > >         ^
> > 
> > Why is the same no problem with gas? It wants constant
> > expressions with .if too, after all.
> 
> Right, and I cannot figure out why it works when using
> -no-integrated-as and not when not using it. The more that I cannot
> see CONFIG_INDIRECT_THUNK being unconditionally defined to either 0 or
> 1. I guess I'm missing something.

So given the following asm snippet:

# cat snip.S
.if FOO == 1
.error "FOO"
.endif

Attempting to compile it with different compilers/assemblers:

# clang -o snip.o -c snip.S
snip.S:1:5: error: expected absolute expression
.if FOO == 1
    ^
snip.S:2:1: error: FOO
.error "FOO"
^
# gcc -o snip.o -c snip.S
# as -o snip.o snip.S

So there's clearly something different in how as/gcc handle .if
directives when they reference undefined symbols versus clang.

I can expand the commit message to reflect/include the above, but I
think the change still stands.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      parent reply	other threads:[~2018-01-25 10:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 15:48 [PATCH 0/2] clang: fixes for the indirect thunk Roger Pau Monne
2018-01-24 15:48 ` [PATCH 1/2] x86/clang: fix build with indirect thunks Roger Pau Monne
2018-01-24 16:40   ` Jan Beulich
2018-01-24 17:06     ` Roger Pau Monné
2018-01-25  9:39       ` Jan Beulich
2018-01-25  9:50         ` Roger Pau Monné
2018-01-24 15:48 ` [PATCH 2/2] x86: fix indirect thunk usage of CONFIG_INDIRECT_THUNK Roger Pau Monne
2018-01-24 16:23   ` Jan Beulich
2018-01-24 16:52     ` Roger Pau Monné
2018-01-25 10:13       ` Jan Beulich
2018-01-25 10:15       ` Roger Pau Monné [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180125101538.wcaqkb3q2ul4rmle@MacBook-Pro-de-Roger.local \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.