You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compiler.h 1.4KB

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