From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755869AbbETVDp (ORCPT ); Wed, 20 May 2015 17:03:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39826 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755368AbbETVAC (ORCPT ); Wed, 20 May 2015 17:00:02 -0400 Message-ID: <555CF5B7.8080709@zytor.com> Date: Wed, 20 May 2015 13:59:35 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andy Lutomirski CC: "H.J. Lu" , Borislav Petkov , Jan Beulich , Binutils , "linux-kernel@vger.kernel.org" Subject: Re: Avoiding unnecessary jump relocations in gas? References: <554B6E0102000078000778D0@mail.emea.novell.com> <555A4628.4060802@zytor.com> <555A4B67.4080201@zytor.com> <555A4CCC.2010102@zytor.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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