From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Borislav Petkov <bp@alien8.de>,
Jan Beulich <JBeulich@suse.com>,
Binutils <binutils@sourceware.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Avoiding unnecessary jump relocations in gas?
Date: Wed, 20 May 2015 13:59:35 -0700 [thread overview]
Message-ID: <555CF5B7.8080709@zytor.com> (raw)
In-Reply-To: <CALCETrUQ_uMLEn3O-Vmu0vOm_4qRYxgj8YZOUJE13SDMqQmBPQ@mail.gmail.com>
On 05/20/2015 01:53 PM, Andy Lutomirski wrote:
> Egads. Now I understand what that code is. I don't like the balign,
> since this has nothing to do with alignment -- we're creating an array
> of functions.
Actually it does... we align to the beginning of each slot. If .balign
could be something other than a power of 2 that would work, too.
I was mostly looking to minimize the amount of gas magic we rely on.
> Can't we make it explicit?
>
> #define EARLY_IDT_HANDLER_STRIDE 9
>
> ...
>
> .rept NUM_EXCEPTION_VECTORS
> . = early_idt_handlers + i * EARLY_IDT_HANDLER_STRIDE
> .if (EXCEPTION_ERRCODE_MASK >> i) & 1
> ASM_NOP2
> .else
> pushl $0 # Dummy error code, to make stack frame uniform
> .endif
> pushl $i # 20(%esp) Vector number
> jmp early_idt_handler
> i = i + 1
> .endr
>
> gas will error out if we try to move . backwards, so this should be safe.
If that works too with all the versions of gas we care about, that would
be fine (and I do appreciate the explicitness.) However, .[b]align is
something that will have been well exercised in every version of gas, so
I do feel slightly safer with it.
-hpa
next prev parent reply other threads:[~2015-05-20 21:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 6:02 Avoiding unnecessary jump relocations in gas? Andy Lutomirski
2015-05-07 11:52 ` Jan Beulich
2015-05-07 16:21 ` H.J. Lu
2015-05-08 3:22 ` Andy Lutomirski
2015-05-08 12:09 ` H.J. Lu
2015-05-08 20:16 ` H.J. Lu
2015-05-18 19:36 ` Andy Lutomirski
2015-05-18 20:01 ` H. Peter Anvin
2015-05-18 20:11 ` Borislav Petkov
2015-05-18 20:02 ` H.J. Lu
2015-05-18 20:06 ` H. Peter Anvin
2015-05-18 20:25 ` H.J. Lu
2015-05-18 20:28 ` H. Peter Anvin
2015-05-18 20:34 ` H. Peter Anvin
2015-05-20 20:53 ` Andy Lutomirski
2015-05-20 20:59 ` H. Peter Anvin [this message]
2015-05-20 21:47 ` Andy Lutomirski
2015-05-20 21:58 ` H. Peter Anvin
2015-05-20 22:08 ` H. Peter Anvin
2015-05-20 22:17 ` Andy Lutomirski
2015-05-20 22:21 ` H. Peter Anvin
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=555CF5B7.8080709@zytor.com \
--to=hpa@zytor.com \
--cc=JBeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=bp@alien8.de \
--cc=hjl.tools@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox