001-replace-attribute_const.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Fix this compile error:
  2. ----------------------
  3. ./../common/cpuid.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__get_cpuid'
  4. 27 | __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
  5. | ^~~~~~~~~~~
  6. ----------------------
  7. and this error:
  8. ----------------------
  9. unwind.c: In function '__collector_ext_return_address':
  10. unwind.c:236:34: error: '__u64' undeclared (first use in this function)
  11. 236 | context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
  12. | ^~~~~
  13. unwind.c:490:3: note: in expansion of macro 'FILL_CONTEXT'
  14. 490 | FILL_CONTEXT ((&context));
  15. ----------------------
  16. --- a/gprofng/common/cpuid.c
  17. +++ b/gprofng/common/cpuid.c
  18. @@ -23,7 +23,7 @@
  19. #elif defined(__aarch64__)
  20. #define ATTRIBUTE_UNUSED __attribute__((unused))
  21. -static inline uint_t __attribute_const__
  22. +static inline uint_t __attribute__((__const__))
  23. __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
  24. unsigned int *ebx ATTRIBUTE_UNUSED,
  25. unsigned int *ecx ATTRIBUTE_UNUSED, unsigned int *edx ATTRIBUTE_UNUSED)
  26. --- a/gprofng/libcollector/unwind.c
  27. +++ b/gprofng/libcollector/unwind.c
  28. @@ -237,7 +237,7 @@ typedef uint64_t __u64;
  29. #define FILL_CONTEXT(context) \
  30. { CALL_UTIL (getcontext) (context); \
  31. - context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
  32. + context->uc_mcontext.sp = (uint64_t) __builtin_frame_address(0); \
  33. }
  34. #endif /* ARCH() */
  35. @@ -4583,11 +4583,11 @@ stack_unwind (char *buf, int size, void
  36. if (buf && bptr && eptr && context && size + mode > 0)
  37. getByteInstruction ((unsigned char *) eptr);
  38. int ind = 0;
  39. - __u64 *lbuf = (void *) buf;
  40. - int lsize = size / sizeof (__u64);
  41. - __u64 pc = context->uc_mcontext.pc;
  42. - __u64 sp = context->uc_mcontext.sp;
  43. - __u64 stack_base;
  44. + uint64_t *lbuf = (void *) buf;
  45. + int lsize = size / sizeof (uint64_t);
  46. + uint64_t pc = context->uc_mcontext.pc;
  47. + uint64_t sp = context->uc_mcontext.sp;
  48. + uint64_t stack_base;
  49. unsigned long tbgn = 0;
  50. unsigned long tend = 0;
  51. @@ -4598,7 +4598,7 @@ stack_unwind (char *buf, int size, void
  52. {
  53. stack_base = sp + 0x100000;
  54. if (stack_base < sp) // overflow
  55. - stack_base = (__u64) -1;
  56. + stack_base = (uint64_t) -1;
  57. }
  58. DprintfT (SP_DUMP_UNWIND,
  59. "unwind.c:%d stack_unwind %2d pc=0x%llx sp=0x%llx stack_base=0x%llx\n",
  60. @@ -4629,17 +4629,17 @@ stack_unwind (char *buf, int size, void
  61. __LINE__, (unsigned long) sp);
  62. break;
  63. }
  64. - pc = ((__u64 *) sp)[1];
  65. - __u64 old_sp = sp;
  66. - sp = ((__u64 *) sp)[0];
  67. + pc = ((uint64_t *) sp)[1];
  68. + uint64_t old_sp = sp;
  69. + sp = ((uint64_t *) sp)[0];
  70. if (sp < old_sp)
  71. break;
  72. }
  73. if (ind >= lsize)
  74. {
  75. ind = lsize - 1;
  76. - lbuf[ind++] = (__u64) SP_TRUNC_STACK_MARKER;
  77. + lbuf[ind++] = (uint64_t) SP_TRUNC_STACK_MARKER;
  78. }
  79. - return ind * sizeof (__u64);
  80. + return ind * sizeof (uint64_t);
  81. }
  82. #endif /* ARCH() */