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.3KB

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