[PATCH] Remove nested function in elf/dl-lookup.c.

Florian Weimer fweimer@redhat.com
Thu Feb 13 09:49:00 GMT 2014


On 02/13/2014 03:26 AM, Rich Felker wrote:

> I completely agree that removing nested functions improves
> readability. The first time I saw this code it was a pain to make
> sense of it. I do not think most people are familiar with GCC nested
> functions, and they are unsafe to use unless you can be sure that they
> will be inlined (if not, they require executable stack)

The situation is not as dire as you paint it.  A trampoline is only 
needed if the address of the function is taken.  Non-inlined direct 
calls are fine and handled with an implicit frame argument, something 
that is not possible with indirect calls (except on architectures with 
function descriptors).

That doesn't mean I'm in favor of keeping inline functions.  They are 
one of the more obscure GCC extensions.  They increase readability if 
they are used consistently and regularly, but a few isolated cases seem 
to have the opposite effect.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Libc-alpha mailing list