Bug 231108

Summary: SIGILL on startup in Thumb mode
Product: [Developer tools] valgrind Reporter: lool <lool>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: lool, peter.maydell
Priority: NOR    
Version First Reported In: 3.6 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: valgrind initial thumb fixes

Description lool@dooz.org 2010-03-17 15:38:54 UTC
Created attachment 41714 [details]
valgrind initial thumb fixes

Hey

when starting valgrind on Ubuntu armel, we were getting some SIGILLs in _start; this was due to lack of the "%function" information on the symbol as to allow the toolchain to set the CPU in the proper mode (Thumb).

I'll attach a patch which fixes this first SIGILL, and one happening immediately afterwards in vgModuleLocal_call_on_new_stack_0_1() for the same reason.

The first patch is enough to get valgrind --help to work, and the second one allows reaching the point where the disassembler barfs at unrecognized instructions.  It still doesn't work, but that seems to be going in the good direction  ;-)

I suspect a lot of .global foo / .globl foo need a .type foo, %function declaration, for instance the trampolines in coregrind/m_trampoline.S.

Of course the disassembler probably has to be told about the thumb instructions and valgrind probably has to grow tracking of thumb mode.

Cheers,
Comment 1 lool@dooz.org 2010-03-17 15:39:54 UTC
Forgot to note that Dave Martin (from ARM) did most of the analysis and the first patch; see https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/537458 for the details.
Comment 2 lool@dooz.org 2010-12-07 23:37:31 UTC
This might be fixed entirely with 3.6.0; do you want to rescue anything from the patch?

Seems to apply against 3.6.0 still
Comment 3 Peter Maydell 2010-12-08 09:31:27 UTC
Julian's answer to me about that patch was that it wasn't necessary, because 3.6.0's makefile now compiles everything with -marm. This avoids having to convert all the bits of inline ARM assembly to Thumb mode.