nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/lib9/Makefile b/lib9/Makefile
2index b83ab2b..2836b38 100644
3--- a/lib9/Makefile
4+++ b/lib9/Makefile
5@@ -145,7 +145,7 @@ LIB9OFILES=\
6 exitcode.o\
7 fcallfmt.o\
8 get9root.o\
9- getcallerpc-$(OBJTYPE).o\
10+ getcallerpc.o\
11 getenv.o\
12 getfields.o\
13 getnetconn.o\
14diff --git a/lib9/getcallerpc-386.c b/lib9/getcallerpc-386.c
15deleted file mode 100644
16index 1367370..0000000
17--- a/lib9/getcallerpc-386.c
18+++ /dev/null
19@@ -1,7 +0,0 @@
20-#include <lib9.h>
21-
22-ulong
23-getcallerpc(void *x)
24-{
25- return (((ulong*)(x))[-1]);
26-}
27diff --git a/lib9/getcallerpc-PowerMacintosh.c b/lib9/getcallerpc-PowerMacintosh.c
28deleted file mode 100644
29index 679a72c..0000000
30--- a/lib9/getcallerpc-PowerMacintosh.c
31+++ /dev/null
32@@ -1,7 +0,0 @@
33-#include <lib9.h>
34-
35-ulong
36-getcallerpc(void *x)
37-{
38- return (((ulong*)(x))[-4]);
39-}
40diff --git a/lib9/getcallerpc-arm.c b/lib9/getcallerpc-arm.c
41deleted file mode 100644
42index 9bb4a95..0000000
43--- a/lib9/getcallerpc-arm.c
44+++ /dev/null
45@@ -1,8 +0,0 @@
46-#include <lib9.h>
47-
48-ulong
49-getcallerpc(void *x)
50-{
51- return ((ulong*)x)[-2];
52-}
53-
54diff --git a/lib9/getcallerpc-power.c b/lib9/getcallerpc-power.c
55deleted file mode 100644
56index b4bf698..0000000
57--- a/lib9/getcallerpc-power.c
58+++ /dev/null
59@@ -1,11 +0,0 @@
60-#include <lib9.h>
61-
62-ulong
63-getcallerpc(void *x)
64-{
65- ulong *lp;
66-
67- lp = x;
68-
69- return lp[-1];
70-}
71diff --git a/lib9/getcallerpc-ppc.c b/lib9/getcallerpc-ppc.c
72deleted file mode 100644
73index 679a72c..0000000
74--- a/lib9/getcallerpc-ppc.c
75+++ /dev/null
76@@ -1,7 +0,0 @@
77-#include <lib9.h>
78-
79-ulong
80-getcallerpc(void *x)
81-{
82- return (((ulong*)(x))[-4]);
83-}
84diff --git a/lib9/getcallerpc-x86_64.c b/lib9/getcallerpc-x86_64.c
85deleted file mode 100644
86index 1367370..0000000
87--- a/lib9/getcallerpc-x86_64.c
88+++ /dev/null
89@@ -1,7 +0,0 @@
90-#include <lib9.h>
91-
92-ulong
93-getcallerpc(void *x)
94-{
95- return (((ulong*)(x))[-1]);
96-}
97diff --git a/lib9/getcallerpc.c b/lib9/getcallerpc.c
98new file mode 100644
99index 0000000..7d2cdd7
100--- /dev/null
101+++ b/lib9/getcallerpc.c
102@@ -0,0 +1,12 @@
103+#include <lib9.h>
104+
105+/*
106+ * On gcc and clang, getcallerpc is a macro invoking a compiler builtin.
107+ * If the macro in libc.h did not trigger, there's no implementation.
108+ */
109+#undef getcallerpc
110+ulong
111+getcallerpc(void *v)
112+{
113+ return 1;
114+}
115\ No newline at end of file