lib9: remove getcallerpc implementations

These make no sense and are not really needed at all.
Add a best-effort attempt to get at the gcc/clang macro
in lib9.h, but if it fails, no big deal.

Fixes #324.
This commit is contained in:
Russ Cox 2020-01-07 15:31:01 -05:00
parent 2897735523
commit 540caa5873
9 changed files with 15 additions and 66 deletions

View file

@ -385,6 +385,9 @@ extern int exitcode(char*);
extern void exits(char*);
extern double frexp(double, int*);
extern ulong getcallerpc(void*);
#if defined(__GNUC__) || defined(__clang__)
#define getcallerpc(x) ((ulong)__builtin_return_address(0))
#endif
extern char* p9getenv(char*);
extern int p9putenv(char*, char*);
extern int getfields(char*, char**, int, int, char*);

View file

@ -1,7 +0,0 @@
#include <lib9.h>
ulong
getcallerpc(void *x)
{
return (((ulong*)(x))[-1]);
}

View file

@ -1,8 +0,0 @@
#include <lib9.h>
ulong
getcallerpc(void *x)
{
return ((ulong*)x)[-2];
}

View file

@ -1,8 +0,0 @@
#include <lib9.h>
ulong
getcallerpc(void *x)
{
return ((ulong*)x)[-2];
}

View file

@ -1,8 +0,0 @@
#include <lib9.h>
ulong
getcallerpc(void *x)
{
return ((ulong*)x)[-2];
}

View file

@ -1,11 +0,0 @@
#include <lib9.h>
ulong
getcallerpc(void *x)
{
ulong *lp;
lp = x;
return lp[-1];
}

View file

@ -1,5 +0,0 @@
.text
.globl getcallerpc
getcallerpc:
retl
or %o7, %r0, %o0

View file

@ -1,7 +0,0 @@
#include <lib9.h>
ulong
getcallerpc(void *x)
{
return (((ulong*)(x))[-1]);
}

View file

@ -104,7 +104,7 @@ LIB9OFILES=\
fcallfmt.$O\
frand.$O\
get9root.$O\
getcallerpc-$OBJTYPE.$O\
getcallerpc.$O\
getenv.$O\
getfields.$O\
getnetconn.$O\