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

J. Tang tang at jtang.org
Tue Feb 7 02:51:26 UTC 2017


> 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.

-- 
Jason Tang  /  tang at jtang.org




More information about the U-Boot mailing list