aboutsummaryrefslogtreecommitdiffstats
path: root/package/devel/binutils/patches/001-replace-attribute_const.patch
blob: 5fd855efd1642352e1e38c006aa0a012565015d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Fix this compile error:
----------------------
./../common/cpuid.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__get_cpuid'
   27 | __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
      | ^~~~~~~~~~~
----------------------

and this error:
----------------------
unwind.c: In function '__collector_ext_return_address':
unwind.c:236:34: error: '__u64' undeclared (first use in this function)
  236 |       context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
      |                                  ^~~~~
unwind.c:490:3: note: in expansion of macro 'FILL_CONTEXT'
  490 |   FILL_CONTEXT ((&context));

----------------------
--- a/gprofng/common/cpuid.c
+++ b/gprofng/common/cpuid.c
@@ -23,7 +23,7 @@
 #elif defined(__aarch64__)
 #define ATTRIBUTE_UNUSED __attribute__((unused))
 
-static inline uint_t __attribute_const__
+static inline uint_t __attribute__((__const__))
 __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
 	     unsigned int *ebx ATTRIBUTE_UNUSED,
 	     unsigned int *ecx ATTRIBUTE_UNUSED, unsigned int *edx ATTRIBUTE_UNUSED)
--- a/gprofng/libcollector/unwind.c
+++ b/gprofng/libcollector/unwind.c
@@ -233,7 +233,7 @@ memory_error_func (int status ATTRIBUTE_
 #elif ARCH(Aarch64)
 #define FILL_CONTEXT(context) \
     { CALL_UTIL (getcontext) (context);  \
-      context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
+      context->uc_mcontext.sp = (uint64_t) __builtin_frame_address(0); \
     }
 
 #endif /* ARCH() */
@@ -4579,11 +4579,11 @@ stack_unwind (char *buf, int size, void
   if (buf && bptr && eptr && context && size + mode > 0)
     getByteInstruction ((unsigned char *) eptr);
   int ind = 0;
-  __u64 *lbuf = (void *) buf;
-  int lsize = size / sizeof (__u64);
-  __u64 pc = context->uc_mcontext.pc;
-  __u64 sp = context->uc_mcontext.sp;
-  __u64 stack_base;
+  uint64_t *lbuf = (void *) buf;
+  int lsize = size / sizeof (uint64_t);
+  uint64_t pc = context->uc_mcontext.pc;
+  uint64_t sp = context->uc_mcontext.sp;
+  uint64_t stack_base;
   unsigned long tbgn = 0;
   unsigned long tend = 0;
 
@@ -4594,7 +4594,7 @@ stack_unwind (char *buf, int size, void
     {
       stack_base = sp + 0x100000;
       if (stack_base < sp)  // overflow
-	stack_base = (__u64) -1;
+	stack_base = (uint64_t) -1;
     }
   DprintfT (SP_DUMP_UNWIND,
     "unwind.c:%d stack_unwind %2d pc=0x%llx  sp=0x%llx  stack_base=0x%llx\n",
@@ -4625,17 +4625,17 @@ stack_unwind (char *buf, int size, void
 		      __LINE__, (unsigned long) sp);
 	    break;
 	  }
-      pc = ((__u64 *) sp)[1];
-      __u64 old_sp = sp;
-      sp = ((__u64 *) sp)[0];
+      pc = ((uint64_t *) sp)[1];
+      uint64_t old_sp = sp;
+      sp = ((uint64_t *) sp)[0];
       if (sp < old_sp)
 	break;
     }
   if (ind >= lsize)
     {
       ind = lsize - 1;
-      lbuf[ind++] = (__u64) SP_TRUNC_STACK_MARKER;
+      lbuf[ind++] = (uint64_t) SP_TRUNC_STACK_MARKER;
     }
-  return ind * sizeof (__u64);
+  return ind * sizeof (uint64_t);
 }
 #endif /* ARCH() */