Your message dated Wed, 21 Jun 2017 15:58:03 +0200
with message-id <f249e8ab-0cb7-61df-1fd9-9abc5dcc4...@debian.org>
and subject line Re: Bug#862514: Gcc creates illegal instructions when
combining C + ASM on arm on sid
has caused the Debian Bug report #862514,
regarding Gcc creates illegal instructions when combining C + ASM on arm on sid
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
862514: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862514
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
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
The result crashes. However if you add -march=armv7 the executable
works (-march=native crashes also).
This only happens on GCC using the version in Sid. It works when using
any version of Clang and also when using GCC in Jessie.
Originally reported here: https://github.com/mesonbuild/meson/issues/1776
--- End Message ---
--- Begin Message ---
not a compiler bug. the get_retval symbol is untyped, so it doesn't get proper
interworking treatment. add a .type get_retval, %function directive
On 21.06.2017 10:09, Uwe Kleine-König wrote:
> 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
>
--- End Message ---