1 Fix this compile error:
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,
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); \
14 unwind.c:490:3: note: in expansion of macro 'FILL_CONTEXT'
15 490 | FILL_CONTEXT ((&context));
17 ----------------------
18 --- a/gprofng/common/cpuid.c
19 +++ b/gprofng/common/cpuid.c
21 #elif defined(__aarch64__)
22 #define ATTRIBUTE_UNUSED __attribute__((unused))
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 @@ -233,7 +233,7 @@ memory_error_func (int status ATTRIBUTE_
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); \
40 @@ -4579,11 +4579,11 @@ stack_unwind (char *buf, int size, void
41 if (buf && bptr && eptr && context && size + mode > 0)
42 getByteInstruction ((unsigned char *) eptr);
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;
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;
57 @@ -4594,7 +4594,7 @@ stack_unwind (char *buf, int size, void
59 stack_base = sp + 0x100000;
60 if (stack_base < sp) // overflow
61 - stack_base = (__u64) -1;
62 + stack_base = (uint64_t) -1;
64 DprintfT (SP_DUMP_UNWIND,
65 "unwind.c:%d stack_unwind %2d pc=0x%llx sp=0x%llx stack_base=0x%llx\n",
66 @@ -4625,17 +4625,17 @@ stack_unwind (char *buf, int size, void
67 __LINE__, (unsigned long) sp);
70 - pc = ((__u64 *) sp)[1];
72 - sp = ((__u64 *) sp)[0];
73 + pc = ((uint64_t *) sp)[1];
74 + uint64_t old_sp = sp;
75 + sp = ((uint64_t *) sp)[0];
82 - lbuf[ind++] = (__u64) SP_TRUNC_STACK_MARKER;
83 + lbuf[ind++] = (uint64_t) SP_TRUNC_STACK_MARKER;
85 - return ind * sizeof (__u64);
86 + return ind * sizeof (uint64_t);