mauiaaron / linux-syscall-support

Automatically exported from code.google.com/p/linux-syscall-support
3 stars 0 forks source link

google-breakpad fails to build in thumb mode on ARM #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
to reproduce (on ChromeOS) do:
CFLAGS="-mthumb" CXXFLAGS="-mthumb" emerge-tegra2_seaboard google-breakpad

I'm sure it is simple enough to reproduce outside of ChromeOS.

The error given is:
armv7a-cros-linux-gnueabi-g++ -DHAVE_CONFIG_H -I. -I./src  -I./src   -Wa
,-mimplicit-it=always -DVCSID=\"480a20a3d015744787a07023a17ef94d1305357c\" -O0 -
MT src/client/linux/handler/exception_handler.o -MD -MP -MF $depbase.Tpo -c -o s
rc/client/linux/handler/exception_handler.o src/client/linux/handler/exception_h
andler.cc &&\
        mv -f $depbase.Tpo $depbase.Po
In file included from ./src/common/memory.h:44,
                 from src/client/linux/handler/exception_handler.cc:94:
./src/third_party/lss/linux_syscall_support.h: In function 'int sys_clone(int (*
)(void*), void*, int, void*, int*, void*, int*)':   
./src/third_party/lss/linux_syscall_support.h:2185: error: r7 cannot be used in 
asm here

The problem is that in thumb mode, r7 is used to store the frame-pointer.

Original issue reported on code.google.com by raymes@chromium.org on 19 Apr 2011 at 12:35

GoogleCodeExporter commented 8 years ago
Hi, I'm from chromeos toolchain team, we need this to be fixed for debugging 
purpose.

I propose a patch here. Could anyone take a look at it?

Detail diagnose - the syscall number is passed through r7 in the linux ARM ABI, 
but r7 is also the THUMB frame pointer.The generic syscall template 
pushes/stores to/pops
r7 with no complaint from gcc, but the sys_clone() function marks r7 as a 
clobbered register yet gcc error's. The release build does not err because 
"-fomit-frame-pointer" is enabled.

What my patch does is to add push/pop {r7} when compiling for thumb2 at the 
beginning and end of the function and remove r7 from clobber list.

Original comment by shen...@google.com on 22 Oct 2012 at 11:13

Attachments:

GoogleCodeExporter commented 8 years ago
Looks like a reasonable solution. Thanks for fixing this problem. Clone() is a 
particularly challenging function to get right, because of how it sets up the 
stack for the child; but I believe your change is in fact correct.

I committed the patch for you.

Original comment by markus@chromium.org on 22 Oct 2012 at 11:54

GoogleCodeExporter commented 8 years ago
Hi Markus, thanks!

Original comment by shen...@google.com on 23 Oct 2012 at 4:19