On 28.04.2012 12:06, Bean wrote: > 2012/4/28 Vladimir 'φ-coder/phcoder' Serbinenko <phco...@gmail.com>: >> On 27.04.2012 20:36, Vladimir 'φ-coder/phcoder' Serbinenko wrote: >>> On 27.04.2012 16:05, Albert Zeyer wrote: >>>> * Write a simplified compile.py script. >>> We don't have any compile.py. >>>> * Remove nested functions. They don't work on Mac because of stack >>>> execution protection. >>> It can be disabled. It's Apple fault for not allowing to disable it >>> selectively. Replacing nested functions is possible if done properly but >>> the "let's make it all static" is wrong and will create problems with >>> recursion, i.a. with nested partitions. >> And actually nested functions don't matter. What does are trampolines >> and they are only emitted it nested functions access local variables of >> parent and not inlined. > Hi, > > I think mac is not alone, netbsd uses non-executable stack and heap as > well. Anyway, lower system security just to run an application does > seem a little undesirable. NetBSD allows to enable and disable heap execution at runtime using __enable_executable_stack which is called by GCC automatically when emitting trampolines. > I once wrote a small framework to get rid of the nasty trampolines, for > example: > > #define DEFINE_CLOSURE struct __closure_struct { > #define DEFINE_CLOSURE_END } __closure_data; > #define CLOSURE_TYPE void *__closure void has a disadvantage of not checking the alignment. It's better to use opaque structs. > #define CLOSURE __closure > #define CLOSURE_DATA &__closure_data > #define USE_CLOSURE struct __closure_struct *__closure_p = __closure; > #define UNUSED_CLOSURE (void) __closure; We systematically use __attribute__ ((unused)) This is a good way of doing things when there is no other option. However, in many cases it's better to use macros like FOR_*. They also result in smaller code. The major point where it can't be done is with ->dir but this interface should be changed anyway because it forces some code to scan through directory just to e.g. find out mtime of a single file.
-- Regards Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel