Hello, On Wed, Jun 21, 2017 at 09:09:41AM +0200, Uwe Kleine-König wrote: > On Sun, May 14, 2017 at 12:09:42AM +0300, Jussi Pakkanen wrote: > > Package: gcc > > Version: 6.3.0-4 > > > > Gcc creates binaries that fail with "invalid instruction". To > > reproduce create the following main.c: > > > > int get_retval(void); > > > > int main(int argc, char **argv) { > > return get_retval(); > > } > > > > and the following retval-arm.S > > > > .text > > .globl get_retval > > > > get_retval: > > mov r0, #0 > > bx lr > > > > Compile like this: > > > > gcc -o prog main.c retval-arm.S > > I cannot reproduce this on a Marvell Armada XP Development Board > (DB-MV784MP-GP) (i.e. abel.debian.org) using gcc 4:6.3.0-4. Can you > please provide the output of > > objdump -d > > ?
I could reproduce it on armhf now. (I picked armel before because the original report talks about rpi1.) The (relevant part of the) output looks as follows: 000005a4 <main>: 5a4: b580 push {r7, lr} 5a6: b082 sub sp, #8 5a8: af00 add r7, sp, #0 5aa: 6078 str r0, [r7, #4] 5ac: 6039 str r1, [r7, #0] 5ae: f000 f805 bl 5bc <get_retval> 5b2: 4603 mov r3, r0 5b4: 4618 mov r0, r3 5b6: 3708 adds r7, #8 5b8: 46bd mov sp, r7 5ba: bd80 pop {r7, pc} 000005bc <get_retval>: 5bc: e3a00000 mov r0, #0 5c0: e12fff1e bx lr The problem is that main() uses Thumb while get_retval() uses ARM ISA and main does "bl" to get_retval() which doesn't do the necessary interwork. Given that the used ISA is contained in the compiler artifact the linker should be able to at least error out in this case. Best regards Uwe
signature.asc
Description: PGP signature