about summary refs log tree commit diff
path: root/pkgs/by-name/_9/_9base/getcallerpc-use-macro-or-stub.patch
blob: d7047a9a997b9a80e460c47f1d07a0439c1f5a87 (plain) (blame)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
diff --git a/lib9/Makefile b/lib9/Makefile
index b83ab2b..2836b38 100644
--- a/lib9/Makefile
+++ b/lib9/Makefile
@@ -145,7 +145,7 @@ LIB9OFILES=\
 	exitcode.o\
 	fcallfmt.o\
 	get9root.o\
-	getcallerpc-$(OBJTYPE).o\
+	getcallerpc.o\
 	getenv.o\
 	getfields.o\
 	getnetconn.o\
diff --git a/lib9/getcallerpc-386.c b/lib9/getcallerpc-386.c
deleted file mode 100644
index 1367370..0000000
--- a/lib9/getcallerpc-386.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <lib9.h>
-
-ulong
-getcallerpc(void *x)
-{
-	return (((ulong*)(x))[-1]);
-}
diff --git a/lib9/getcallerpc-PowerMacintosh.c b/lib9/getcallerpc-PowerMacintosh.c
deleted file mode 100644
index 679a72c..0000000
--- a/lib9/getcallerpc-PowerMacintosh.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <lib9.h>
-
-ulong
-getcallerpc(void *x)
-{
-	return (((ulong*)(x))[-4]);
-}
diff --git a/lib9/getcallerpc-arm.c b/lib9/getcallerpc-arm.c
deleted file mode 100644
index 9bb4a95..0000000
--- a/lib9/getcallerpc-arm.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <lib9.h>
-
-ulong
-getcallerpc(void *x)
-{
-	return ((ulong*)x)[-2];
-}
-
diff --git a/lib9/getcallerpc-power.c b/lib9/getcallerpc-power.c
deleted file mode 100644
index b4bf698..0000000
--- a/lib9/getcallerpc-power.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib9.h>
-
-ulong
-getcallerpc(void *x)
-{
-	ulong *lp;
-
-	lp = x;
-
-	return lp[-1];
-}
diff --git a/lib9/getcallerpc-ppc.c b/lib9/getcallerpc-ppc.c
deleted file mode 100644
index 679a72c..0000000
--- a/lib9/getcallerpc-ppc.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <lib9.h>
-
-ulong
-getcallerpc(void *x)
-{
-	return (((ulong*)(x))[-4]);
-}
diff --git a/lib9/getcallerpc-x86_64.c b/lib9/getcallerpc-x86_64.c
deleted file mode 100644
index 1367370..0000000
--- a/lib9/getcallerpc-x86_64.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <lib9.h>
-
-ulong
-getcallerpc(void *x)
-{
-	return (((ulong*)(x))[-1]);
-}
diff --git a/lib9/getcallerpc.c b/lib9/getcallerpc.c
new file mode 100644
index 0000000..7d2cdd7
--- /dev/null
+++ b/lib9/getcallerpc.c
@@ -0,0 +1,12 @@
+#include <lib9.h>
+
+/*
+ * On gcc and clang, getcallerpc is a macro invoking a compiler builtin.
+ * If the macro in libc.h did not trigger, there's no implementation.
+ */
+#undef getcallerpc
+ulong
+getcallerpc(void *v)
+{
+	return 1;
+}
\ No newline at end of file