summaryrefslogtreecommitdiffstats
path: root/lib/libc/amd64/SYS.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/amd64/SYS.h')
-rw-r--r--lib/libc/amd64/SYS.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h
index 5dc8b46..46aeb47 100644
--- a/lib/libc/amd64/SYS.h
+++ b/lib/libc/amd64/SYS.h
@@ -40,13 +40,24 @@
#include <sys/syscall.h>
#include <machine/asm.h>
-#define SYSCALL(x) 2: jmp PIC_PLT(HIDENAME(cerror)); \
+#ifdef PIC
+#define SYSCALL(x) 2: movq PIC_GOT(HIDENAME(cerror)),%rcx; \
+ jmp *%rcx; \
ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(x); \
.set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
.weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2b
+#else
+#define SYSCALL(x) 2: jmp HIDENAME(cerror); \
+ ENTRY(__CONCAT(__sys_,x)); \
+ .weak CNAME(x); \
+ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
+ .weak CNAME(__CONCAT(_,x)); \
+ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+ mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2b
+#endif
#define RSYSCALL(x) SYSCALL(x); ret
OpenPOWER on IntegriCloud