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 1006B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef COMPILER_H
  2. #define COMPILER_H
  3. /* We export the symbol obj_OBJECT (OBJECT is defined on command-line)
  4. * as a global symbol, so that the linker can drag in selected object
  5. * files from the library using -u obj_OBJECT.
  6. *
  7. * Not quite sure why cpp requires two levels of macro call in order
  8. * to actually expand OBJECT...
  9. */
  10. #undef _H1
  11. #define _H1( x, y ) x ## y
  12. #undef _H2
  13. #define _H2( x, y ) _H1 ( x, y )
  14. #define OBJECT_SYMBOL _H2 ( obj_, OBJECT )
  15. #undef _STR
  16. #define _STR(s) #s
  17. #undef _XSTR
  18. #define _XSTR(s) _STR(s)
  19. #define OBJECT_SYMBOL_STR _XSTR ( OBJECT_SYMBOL )
  20. #ifdef ASSEMBLY
  21. .globl OBJECT_SYMBOL
  22. .equ OBJECT_SYMBOL, 0
  23. #else /* ASSEMBLY */
  24. __asm__ ( ".globl\t" OBJECT_SYMBOL_STR );
  25. __asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
  26. #define REQUIRE_OBJECT(object) \
  27. __asm__ ( ".equ\tneed_" #object ", obj_" #object );
  28. #define PACKED __attribute__((packed))
  29. #define __unused __attribute__((unused))
  30. #define __used __attribute__((used))
  31. #endif /* ASSEMBLY */
  32. #endif /* COMPILER_H */