* _Unwind_Resume() references in libgcc division functions
@ 2022-06-21 13:13 Sebastian Huber
2022-06-21 13:24 ` Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Huber @ 2022-06-21 13:13 UTC (permalink / raw)
To: GCC Development
Hello,
I noticed that several division related routines provided by libgcc such
as __divdi3, __moddi3 and __umoddi3 have references to _Unwind_Resume
for the sparc-rtems target. For example:
.file "libgcc2.c"
! GNU C17 (GCC) version 13.0.0 20220621 (experimental) [master
r13-1187-gab981aab92c] (sparc-rtems6)
! compiled by GNU C version 12.1.1 20220517 [revision
325d82b08696da17fb26bd2e1b6ba607649357fb], GMP version 6.1.0, MPFR
version 3.1.4, MPC version 1.0.3, isl version isl-0.16.1-GMP
! GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
! options passed: -msoft-float -mcpu=leon3 -g -g -g -O0 -O2 -O0
-fbuilding-libgcc -fno-stack-protector -fexceptions
-fnon-call-exceptions -fvisibility=hidden
.LLBE7:
.LLBE6:
! /home/EB/sebastian_h/src/gcc/libgcc/libgcc2.c:1225: w = __udivmoddi4
(uu.ll, vv.ll, (UDWtype *) 0);
.loc 1 1225 5
std %g2, [%fp-16] ! D.3900, w
! /home/EB/sebastian_h/src/gcc/libgcc/libgcc2.c:1226: if (c)
.loc 1 1226 6
ld [%fp-4], %g1 ! c, tmp284
cmp %g1, 0 ! tmp284,
be .LL25
nop !
b .LL28
nop !
.LL27:
mov %i0, %g1 !, tmp283
mov %g1, %o0 ! D.3909,
.LLEHB2:
call _Unwind_Resume, 0
nop !,
.LL28:
Could someone please give me a hint, why the compiler generates this
code? I was unable to figure this out by looking at the pre-processed
code. I tried to reproduce it with a simple division by zero test case,
but this didn't work:
unsigned f(unsigned i)
{
return i / 0;
}
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: _Unwind_Resume() references in libgcc division functions
2022-06-21 13:13 _Unwind_Resume() references in libgcc division functions Sebastian Huber
@ 2022-06-21 13:24 ` Jakub Jelinek
2022-06-21 13:44 ` Sebastian Huber
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2022-06-21 13:24 UTC (permalink / raw)
To: Sebastian Huber; +Cc: GCC Development
On Tue, Jun 21, 2022 at 03:13:19PM +0200, Sebastian Huber wrote:
> Hello,
>
> I noticed that several division related routines provided by libgcc such as
> __divdi3, __moddi3 and __umoddi3 have references to _Unwind_Resume for the
> sparc-rtems target. For example:
That is because:
ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
# Provide default flags for compiling divmod functions, if they haven't been
# set already by a target-specific Makefile fragment.
LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
endif
which is there so that e.g. Ada or other -fnon-call-exceptions languages can
have properly working divisions.
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: _Unwind_Resume() references in libgcc division functions
2022-06-21 13:24 ` Jakub Jelinek
@ 2022-06-21 13:44 ` Sebastian Huber
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Huber @ 2022-06-21 13:44 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Development
On 21/06/2022 15:24, Jakub Jelinek wrote:
> On Tue, Jun 21, 2022 at 03:13:19PM +0200, Sebastian Huber wrote:
>> Hello,
>>
>> I noticed that several division related routines provided by libgcc such as
>> __divdi3, __moddi3 and __umoddi3 have references to _Unwind_Resume for the
>> sparc-rtems target. For example:
>
> That is because:
>
> ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
> # Provide default flags for compiling divmod functions, if they haven't been
> # set already by a target-specific Makefile fragment.
> LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
> endif
>
> which is there so that e.g. Ada or other -fnon-call-exceptions languages can
> have properly working divisions.
Thanks for the hint. It seems also the optimization level has an impact.
The _Unwind_Resume dependency is only present if I use
CFLAGS_FOR_TARGET="-O0 -g".
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-21 13:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 13:13 _Unwind_Resume() references in libgcc division functions Sebastian Huber
2022-06-21 13:24 ` Jakub Jelinek
2022-06-21 13:44 ` Sebastian Huber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).