[U-Boot] [BUG] x86: invalid size calculations in interrupts.c with newer GCC

Bin Meng bmeng.cn at gmail.com
Fri Feb 10 01:40:25 UTC 2017


On Tue, Feb 7, 2017 at 10:51 AM, J. Tang <tang at jtang.org> wrote:
>
>> On 2017-02-06, at 01:35, Bin Meng <bmeng.cn at gmail.com> wrote:
>>
>> +Simon,
>>
>> I do not have a GCC5 toolchain to test this. I suspect this is only
>> exposed with GCC5, or GCC 5.4? Is there any parameter to control the
>> behavior?
>
> I observed a similar behavior with GCC 5.3.
>
> As an experiment, I disabled CONFIG_CC_OPTIMIZE_FOR_SIZE. This did not change the sizes; the handler for IRQs 0 through 19 were still 4 bytes while the rest were 7 bytes.
>
> Although I am not an expert x86 assembly writer, I was able to force the assembler to generate 32-bit jumps with the following:
>
> diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
> index 5f6cdd3..9917d09 100644
> --- a/arch/x86/cpu/interrupts.c
> +++ b/arch/x86/cpu/interrupts.c
> @@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
>         ".type irq_"#x", @function\n" \
>         "irq_"#x":\n" \
>         "pushl $"#x"\n" \
> -       "jmp irq_common_entry\n"
> +       "jmp.d32 irq_common_entry\n"
>
>  static char *exceptions[] = {
>         "Divide Error",
>
> This worked for both GCC 5.4 and 4.9.
>

Looks good. Can you prepare a patch?

Regards,
Bin


More information about the U-Boot mailing list