[cfe-commits] r141803 - in /cfe/trunk: include/clang/Basic/Builtins.def include/clang/Basic/Builtins.h lib/AST/DeclPrinter.cpp lib/CodeGen/CGCall.cpp lib/Sema/SemaDecl.cpp test/Analysis/security-syntax-checks.m test/CodeGen/function-attributes.c

Joerg Sonnenberger joerg at britannica.bec.de
Mon Oct 17 08:11:47 PDT 2011

On Mon, Oct 17, 2011 at 10:51:09AM -0400, Rafael Ávila de Espíndola wrote:
> > void savectx(struct pcb *);
> >
> > Does that sound like anything with a relation to setjmp?
> The only relation important in here is returning twice.
> > I don't believe in cargo cult programming, so this doesn't exactly sound
> > like a good reason for keeping it.
> In which case gcc can drop it too. Since these are usually obscure 
> functions, it in nice to ask there too.

Agreed. Getting GCC to adopt any kind of changes can be non-trivial

> >> What does savectx do on your system?
> >
> > It's an internal function, used to synchronise some data structure
> > before creating a new thread, exposed to userland for various (slightly
> > broken...) reasons.
> Do you have a pointer? Looking around and asking on #gcc, it looks like 
> it is just a BSD version of
> int getcontext(ucontext_t *ucp);
> so it does return twice. The data structure being the continuation so 
> that user space threads can be implemented.

It's not that simply. On most architectures it is literally only used to
ensure that a consistent snapshot of the register state is present for
debugging. It really doesn't mean it needs the return twice semantic.

> Given that it does look like the correct fix is to correct the signature 
> in Builtins.def.

It doesn't add *any* value. The kernel itself is built with
-ffreestanding, so the builtin doesn't apply anyway.


More information about the cfe-commits mailing list