On Tue, Sep 1, 2009 at 9:42 PM, Vladimir 'phcoder'
Serbinenko<address@hidden> wrote:
Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a
bug
in compiler. Now it creates only problems. In particular if they are
used wrong it creates a bug of argument passing. Such bugs are
difficult to find because it usually results in strange behaviour and
in grub-emu NESTED_FUNC_ATTR is exteneded to an empty string so gdb
and valgrind can't detect any error. Should we perhaps remove it
coupled with adding a requirement for at least gcc 4.2? Can I run
s/NESTED_FUNC_ATTR//g; on entire codebase and remove corresponding
entry in configure.ac?
Hi,
I make an assembly dump of the code generated by gcc-4.2. Apparently,
the "FIX" is achieved by ignoring the regparm attribute at all.
__attribute__ ((__regparm__ (3))) doesn't have any effect any more, it
always pass the parameters on the stack. This defeats the original
purpose of -mregparm=3, which passes parameters using register and
therefore reduce module size. In fact, if we are going to use stack,
we could just remove -mregparm=3 option, this works for all version of
gcc.
IMO, if we are to tackle the NESTED_FUNC_ATTR issue, we should do it
properly by removing nested function, this also has other advantages,
like allowing to run tools on systems like OSX that doesn't allow to
execute code in stack by default.