This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?


-----Fredrik Hederstierna/INT/SE/DIR/SECURITAS wrote: -----
To: aph@redhat.com
From: Fredrik Hederstierna/INT/SE/DIR/SECURITAS
Date: 03/28/2012 11:33AM
Cc: gcc-help@gcc.gnu.org
Subject: Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?

>> We generate the map-file, the content tells that (if I understand correctly)
>> 
>> "_divdi3.o" ?use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
>> 
>> Is it really correct that we need unwind-support if just using division?
>> Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
>> (We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
>

>I suspect (but you'll have to check) that this is because _divdi3 is
>compiled with exceptions, and this is indeed because division by zero
>might throw. ?The simplest fix is to compile it without exceptions.
>The correct fix is to make unwinding work on your platform.

I've been investigating the libgcc sources, what do you think of something alike this solution

Today in "gcc/libgcc/Makefile.in" its filtered on which functions that should be compiled with unwind-info:

  # These might cause a divide overflow trap and so are compiled with
  # unwinder info.
  LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4

What if this could be overridden by configuration option?

Eg.

+# Check if we want to exclude unwind support.
+ifeq ($(enable_libunwind_exceptions),yes)
   # These might cause a divide overflow trap and so are compiled with
   # unwinder info.
   LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
+endif

In this case all libgcc will be build 'normally' without extra unwind build stuff?
The 'enable_libunwind_exceptions' have to be set somehow when running 'configure'.

Thanks/Fredrik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]