csu: restore crt1.o symlink
[minix.git] / include / minix / compiler.h
blob75b5d6350261eb6477a49bdeecf163c4a890d557
1 /* Definitions for compiler-specific features. */
3 #ifndef _MINIX_COMPILER_H
4 #define _MINIX_COMPILER_H
6 /*===========================================================================*
7 * Compiler overrides *
8 *===========================================================================*/
9 /* ACK */
10 #ifdef __ACK__
11 #include <minix/compiler-ack.h>
12 #endif
14 /*===========================================================================*
15 * Default values *
16 *===========================================================================*/
18 * cdecl calling convention expects the callee to pop the hidden pointer on
19 * struct return. For example, GCC and LLVM comply with this (tested on IA32).
21 #ifndef BYTES_TO_POP_ON_STRUCT_RETURN
22 #define BYTES_TO_POP_ON_STRUCT_RETURN $4
23 #endif
26 * cdecl calling convention requires to push arguments on the stack in a
27 * reverse order to easily support variadic arguments. Thus, instead of
28 * using the proper stdarg.h macros (that nowadays are
29 * compiler-dependant), it may be tempting to directly take the address of
30 * the last argument and considering it as the start of an array. This is
31 * a shortcut that avoid looping to get all the arguments as the CPU
32 * already pushed them on the stack before the call to the function.
34 * Unfortunately, such an assumption is strictly compiler-dependant and
35 * compilers are free to move the last argument on the stack, as a local
36 * variable, and return the address of the location where the argument was
37 * stored, if asked for. This will break things as the rest of the array's
38 * argument are stored elsewhere (typically, a couple of words above the
39 * location where the argument was stored).
41 * Conclusion: if unsure on what the compiler may do, do not make any
42 * assumption and use the right (typically compiler-dependant) macros.
45 #ifndef FUNC_ARGS_ARRAY
46 #define FUNC_ARGS_ARRAY 0
47 #endif
49 #endif /* _MINIX_COMPILER_H */