[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/24226] Need advise on the binutils problem that generating wrong

From: wilson at gcc dot gnu.org
Subject: [Bug ld/24226] Need advise on the binutils problem that generating wrong instruction like lw a3,-2048(a5) on RISC-V backend
Date: Tue, 19 Feb 2019 19:24:05 +0000


--- Comment #4 from Jim Wilson <wilson at gcc dot gnu.org> ---
Yes, I'd call this a compiler bug.  It is triggered when we have a long long
inside a packed structure compiled for a 32-bit target, where the long long
must be partially contained in the first word of the struct, in which case the
long long has a 1 in 1K chance of getting an address that will generate an
overflow when resolving relocations.  That would explain why I haven't seen it
before.  Too many low chance conditions to trigger easily.  The same problem
could occur for a 64-bit target with a 128-bit type in a packed struct, but
that is probably even more rare.

There is still a linker issue here, in that the linker should generate an error
when the reloc overflows and computes the wrong address.

You can work around the compiler bug by forcing the variable to have 8-byte
alignment.  This can be done with an attribute
struct S0 g_3030 __attribute__ ((aligned(8))) = {0,-9L,-0,-22553,7,-841,1};
But that may be impractical if you have no easy way to identify the variables
that need to be "fixed" to avoid the compiler problem.

The compiler bug needs to be reported into the gcc bugzilla so it can be fixed

You are receiving this mail because:
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]