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