This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Invalid program counters and unwinding


On 06/26/2018 07:21 AM, Florian Weimer wrote:

GCC doesn't do this AFAIK, but it's theoretically possible not to preserve the return address for a noreturn function.  But that would be very bad for exception handling, so let's hope compilers don't do this.

I'd forgotten about noreturn. Such functions may terminate by throwing an exception (and for our purposes I think pthread_cancel implementatio is sufficiently exception-like):

from C++ std: [dcl.attr.noreturn]/2 [ Note: The function may terminate by throwing an exception. — end note ]

and from doc/extend.texi:

The @code{noreturn} keyword does not affect the exceptional path
when that applies: a @code{noreturn}-marked function may still
return to the caller by throwing an exception or calling
@code{longjmp}.

IIRC, in gcc-land you have to give both noreturn and nothrow attributes to make it non-unwindable.

nathan
--
Nathan Sidwell


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