Fix the implementations of PSEUDO_NOERROR and PSEUDO.

The PSEUDO* macros should not declare <syscall>, only _<syscall> and
__sys_<syscall>.  This was causing the interposing C wrappers to be
ignored due to link order.

This should fix open() in CheriABI and is required to fix ioctl().
This commit is contained in:
Brooks Davis 2015-11-06 01:35:31 +00:00
parent 5c67e3314a
commit 4e8e13c90f

View File

@ -106,19 +106,6 @@
* Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
*/
#define RSYSCALL_NOERROR(x) \
PSEUDO_NOERROR(x)
/*
* Do a normal syscall.
*/
#define RSYSCALL(x) \
PSEUDO(x)
/*
* Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
* and syscall name are not the same.
*/
#define PSEUDO_NOERROR(x) \
LEAF(__sys_ ## x); \
.weak _C_LABEL(x); \
_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
@ -128,7 +115,10 @@ LEAF(__sys_ ## x); \
j ra; \
END(__sys_ ## x)
#define PSEUDO(x) \
/*
* Do a normal syscall.
*/
#define RSYSCALL(x) \
LEAF(__sys_ ## x); \
.weak _C_LABEL(x); \
_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
@ -140,4 +130,28 @@ LEAF(__sys_ ## x); \
PIC_RETURN(); \
err: \
PIC_TAILCALL(__cerror); \
END(__sys_ ## x)
END(__sys_ ## x)
/*
* Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
* and syscall name are not the same.
*/
#define PSEUDO_NOERROR(x) \
LEAF(__sys_ ## x); \
.weak _C_LABEL(__CONCAT(_,x)); \
_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
SYSTRAP(x); \
j ra; \
END(__sys_ ## x)
#define PSEUDO(x) \
LEAF(__sys_ ## x); \
.weak _C_LABEL(__CONCAT(_,x)); \
_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
PIC_PROLOGUE(__sys_ ## x); \
SYSTRAP(x); \
bne a3,zero,err; \
PIC_RETURN(); \
err: \
PIC_TAILCALL(__cerror); \
END(__sys_ ## x)