iPXE
compiler.h
Go to the documentation of this file.
1#ifndef _BITS_COMPILER_H
2#define _BITS_COMPILER_H
3
4FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5
6/** Dummy relocation type */
7#define RELOC_TYPE_NONE R_386_NONE
8
9#ifndef ASSEMBLY
10
11/** Unprefixed constant operand modifier */
12#define ASM_NO_PREFIX "c"
13
14/** Declare a function with standard calling conventions */
15#define __asmcall __attribute__ (( cdecl, regparm(0) ))
16
17/**
18 * Declare a function with libgcc implicit linkage
19 *
20 * It seems as though gcc expects its implicit arithmetic functions to
21 * be cdecl, even if -mrtd is specified. This is somewhat
22 * inconsistent; for example, if -mregparm=3 is used then the implicit
23 * functions do become regparm(3).
24 *
25 * The implicit calls to memcpy() and memset() which gcc can generate
26 * do not seem to have this inconsistency; -mregparm and -mrtd affect
27 * them in the same way as any other function.
28 *
29 * Update (25/4/14): it appears that more recent gcc versions do allow
30 * -mrtd to affect calls to the implicit arithmetic functions. There
31 * is nothing obvious in the gcc changelogs to indicate precisely when
32 * this happened. From experimentation with available gcc versions,
33 * the change occurred sometime between v4.6.3 and v4.7.2. We assume
34 * that only versions up to v4.6.x require the special treatment.
35 */
36#if ( __GNUC__ < 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ <= 6 ) )
37#define __libgcc __attribute__ (( cdecl ))
38#else
39#define __libgcc
40#endif
41
42#endif /* ASSEMBLY */
43
44#endif /* _BITS_COMPILER_H */
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896