Files
graphene/LibOS/glibc-patches/syscalldb-api.patch
Chia-Che Tsai dc8b63ce62 [Glibc] Update Glibc version to 2.23 and 2.27
Previously, Graphene supported Glibc version 2.19 only. This commit
adds support for Glibc v2.23 (default in Ubuntu 16.04) and Glibc
v2.27 (default in Ubuntu 18.04). The exact version can be chosen by
specifying GLIBC_VERSION during Graphene build. The default version
to be built is v2.27.

Note that for the best GDB experience it is advised to build Graphene
with the same Glibc version as installed on the host OS.
2019-08-15 13:30:53 -07:00

109 lines
2.4 KiB
Diff

diff --git a/elf/syscallas.S b/elf/syscallas.S
new file mode 120000
index 0000000..107bd13
--- /dev/null
+++ b/elf/syscallas.S
@@ -0,0 +1 @@
+../syscallas.S
\ No newline at end of file
diff --git a/elf/syscalldb.c b/elf/syscalldb.c
new file mode 120000
index 0000000..61dca52
--- /dev/null
+++ b/elf/syscalldb.c
@@ -0,0 +1 @@
+../syscalldb.c
\ No newline at end of file
diff --git a/syscallas.S b/syscallas.S
new file mode 100644
index 0000000..07c6ffc
--- /dev/null
+++ b/syscallas.S
@@ -0,0 +1,11 @@
+#include <syscalldb.h>
+
+.weak syscalldb
+.type syscalldb,@function
+
+syscalldb:
+ .cfi_startproc
+ syscall
+ retq
+ .cfi_endproc
+ .size syscalldb,.-syscalldb
diff --git a/syscalldb.c b/syscalldb.c
new file mode 100644
index 0000000..7a56162
--- /dev/null
+++ b/syscalldb.c
@@ -0,0 +1,16 @@
+#include "syscalldb.h"
+#include <stdarg.h>
+#include <errno.h>
+
+int register_library (const char * name, unsigned long load_address)
+ __attribute__((weak));
+
+int register_library (const char * name, unsigned long load_address)
+{
+ return 0;
+}
+
+long int glibc_option (const char * opt)
+{
+ return -EINVAL;
+}
diff --git a/syscalldb.h b/syscalldb.h
new file mode 100644
index 0000000..2833def
--- /dev/null
+++ b/syscalldb.h
@@ -0,0 +1,39 @@
+#ifndef _SYSCALLDB_H_
+#define _SYSCALLDB_H_
+
+#ifdef __ASSEMBLER__
+.weak syscalldb
+.type syscalldb, @function
+
+# if defined(PSEUDO) && defined(SYSCALL_NAME) && defined(SYSCALL_SYMBOL)
+# define SYSCALLDB \
+ subq $128, %rsp; \
+ callq *syscalldb@GOTPCREL(%rip); \
+ addq $128, %rsp
+# else
+# define SYSCALLDB \
+ callq *syscalldb@GOTPCREL(%rip)
+# endif
+
+#else /* !__ASSEMBLER__ */
+asm (
+".weak syscalldb\r\n"
+".type syscalldb, @function\r\n");
+
+#define SYSCALLDB \
+ "subq $128, %%rsp\n\t" \
+ "callq *syscalldb@GOTPCREL(%%rip)\n\t" \
+ "addq $128, %%rsp\n\t"
+
+#define SYSCALLDB_ASM \
+ "callq *syscalldb@GOTPCREL(%rip)\n\t"
+
+long int glibc_option (const char * opt);
+
+asm (
+".weak glibc_option\r\n"
+".type glibc_option, @function\r\n");
+
+#endif /* Assembler */
+
+#endif /* _SYSCALLDB_H */
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalldb.h b/sysdeps/unix/sysv/linux/x86_64/syscalldb.h
new file mode 120000
index 0000000..55ab305
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalldb.h
@@ -0,0 +1 @@
+../../../../../syscalldb.h
\ No newline at end of file