Re: ARM EABI version 5 and bpabi.o

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/16/2011 09:41 AM, Sebastian Huber wrote:
> On 03/14/2011 03:14 PM, Andrew Haley wrote:
>> On 03/14/2011 12:02 PM, Sebastian Huber wrote:
>>> Hello,
>>>
>>> the object file bpabi.o is part of libgcc.  It is compiled with the option
>>> -fexceptions.  Does anyone know why we need exceptions here?
>>
>> __divdi3 can throw an exception.  I don't know whether it does on ARM,
>> but it does on other processors.
>>
>> Andrew.
> 
> Thanks for the hint.  How can an assembler or C function throw an exception?  I
> am absolutely not sure how this low-level stuff works in detail, but it seems
> to me from a look at libgcc/Makefile.in that this -fexceptions is used for all
> targets?  I currently try to prepare a RTEMS GCC for ARM to use the ARM EABI
> version 5.  Now I have the problem that an innocent looking
> 
> int64_t f(int64_t a, int64_t b)
> {
> 	return a / b;
> }
> 
> will pull in the hole unwind mechanic that accounts for 10kByte of Thumb code.
>  This might be a problem for small target systems.
> 

In "gcc/config/arm/lib1funcs.asm" is this the code that is supposed to throw an
exception:

/* ------------------------------------------------------------------------ */
#ifdef L_dvmd_tls

#ifdef __ARM_EABI__
	WEAK aeabi_idiv0
	WEAK aeabi_ldiv0
	FUNC_START aeabi_idiv0
	FUNC_START aeabi_ldiv0
	RET
	FUNC_END aeabi_ldiv0
	FUNC_END aeabi_idiv0
#else
	FUNC_START div0
	RET
	FUNC_END div0
#endif
	
#endif /* L_divmodsi_tools */
/* ------------------------------------------------------------------------ */
#ifdef L_dvmd_lnx
@ GNU/Linux division-by zero handler.  Used in place of L_dvmd_tls

/* Constant taken from <asm/signal.h>.  */
#define SIGFPE	8

#ifdef __ARM_EABI__
	WEAK aeabi_idiv0
	WEAK aeabi_ldiv0
	ARM_FUNC_START aeabi_idiv0
	ARM_FUNC_START aeabi_ldiv0
#else
	ARM_FUNC_START div0
#endif

	do_push	{r1, lr}
	mov	r0, #SIGFPE
	bl	SYM(raise) __PLT__
	RETLDM	r1

#ifdef __ARM_EABI__
	FUNC_END aeabi_ldiv0
	FUNC_END aeabi_idiv0
#else
	FUNC_END div0
#endif

?

Does this mean that only on GNU/Linux we need this unwind stuff?

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@xxxxxxxxxxxxxxxxxx
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux