From 1e3a2e82aaea009f14b9e808e56f06cd7f3f9f15 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Thu, 21 Jan 2016 17:29:01 +0000 Subject: [PATCH] Fix the implementations of PSEUDO_NOERROR and PSEUDO. The PSEUDO* macros should not declare , only _ and __sys_. This was causing the interposing C wrappers to be ignored due to link order. Reviewed by: kib Obtained from: CheriBSD (4e8e13c90fc6a80e1520de44a6864cfd78b3b56d) MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D4097 --- lib/libc/mips/SYS.h | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/lib/libc/mips/SYS.h b/lib/libc/mips/SYS.h index 10205b8793a..ceb68121b07 100644 --- a/lib/libc/mips/SYS.h +++ b/lib/libc/mips/SYS.h @@ -100,19 +100,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)); \ @@ -120,9 +107,12 @@ LEAF(__sys_ ## x); \ _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \ SYSTRAP(x); \ j ra; \ - END(__sys_ ## x) +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)); \ @@ -135,3 +125,27 @@ LEAF(__sys_ ## x); \ err: \ PIC_TAILCALL(__cerror); \ 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)