linkage.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * U-Boot - linkage.h
  3. *
  4. * Copyright (c) 2005-2007 Analog Devices Inc.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef _LINUX_LINKAGE_H
  9. #define _LINUX_LINKAGE_H
  10. #include <asm/linkage.h>
  11. /* Some toolchains use other characters (e.g. '`') to mark new line in macro */
  12. #ifndef ASM_NL
  13. #define ASM_NL ;
  14. #endif
  15. #ifdef __cplusplus
  16. #define CPP_ASMLINKAGE extern "C"
  17. #else
  18. #define CPP_ASMLINKAGE
  19. #endif
  20. #ifndef asmlinkage
  21. #define asmlinkage CPP_ASMLINKAGE
  22. #endif
  23. #define SYMBOL_NAME_STR(X) #X
  24. #define SYMBOL_NAME(X) X
  25. #ifdef __STDC__
  26. #define SYMBOL_NAME_LABEL(X) X##:
  27. #else
  28. #define SYMBOL_NAME_LABEL(X) X:
  29. #endif
  30. #ifndef __ALIGN
  31. #define __ALIGN .align 4
  32. #endif
  33. #ifndef __ALIGN_STR
  34. #define __ALIGN_STR ".align 4"
  35. #endif
  36. #ifdef __ASSEMBLY__
  37. #define ALIGN __ALIGN
  38. #define ALIGN_STR __ALIGN_STR
  39. #define LENTRY(name) \
  40. ALIGN ASM_NL \
  41. SYMBOL_NAME_LABEL(name)
  42. #define ENTRY(name) \
  43. .globl SYMBOL_NAME(name) ASM_NL \
  44. LENTRY(name)
  45. #define WEAK(name) \
  46. .weak SYMBOL_NAME(name) ASM_NL \
  47. LENTRY(name)
  48. #ifndef END
  49. #define END(name) \
  50. .size name, .-name
  51. #endif
  52. #ifndef ENDPROC
  53. #define ENDPROC(name) \
  54. .type name STT_FUNC ASM_NL \
  55. END(name)
  56. #endif
  57. #endif
  58. #endif