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
|
--- tcc-0.9.20.orig/bcheck.c
+++ tcc-0.9.20/bcheck.c
@@ -76,7 +76,9 @@
/* currently, tcc cannot compile that because we use unsupported GNU C
extensions */
-#if !defined(__TINYC__)
+#if defined(__TINYC__)
+#define __attribute__(ignore)
+#endif
void *__bound_ptr_add(void *p, int offset) __attribute__((regparm(2)));
void *__bound_ptr_indir1(void *p, int offset) __attribute__((regparm(2)));
void *__bound_ptr_indir2(void *p, int offset) __attribute__((regparm(2)));
@@ -86,7 +88,6 @@
void *__bound_ptr_indir16(void *p, int offset) __attribute__((regparm(2)));
void __bound_local_new(void *p) __attribute__((regparm(1)));
void __bound_local_delete(void *p) __attribute__((regparm(1)));
-#endif
void *__bound_malloc(size_t size, const void *caller);
void *__bound_memalign(size_t size, size_t align, const void *caller);
@@ -168,7 +169,7 @@
/* return '(p + offset)' for pointer arithmetic (a pointer can reach
the end of a region in this case */
-void *__bound_ptr_add(void *p, int offset)
+void * __attribute__((regparm(2))) __bound_ptr_add(void *p, int offset)
{
unsigned long addr = (unsigned long)p;
BoundEntry *e;
@@ -194,7 +195,8 @@
/* return '(p + offset)' for pointer indirection (the resulting must
be strictly inside the region */
#define BOUND_PTR_INDIR(dsize) \
-void *__bound_ptr_indir ## dsize (void *p, int offset) \
+void * __attribute__((regparm(2))) __bound_ptr_indir ## dsize \
+ (void *p, int offset) \
{ \
unsigned long addr = (unsigned long)p; \
BoundEntry *e; \
@@ -227,7 +229,7 @@
#endif
/* called when entering a function to add all the local regions */
-void __bound_local_new(void *p1)
+void __attribute__((regparm(1))) __bound_local_new(void *p1)
{
unsigned long addr, size, fp, *p = p1;
GET_CALLER_FP(fp);
@@ -243,7 +245,7 @@
}
/* called when leaving a function to delete all the local regions */
-void __bound_local_delete(void *p1)
+void __attribute__((regparm(1))) __bound_local_delete(void *p1)
{
unsigned long addr, fp, *p = p1;
GET_CALLER_FP(fp);
@@ -266,13 +268,14 @@
{
}
-void *__bound_ptr_add(void *p, int offset)
+void * __attribute__((regparm(2))) __bound_ptr_add(void *p, int offset)
{
return p + offset;
}
#define BOUND_PTR_INDIR(dsize) \
-void *__bound_ptr_indir ## dsize (void *p, int offset) \
+void * __attribute__((regparm(2))) __bound_ptr_indir ## dsize\
+ (void *p, int offset)\
{ \
return p + offset; \
}
|