Browse Source

[LibOS] Sanitize glibc build script

The academic-quality build script was supplanted by industry-grade
Makefile rule.

Also, glibc 2.19 is not supported, because it is not present in any
supported distro.
Wojtek Porczyk 4 years ago
parent
commit
101371683a

+ 1 - 3
Jenkinsfiles/Linux

@@ -8,8 +8,6 @@ pipeline {
                         sh '''
                             ./Scripts/clean-check-prepare
                             cd LibOS
-                            make -j 8 glibc-build/Build.success GLIBC_VERSION=2.19
-                            rm -r glibc-build
                             make -j 8 glibc-build/Build.success GLIBC_VERSION=2.23
                             rm -r glibc-build
                             cd ..
@@ -94,7 +92,7 @@ pipeline {
                            cd "$(./Scripts/clean-check-test-copy)"
 
                            make clean
-                           rm -r LibOS/glibc-2.19 LibOS/glibc-2.23
+                           rm -r LibOS/glibc-2.23
                            rm LibOS/glibc-*.tar.gz
                            make -C Pal/ipc/linux KERNELDIR=/lib/modules/4.4.0-161-generic/build clean
                            make -C LibOS/shim/test/regression clean

+ 14 - 11
LibOS/Makefile

@@ -28,6 +28,12 @@ GLIBC_LIBS = \
 GLIBC_TARGET = $(addprefix $(BUILD_DIR)/, $(GLIBC_LIBS))
 GLIBC_RUNTIME = $(addprefix $(RUNTIME_DIR)/, $(notdir $(GLIBC_TARGET)))
 
+GLIBC_CFLAGS = -O2 -U_FORTIFY_SOURCE -fno-stack-protector -Wno-unused-value
+ifeq ($(DEBUG),1)
+	GLIBC_CFLAGS += -g
+endif
+export GLIBC_CFLAGS
+
 .PHONY: all
 all: $(GLIBC_TARGET) $(GLIBC_RUNTIME)
 	$(MAKE) -C $(SHIM_DIR) all
@@ -49,11 +55,14 @@ $(BUILD_DIR)/Build.success: $(BUILD_DIR)/Makefile
 $(GLIBC_TARGET): $(BUILD_DIR)/Build.success
 
 $(BUILD_DIR)/Makefile: $(GLIBC_SRC)/configure
-ifeq ($(DEBUG),1)
-	./buildglibc.py --src $(GLIBC_SRC) --quiet --debug
-else
-	./buildglibc.py --src $(GLIBC_SRC) --quiet
-endif
+	mkdir -p $(BUILD_DIR)
+	(cd $(BUILD_DIR) || exit 1; \
+	CFLAGS=$$GLIBC_CFLAGS ../$< --prefix=$(RUNTIME_DIR) \
+		--with-tls \
+		--without-selinux \
+		--disable-test \
+		--disable-nscd \
+	)
 
 define LN_SF_TO_RUNTIME_DIR_template =
 $(RUNTIME_DIR)/$(notdir $(1)): $(1)
@@ -72,12 +81,6 @@ GLIBC_PATCHES = \
 	glibc-patches/liblibos.patch \
 	glibc-patches/malloc-arena-size.patch
 
-GLIBC_PATCHES_2.19 = \
-	glibc-patches/fix-make-warnings.patch \
-	glibc-patches/no-pie.patch \
-	glibc-patches/liblibos-2.19.patch \
-	glibc-patches/hp-timing-2.19.patch
-
 GLIBC_PATCHES_2.23 = \
 	glibc-patches/liblibos-2.23+.patch \
 	glibc-patches/hp-timing-2.23+.patch \

+ 0 - 117
LibOS/buildglibc.py

@@ -1,117 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import shutil
-import subprocess
-import sys
-from pkg_resources import parse_version
-
-def prependText(filename, text) :
-    data = ""
-    with open(filename, 'r') as original:
-        data = original.read()
-    with open(filename, 'w') as modified:
-        modified.write(text)
-        modified.write(data)
-
-def appendText(filename, text) :
-    with open(filename, "a") as myfile:
-        myfile.write(text)
-
-
-home = os.getcwd()
-glibc = "glibc-2.19"
-glibcParent = "" # glibc parent directory
-glibcDir = ""    # glibc dir (ex. glibc-2.19)
-buildDir = "glibc-build"
-installDir = os.path.dirname(home) + '/Runtime/'
-commandStr = ""
-commandOutput = ""
-quiet = False
-debug_flags = ""
-
-index = 0
-for arg in sys.argv[1:]:
-    index += 1
-    if (arg == '--src' or arg == '-s') and index + 1 < len(sys.argv):
-        glibc = sys.argv[index + 1]
-    if arg == '--quiet' or arg == '-q':
-        quiet = True
-    if arg == '--debug':
-        debug_flags = "-g"
-
-version = parse_version(glibc.replace("glibc-", ""))
-
-if True:
-
-    #########################################
-    #### get the locations of directories ###
-    #########################################
-
-    if not quiet:
-        iput = input('use {0} as the source of GNU libc? ([y]/n):'.format(glibc)).lower()
-        if not iput == 'y' and not iput == '' :
-            glibc = input('enter the glibc source to install with: ')
-
-    if not quiet:
-        iput = input('{0} contains glibc code to compile? ([y]/n): '.format(glibc)).lower()
-        if not iput == 'y' and not iput == '':
-            glibc = input('directory containing glibc code to compile: ')
-
-    if os.path.isdir(glibc) :
-        glibc = os.path.abspath(glibc)
-        glibcParent,glibcDir = os.path.split(glibc)
-        print('building in {0}: {1}'.format(glibcParent, glibcDir))
-
-    if not quiet:
-        iput = input('use {0} as the directory to build glibc in? ([y]/n): '.format(buildDir)).lower()
-        if not iput == 'y' and not iput == '':
-            buildDir = input('the directory to build glibc in:  ')
-
-    buildDir = os.path.abspath(buildDir)
-    print('using build dir: {0}'.format(buildDir))
-
-    if os.path.isdir(buildDir) :
-        if not quiet:
-            clean = input('clean build (delete {0}, rerun configure, etc.)? ([y]/n): '.format(buildDir))
-        else:
-            clean = 'y'
-
-        if clean == 'y' or clean == '':
-            shutil.rmtree(buildDir)
-            os.makedirs(buildDir)
-        else :
-            print('Then just go to {0} and type make...'.format(buildDir))
-            exit(0)
-    else :
-        os.makedirs(buildDir)
-
-    if not quiet:
-        iput = input('use {0} as the directory to install glibc in? ([y]/n): '.format(installDir)).lower()
-        if not iput == 'y' and not iput == '':
-            installDir = input('the directory to install glibc in:  ')
-
-    installDir = os.path.abspath(installDir)
-    print('using install dir: {0}'.format(installDir))
-
-
-if True:
-
-    ################################
-    #### doctor glibc's Makefile ###
-    ################################
-
-    os.chdir(buildDir)
-
-    cflags = '{0} -O2 -U_FORTIFY_SOURCE -fno-stack-protector -Wno-unused-value'.format(debug_flags)
-    extra_defs = ''
-    disabled_features = { 'nscd' }
-    extra_flags = '--with-tls --without-selinux --disable-test {0}'.format(' '.join(['--disable-' + f for f in disabled_features]))
-
-    if version <= parse_version('2.21'):
-        extra_flags += ' --enable-add-ons=nptl'
-
-    ##    configure
-    commandStr = r'CFLAGS="{2}" {3} {0}/configure --prefix={1} {4} | tee configure.out'.format(glibc, installDir, cflags, extra_defs, extra_flags)
-    print(commandStr)
-    commandOutput = subprocess.call(commandStr, shell=True)

+ 0 - 50
LibOS/glibc-patches/fix-make-warnings.patch

@@ -1,50 +0,0 @@
-2015-08-09  Mike Frysinger  <vapier@gentoo.org>
-
-	* nptl/tst-cancel-wrappers.sh: Change 3rd arg to gensub to 1.
-	* scripts/sysd-rules.awk: Likewise.
----
- nptl/tst-cancel-wrappers.sh | 2 +-
- scripts/sysd-rules.awk      | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/nptl/tst-cancel-wrappers.sh b/nptl/tst-cancel-wrappers.sh
-index b2d8302..d492a54 100644
---- a/nptl/tst-cancel-wrappers.sh
-+++ b/nptl/tst-cancel-wrappers.sh
-@@ -74,7 +74,7 @@ C["__xpg_sigpause"]=1
-   seen=""
-   seen_enable=""
-   seen_disable=""
--  object=gensub(/^.*\[(.*)\]:$/,"\\1","",$0)
-+  object=gensub(/^.*\[(.*)\]:$/, "\\1", 1, $0)
-   next
- }
- {
-diff --git a/scripts/sysd-rules.awk b/scripts/sysd-rules.awk
-index cc14334..cebc9d3 100644
---- a/scripts/sysd-rules.awk
-+++ b/scripts/sysd-rules.awk
-@@ -53,7 +53,7 @@ BEGIN {
-         if (target_pattern == "%") {
-           command_suffix = "";
-         } else {
--          prefix = gensub(/%/, "", "", target_pattern);
-+          prefix = gensub(/%/, "", 1, target_pattern);
-           command_suffix = " $(" prefix  "CPPFLAGS)";
-         }
-         target = "$(objpfx)" target_pattern o ":";
-diff --git a/Makerules b/Makerules
---- a/Makerules
-+++ b/Makerules
-@@ -718,7 +718,7 @@ verbose	:=
- endif						# not -s
- 
- ARFLAGS := r$(verbose)
--CREATE_ARFLAGS := cru$(verbose)
-+CREATE_ARFLAGS := cruU$(verbose)
- 
- # This makes all the object files in the parent library archive.
- 
--- 
-2.4.4
-

+ 0 - 918
LibOS/glibc-patches/glibc-2.19.patch

@@ -1,918 +0,0 @@
-diff --git a/Makeconfig b/Makeconfig
-index 1908f27..cf34ba1 100644
---- a/Makeconfig
-+++ b/Makeconfig
-@@ -775,7 +775,8 @@ endif	# $(+cflags) == ""
- # current directory.
- +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
- 	    $(+sysdep-includes) $(includes) \
--	    $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
-+	    $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes) \
-+	    -I$(common-objpfx)../shim/include
- 
- # Since libio has several internal header files, we use a -I instead
- # of many little headers in the include directory.
-diff --git a/Makefile b/Makefile
-index 51d4690..d72c4b0 100644
---- a/Makefile
-+++ b/Makefile
-@@ -177,6 +177,8 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
- install-others-nosubdir: $(installed-stubs)
- endif
- 
-+# For Graphene
-+CFLAGS-syscalldb.c = -fPIC
- 
- # Since stubs.h is never needed when building the library, we simplify the
- # hairy installation process by producing it in place only as the last part
-diff --git a/Versions.def b/Versions.def
-index 759c754..e1a270e 100644
---- a/Versions.def
-+++ b/Versions.def
-@@ -135,6 +138,7 @@ ld {
-   GLIBC_2.3
-   GLIBC_2.4
-   GLIBC_PRIVATE
-+  SHIM
- }
- libthread_db {
-   GLIBC_2.1.3
-diff --git a/elf/Makefile b/elf/Makefile
-index 4c58fc9..0ae2fa8 100644
---- a/elf/Makefile
-+++ b/elf/Makefile
-@@ -21,7 +21,7 @@ subdir		:= elf
- 
- include ../Makeconfig
- 
--headers		= elf.h bits/elfclass.h link.h bits/link.h
-+headers		= elf.h bits/elfclass.h link.h bits/link.h syscalldb.h
- routines	= $(dl-routines) dl-support dl-iteratephdr \
- 		  dl-addr enbl-secure dl-profstub \
- 		  dl-origin dl-libc dl-sym dl-tsd dl-sysdep
-@@ -31,7 +31,8 @@ routines	= $(dl-routines) dl-support dl-iteratephdr \
- dl-routines	= $(addprefix dl-,load lookup object reloc deps hwcaps \
- 				  runtime error init fini debug misc \
- 				  version profile conflict tls origin scope \
--				  execstack caller open close trampoline)
-+				  execstack caller open close trampoline) \
-+		  syscalldb syscallas
- ifeq (yes,$(use-ldconfig))
- dl-routines += dl-cache
- endif
-diff --git a/elf/Versions b/elf/Versions
-index 2383992..98687f6 100644
---- a/elf/Versions
-+++ b/elf/Versions
-@@ -62,4 +65,7 @@ ld {
-     # Pointer protection.
-     __pointer_chk_guard;
-   }
-+  SHIM {
-+    syscalldb; glibc_version; glibc_option; register_library;
-+  }
- }
-diff --git a/elf/dl-load.c b/elf/dl-load.c
-index 1be7a3c..c560ec1 100644
---- a/elf/dl-load.c
-+++ b/elf/dl-load.c
-@@ -39,6 +39,8 @@
- 
- #include <dl-dst.h>
- 
-+#include <glibc-version.h>
-+
- /* On some systems, no flag bits are given to specify file mapping.  */
- #ifndef MAP_FILE
- # define MAP_FILE	0
-@@ -1595,6 +1597,9 @@ cannot enable executable stack as shared object requires");
-   DL_AFTER_LOAD (l);
- #endif
- 
-+  /* register the library to SHIM */
-+  register_library(l->l_name, l->l_addr);
-+
-   /* Now that the object is fully initialized add it to the object list.  */
-   _dl_add_to_namespace_list (l, nsid);
- 
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 6dcbabc..c87c773 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -356,6 +356,23 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
-   return start_addr;
- }
- 
-+/* For graphene, check if glibc version match to the compatible SHIM
-+   library. If not, tell the user to update glibc. */
-+#include "glibc-version.h"
-+
-+const unsigned int glibc_version __attribute__((weak)) = GLIBC_VERSION;
-+
-+static void __attribute__((noinline,optimize("-O0")))
-+check_glibc_version (void)
-+{
-+  if (glibc_version != GLIBC_VERSION)
-+    {
-+      _dl_fatal_printf ("Warning from Graphene: "
-+                        "Glibc version is incorrect. Please rebuild Glibc.\n");
-+      _exit (1);
-+    }
-+}
-+
- static ElfW(Addr) __attribute_used__ internal_function
- _dl_start (void *arg)
- {
-@@ -546,6 +563,9 @@ _dl_start (void *arg)
-      therefore need not test whether we have to allocate the array
-      for the relocation results (as done in dl-reloc.c).  */
- 
-+  /* For Graphene, check if the glibc version is correct. */
-+  check_glibc_version();
-+
-   /* Now life is sane; we can call functions and access global data.
-      Set up to use the operating system facilities, and find out from
-      the operating system's program loader where to find the program
-diff --git a/nptl/Versions b/nptl/Versions
-index bb11277..354149a 100644
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
-index 89fda5e..f6963f6 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
-@@ -111,7 +111,7 @@ ENTRY(__pthread_disable_asynccancel)
- 	xorq	%r10, %r10
- 	addq	$CANCELHANDLING, %rdi
- 	LOAD_PRIVATE_FUTEX_WAIT (%esi)
--	syscall
-+	SYSCALLDB
- 	movl	%fs:CANCELHANDLING, %eax
- 	jmp	3b
- END(__pthread_disable_asynccancel)
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
-index f2dca07..0ce7c67 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
-@@ -90,7 +90,7 @@ __lll_lock_wait_private:
- 
- 1:	LIBC_PROBE (lll_lock_wait_private, 1, %rdi)
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 2:	movl	%edx, %eax
- 	xchgl	%eax, (%rdi)	/* NB:	 lock is implied */
-@@ -130,7 +130,7 @@ __lll_lock_wait:
- 
- 1:	LIBC_PROBE (lll_lock_wait, 2, %rdi, %rsi)
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 2:	movl	%edx, %eax
- 	xchgl	%eax, (%rdi)	/* NB:	 lock is implied */
-@@ -185,7 +185,7 @@ __lll_timedlock_wait:
- 
- 1:	movl	$SYS_futex, %eax
- 	movl	$2, %edx
--	syscall
-+	SYSCALLDB
- 
- 2:	xchgl	%edx, (%rdi)	/* NB:   lock is implied */
- 
-@@ -279,7 +279,7 @@ __lll_timedlock_wait:
- 	LOAD_FUTEX_WAIT (%esi)
- 	movq	%r12, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	/* NB: %edx == 2 */
- 	xchgl	%edx, (%r12)
-@@ -336,7 +336,7 @@ __lll_unlock_wake_private:
- 	LOAD_PRIVATE_FUTEX_WAKE (%esi)
- 	movl	$1, %edx	/* Wake one thread.  */
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	popq	%rdx
- 	cfi_adjust_cfa_offset(-8)
-@@ -366,7 +366,7 @@ __lll_unlock_wake:
- 	LOAD_FUTEX_WAKE (%esi)
- 	movl	$1, %edx	/* Wake one thread.  */
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	popq	%rdx
- 	cfi_adjust_cfa_offset(-8)
-@@ -435,7 +435,7 @@ __lll_timedwait_tid:
- #endif
- 	movq	%r12, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	cmpl	$0, (%rdi)
- 	jne	1f
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
-index 0a26739..8aae14a 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
-@@ -214,7 +214,7 @@ LLL_STUB_UNWIND_INFO_END
-     register const struct timespec *__to __asm ("r10") = timeout;	      \
-     int __status;							      \
-     register __typeof (val) _val __asm ("edx") = (val);			      \
--    __asm __volatile ("syscall"						      \
-+    __asm __volatile (SYSCALLDB						      \
- 		      : "=a" (__status)					      \
- 		      : "0" (SYS_futex), "D" (futex),			      \
- 			"S" (__lll_private_flag (FUTEX_WAIT, private)),	      \
-@@ -229,7 +229,7 @@ LLL_STUB_UNWIND_INFO_END
-     int __status;							      \
-     register __typeof (nr) _nr __asm ("edx") = (nr);			      \
-     LIBC_PROBE (lll_futex_wake, 3, futex, nr, private);                       \
--    __asm __volatile ("syscall"						      \
-+    __asm __volatile (SYSCALLDB						      \
- 		      : "=a" (__status)					      \
- 		      : "0" (SYS_futex), "D" (futex),			      \
- 			"S" (__lll_private_flag (FUTEX_WAKE, private)),	      \
-@@ -540,7 +540,7 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count,
-     {									      \
-       int ignore;							      \
-       __asm __volatile (LOCK_INSTR "orl %3, (%2)\n\t"			      \
--			"syscall"					      \
-+			SYSCALLDB					      \
- 			: "=m" (futex), "=a" (ignore)			      \
- 			: "D" (&(futex)), "i" (FUTEX_OWNER_DIED),	      \
- 			  "S" (__lll_private_flag (FUTEX_WAKE, private)),     \
-@@ -555,7 +555,7 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count,
-      register int __nr_move __asm ("r10") = nr_move;			      \
-      register void *__mutex __asm ("r8") = mutex;			      \
-      register int __val __asm ("r9") = val;				      \
--     __asm __volatile ("syscall"					      \
-+     __asm __volatile (SYSCALLDB					      \
- 		       : "=a" (__res)					      \
- 		       : "0" (__NR_futex), "D" ((void *) ftx),		      \
- 			 "S" (__lll_private_flag (FUTEX_CMP_REQUEUE,	      \
-@@ -581,7 +581,7 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count,
-     if (_tid != 0)							      \
-       __asm __volatile ("xorq %%r10, %%r10\n\t"				      \
- 			"1:\tmovq %2, %%rax\n\t"			      \
--			"syscall\n\t"					      \
-+			SYSCALLDB					      \
- 			"cmpl $0, (%%rdi)\n\t"				      \
- 			"jne 1b"					      \
- 			: "=&a" (__ignore)				      \
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
-index 990b6f9..b01214d 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
-@@ -80,7 +80,7 @@ __lll_robust_lock_wait:
- 	jnz	2f
- 
- 1:	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	movl	(%rdi), %eax
- 
-@@ -145,7 +145,7 @@ __lll_robust_timedlock_wait:
- 	jnz	6f
- 
- 5:	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	movl	%eax, %ecx
- 
- 	movl	(%rdi), %eax
-@@ -257,7 +257,7 @@ __lll_robust_timedlock_wait:
- 	LOAD_FUTEX_WAIT (%esi)
- 	movq	%r12, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %rcx
- 
- 	movl	(%r12), %eax
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
-index eec17f2..a350340 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
-@@ -62,7 +62,7 @@ pthread_barrier_wait:
- #endif
- 	xorq	%r10, %r10
- 8:	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	/* Don't return on spurious wakeups.  The syscall does not change
- 	   any register except %eax so there is no need to reload any of
-@@ -109,7 +109,7 @@ pthread_barrier_wait:
- 	movl	$FUTEX_WAKE, %esi
- 	orl	PRIVATE(%rdi), %esi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	/* Increment LEFT.  If this brings the count back to the
- 	   initial count unlock the object.  */
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-index 985e0f1..d559456 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
-@@ -90,7 +90,7 @@ __pthread_cond_broadcast:
- 	movl	$SYS_futex, %eax
- 	movl	$1, %edx
- 	movl	$0x7fffffff, %r10d
--	syscall
-+	SYSCALLDB
- 
- 	/* For any kind of error, which mainly is EAGAIN, we try again
- 	   with WAKE.  The general test also covers running on old
-@@ -106,7 +106,7 @@ __pthread_cond_broadcast:
- 	movl	$SYS_futex, %eax
- 	movl	$1, %edx
- 	movl	$0x7fffffff, %r10d
--	syscall
-+	SYSCALLDB
- 
- 	/* For any kind of error, which mainly is EAGAIN, we try again
- 	   with WAKE.  The general test also covers running on old
-@@ -172,7 +172,7 @@ __pthread_cond_broadcast:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	jmp	10b
- 	.size	__pthread_cond_broadcast, .-__pthread_cond_broadcast
- versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-index 53d65b6..16df581 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
-@@ -82,7 +82,7 @@ __pthread_cond_signal:
- 	addq	$cond_lock, %r8
- #endif
- 	movl	$FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %r9d
--	syscall
-+	SYSCALLDB
- #if cond_lock != 0
- 	subq	$cond_lock, %r8
- #endif
-@@ -99,7 +99,7 @@ __pthread_cond_signal:
- 	movq	%rcx, %r8
- 	xorq	%r10, %r10
- 	movl	(%rdi), %r9d	// XXX Can this be right?
--	syscall
-+	SYSCALLDB
- 
- 	leaq	-cond_futex(%rdi), %r8
- 
-@@ -118,7 +118,7 @@ __pthread_cond_signal:
- 	movl	$SYS_futex, %eax
- 	/* %rdx should be 1 already from $FUTEX_WAKE_OP syscall.
- 	movl	$1, %edx  */
--	syscall
-+	SYSCALLDB
- 
- 	/* Unlock.  */
- 4:	LOCK
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-index 0dc2340..8aff242 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
-@@ -188,7 +188,7 @@ __pthread_cond_timedwait:
- 	movq	%r12, %rdx
- 	addq	$cond_futex, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	cmpl	$0, %eax
- 	sete	%r15b
-@@ -234,7 +234,7 @@ __pthread_cond_timedwait:
- 	movq	%r12, %rdx
- 	addq	$cond_futex, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 62:	movq	%rax, %r14
- 
- 	movl	(%rsp), %edi
-@@ -321,7 +321,7 @@ __pthread_cond_timedwait:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	subq	$cond_nwaiters, %rdi
- 
- 55:	LOCK
-@@ -492,7 +492,7 @@ __pthread_cond_timedwait:
- 	call	*%rax
- #  else
- 	movl	$__NR_clock_gettime, %eax
--	syscall
-+	SYSCALLDB
- #  endif
- 
- 	/* Compute relative timeout.  */
-@@ -560,7 +553,7 @@ __pthread_cond_timedwait:
- # endif
- 	addq	$cond_futex, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %r14
- 
- 	movl	(%rsp), %edi
-@@ -732,7 +725,7 @@ __condvar_cleanup2:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	subq	$cond_nwaiters, %rdi
- 	movl	$1, %r12d
- 
-@@ -769,7 +762,7 @@ __condvar_cleanup2:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	/* Lock the mutex only if we don't own it already.  This only happens
- 	   in case of PI mutexes, if we got cancelled after a successful
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-index 0e61d0a..b4bcc15 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
-@@ -138,7 +138,7 @@ __pthread_cond_wait:
- 
- 	movl	$(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	cmpl	$0, %eax
- 	sete	%r8b
-@@ -180,7 +180,7 @@ __pthread_cond_wait:
- #endif
- 60:	xorb	%r8b, %r8b
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 62:	movl	(%rsp), %edi
- 	callq	__pthread_disable_asynccancel
-@@ -239,7 +239,7 @@ __pthread_cond_wait:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	subq	$cond_nwaiters, %rdi
- 
- 17:	LOCK
-@@ -455,7 +455,7 @@ __condvar_cleanup1:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	subq	$cond_nwaiters, %rdi
- 	movl	$1, %ecx
- 
-@@ -493,7 +493,7 @@ __condvar_cleanup1:
- 	orl	$FUTEX_WAKE, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	/* Lock the mutex only if we don't own it already.  This only happens
- 	   in case of PI mutexes, if we got cancelled after a successful
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
-index 2cbe2fa..489998a 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
-@@ -90,7 +90,7 @@ __pthread_once:
- # endif
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	jmp	6b
- 
- 	/* Preserve the pointer to the control variable.  */
-@@ -123,7 +123,7 @@ __pthread_once:
- 	orl	%fs:PRIVATE_FUTEX, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 4:	addq	$8, %rsp
- 	cfi_adjust_cfa_offset(-8)
-@@ -152,7 +152,7 @@ clear_once_control:
- 	orl	%fs:PRIVATE_FUTEX, %esi
- #endif
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	movq	%r8, %rdi
- .LcallUR:
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
-index 3bbb4c7..53d5ca6 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
-@@ -82,7 +82,7 @@ __pthread_rwlock_rdlock:
- #endif
- 	addq	$READERS_WAKEUP, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	subq	$READERS_WAKEUP, %rdi
- 
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
-index 40bcc04..348170e 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
-@@ -109,7 +109,7 @@ pthread_rwlock_timedrdlock:
- #endif
- 21:	leaq	READERS_WAKEUP(%r12), %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %rdx
- 
- #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
-index f57ef52..e9ac77f 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
-@@ -106,7 +106,7 @@ pthread_rwlock_timedwrlock:
- #endif
- 21:	leaq	WRITERS_WAKEUP(%r12), %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %rdx
- 
- #ifndef __ASSUME_FUTEX_CLOCK_REALTIME
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
-index d779f7b..849c74f 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
-@@ -79,7 +79,7 @@ __pthread_rwlock_unlock:
- #endif
- 	movl	$SYS_futex, %eax
- 	movq	%r10, %rdi
--	syscall
-+	SYSCALLDB
- 
- 	xorl	%eax, %eax
- 	retq
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
-index e444def..fd94930 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
-@@ -80,7 +80,7 @@ __pthread_rwlock_wrlock:
- #endif
- 	addq	$WRITERS_WAKEUP, %rdi
- 	movl	$SYS_futex, %eax
--	syscall
-+	SYSCALLDB
- 
- 	subq	$WRITERS_WAKEUP, %rdi
- 
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
-index 1c11600..bd166cf 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
-@@ -52,7 +52,7 @@ sem_post:
- 	movl	$FUTEX_WAKE, %esi
- 	orl	PRIVATE(%rdi), %esi
- 	movl	$1, %edx
--	syscall
-+	SYSCALLDB
- 
- 	testq	%rax, %rax
- 	js	1f
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
-index 880610e..e520049 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
-@@ -97,7 +97,7 @@ sem_timedwait:
- 	orl	PRIVATE(%rdi), %esi
- 	movl	$SYS_futex, %eax
- 	xorl	%edx, %edx
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %r9
- #if VALUE != 0
- 	leaq	-VALUE(%rdi), %rdi
-@@ -233,7 +233,7 @@ sem_timedwait:
- # endif
- 	movl	$SYS_futex, %eax
- 	xorl	%edx, %edx
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %r14
- 
- 	movl	16(%rsp), %edi
-diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
-index 8f4d068..fe6dfbf 100644
---- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
-+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
-@@ -81,7 +81,7 @@ sem_wait:
- 	orl	PRIVATE(%rdi), %esi
- #endif
- 	xorl	%edx, %edx
--	syscall
-+	SYSCALLDB
- 	movq	%rax, %rcx
- 
- 	xchgq	%r8, %rdi
-diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
-index 18a15a1..f050241 100644
---- a/nptl/sysdeps/x86_64/pthreaddef.h
-+++ b/nptl/sysdeps/x86_64/pthreaddef.h
-@@ -48,4 +48,4 @@
- 
- /* While there is no such syscall.  */
- #define __exit_thread_inline(val) \
--  asm volatile ("syscall" :: "a" (__NR_exit), "D" (val))
-+  asm volatile (SYSCALLDB :: "a" (__NR_exit), "D" (val))
-diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
-index cbb5e9e..9b87e25 100644
---- a/nptl/sysdeps/x86_64/tls.h
-+++ b/nptl/sysdeps/x86_64/tls.h
-@@ -28,6 +28,7 @@
- # include <sysdep.h>
- # include <libc-internal.h>
- # include <kernel-features.h>
-+# include <syscalldb.h>
- 
- /* Replacement type for __m128 since this file is included by ld.so,
-    which is compiled with -mno-sse.  It must not change the alignment
-@@ -154,7 +159,7 @@ typedef struct
-      _head->self = _thrdescr;						      \
- 									      \
-      /* It is a simple syscall to set the %fs value for the thread.  */	      \
--     asm volatile ("syscall"						      \
-+     asm volatile (SYSCALLDB						      \
- 		   : "=a" (_result)					      \
- 		   : "0" ((unsigned long int) __NR_arch_prctl),		      \
- 		     "D" ((unsigned long int) ARCH_SET_FS),		      \
-diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c
-index 2468228..a9f1cd6 100644
---- a/sysdeps/unix/sysv/linux/_exit.c
-+++ b/sysdeps/unix/sysv/linux/_exit.c
-@@ -29,9 +29,9 @@ _exit (status)
-   while (1)
-     {
- #ifdef __NR_exit_group
--      INLINE_SYSCALL (exit_group, 1, status);
-+      INLINE_SYSCALL_ASM (exit_group, 1, status);
- #endif
--      INLINE_SYSCALL (exit, 1, status);
-+      INLINE_SYSCALL_ASM (exit, 1, status);
- 
- #ifdef ABORT_INSTRUCTION
-       ABORT_INSTRUCTION;
-diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
-index 49f0384..6b1a975 100644
---- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
-@@ -84,7 +84,8 @@ ENTRY(____longjmp_chk)
- 	xorl	%edi, %edi
- 	lea	-sizeSS(%rsp), %RSI_LP
- 	movl	$__NR_sigaltstack, %eax
--	syscall
-+	SYSCALLDB
-+
- 	/* Without working sigaltstack we cannot perform the test.  */
- 	testl	%eax, %eax
- 	jne	.Lok2
-diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
-index 0508730..e1b35ec 100644
---- a/sysdeps/unix/sysv/linux/x86_64/clone.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
-@@ -76,5 +80,5 @@ ENTRY (__clone)
- 	/* End FDE now, because in the child the unwind info will be
- 	   wrong.  */
- 	cfi_endproc;
--	syscall
-+	SYSCALLDB
- 
-@@ -99,10 +104,10 @@ L(thread_start):
- 	movl	$-1, %eax
- 	jne	2f
- 	movl	$SYS_ify(getpid), %eax
--	syscall
-+	SYSCALLDB
- 2:	movl	%eax, %fs:PID
- 	movl	%eax, %fs:TID
- 1:
- #endif
- 
- 	/* Set up arguments for the function call.  */
-diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
-index 140db03..6967f10 100644
---- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
-@@ -75,7 +75,7 @@ ENTRY(__getcontext)
- #endif
- 	movl	$_NSIG8,%r10d
- 	movl	$__NR_rt_sigprocmask, %eax
--	syscall
-+	SYSCALLDB
- 	cmpq	$-4095, %rax		/* Check %rax for error.  */
- 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
- 
-diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
-index 0fd47f2..7a82975 100644
---- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
-@@ -44,7 +45,7 @@
- #else
- # ifdef __NR_getcpu
- 	movl	$__NR_getcpu, %eax
--	syscall
-+	SYSCALLDB
- #  ifndef __ASSUME_GETCPU_SYSCALL
-        cmpq    $-ENOSYS, %rax
-        jne     1f
-diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
-index b726fa0..bb3ae34 100644
---- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
-@@ -43,7 +43,7 @@ ENTRY(__setcontext)
- 	movl	$SIG_SETMASK, %edi
- 	movl	$_NSIG8,%r10d
- 	movl	$__NR_rt_sigprocmask, %eax
--	syscall
-+	SYSCALLDB
- 	popq	%rdi			/* Reload %rdi, adjust stack.  */
- 	cfi_adjust_cfa_offset(-8)
- 	cmpq	$-4095, %rax		/* Check %rax for error.  */
-diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
-index ab23985..38a6b69 100644
---- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c
-+++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
-@@ -129,7 +129,7 @@ asm									\
-    "	.type __" #name ",@function\n"					\
-    "__" #name ":\n"							\
-    "	movq $" #syscall ", %rax\n"					\
--   "	syscall\n"							\
-+   SYSCALLDB_ASM							\
-    ".LEND_" #name ":\n"							\
-    ".section .eh_frame,\"a\",@progbits\n"				\
-    ".LSTARTFRAME_" #name ":\n"						\
-diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
-index b3854fa..6369bfe 100644
---- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
-@@ -75,7 +75,7 @@ ENTRY(__swapcontext)
- 	movl	$SIG_SETMASK, %edi
- 	movl	$_NSIG8,%r10d
- 	movl	$__NR_rt_sigprocmask, %eax
--	syscall
-+	SYSCALLDB
- 	cmpq	$-4095, %rax		/* Check %rax for error.  */
- 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
- 
-diff --git a/sysdeps/unix/sysv/linux/x86_64/syscall.S b/sysdeps/unix/sysv/linux/x86_64/syscall.S
-index 92c2f5b..e32ebb2 100644
---- a/sysdeps/unix/sysv/linux/x86_64/syscall.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/syscall.S
-@@ -34,7 +34,7 @@
- 	movq %r8, %r10
- 	movq %r9, %r8
- 	movq 8(%rsp),%r9	/* arg6 is on the stack.  */
--	syscall			/* Do the system call.  */
-+	SYSCALLDB			/* Do the system call.  */
- 	cmpq $-4095, %rax	/* Check %rax for error.  */
- 	jae SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
- 	ret			/* Return to caller.  */
-diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
-index 4a9a9d9..dc452ed 100644
---- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
-+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
-@@ -21,6 +21,7 @@
- /* There is some commonality.  */
- #include <sysdeps/unix/x86_64/sysdep.h>
- #include <tls.h>
-+#include "syscalldb.h"
- 
- #ifdef IS_IN_rtld
- # include <dl-sysdep.h>		/* Defines RTLD_PRIVATE_ERRNO.  */
-@@ -176,7 +177,7 @@
- # define DO_CALL(syscall_name, args)		\
-     DOARGS_##args				\
-     movl $SYS_ify (syscall_name), %eax;		\
--    syscall;
-+    SYSCALLDB;
- 
- # define DOARGS_0 /* nothing */
- # define DOARGS_1 /* nothing */
-@@ -190,9 +191,20 @@
- /* Define a macro which expands inline into the wrapper code for a system
-    call.  */
- # undef INLINE_SYSCALL
--# define INLINE_SYSCALL(name, nr, args...) \
-+# define INLINE_SYSCALL(name, nr_args...) \
-   ({									      \
--    unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args);	      \
-+    unsigned long int resultvar = INTERNAL_SYSCALL (name, , ##nr_args);	      \
-+    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
-+      {									      \
-+	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
-+	resultvar = (unsigned long int) -1;				      \
-+      }									      \
-+    (long int) resultvar; })
-+
-+# undef INLINE_SYSCALL_ASM
-+# define INLINE_SYSCALL_ASM(name, nr_args...) \
-+  ({									      \
-+    unsigned long int resultvar = INTERNAL_SYSCALL_ASM (name, , ##nr_args);   \
-     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
-       {									      \
- 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
-@@ -204,9 +216,9 @@
-    into the wrapper code for a system call.  It should be used when size
-    of any argument > size of long int.  */
- # undef INLINE_SYSCALL_TYPES
--# define INLINE_SYSCALL_TYPES(name, nr, args...) \
-+# define INLINE_SYSCALL_TYPES(name, nr_args...) \
-   ({									      \
--    unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args);  \
-+    unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , ##nr_args); \
-     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
-       {									      \
- 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
-@@ -223,13 +235,19 @@
-     LOAD_ARGS_##nr (args)						      \
-     LOAD_REGS_##nr							      \
-     asm volatile (							      \
--    "syscall\n\t"							      \
-+    SYSCALLDB								      \
-     : "=a" (resultvar)							      \
-     : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
-     (long int) resultvar; })
-+# define INTERNAL_SYSCALL_NCS_ASM INTERNAL_SYSCALL_NCS
-+
- # undef INTERNAL_SYSCALL
--# define INTERNAL_SYSCALL(name, err, nr, args...) \
--  INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
-+# define INTERNAL_SYSCALL(name, err, nr_args...) \
-+  INTERNAL_SYSCALL_NCS (__NR_##name, err, ##nr_args)
-+
-+# undef INTERNAL_SYSCALL_ASM
-+# define INTERNAL_SYSCALL_ASM(name, err, nr_args...) \
-+  INTERNAL_SYSCALL_NCS_ASM (__NR_##name, err, ##nr_args)
- 
- # define INTERNAL_SYSCALL_NCS_TYPES(name, err, nr, args...) \
-   ({									      \
-@@ -237,7 +255,7 @@
-     LOAD_ARGS_TYPES_##nr (args)						      \
-     LOAD_REGS_TYPES_##nr (args)						      \
-     asm volatile (							      \
--    "syscall\n\t"							      \
-+    SYSCALLDB								      \
-     : "=a" (resultvar)							      \
-     : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
-     (long int) resultvar; })
-diff --git a/sysdeps/unix/sysv/linux/x86_64/vfork.S b/sysdeps/unix/sysv/linux/x86_64/vfork.S
-index d3b450a..75a63e1 100644
---- a/sysdeps/unix/sysv/linux/x86_64/vfork.S
-+++ b/sysdeps/unix/sysv/linux/x86_64/vfork.S
-@@ -38,7 +38,7 @@ ENTRY (__vfork)
- 
- 	/* Stuff the syscall number in RAX and enter into the kernel.  */
- 	movl	$SYS_ify (vfork), %eax
--	syscall
-+	SYSCALLDB
- 
- 	/* Push back the return PC.  */
- 	pushq	%rdi
-diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
-index 504c95f..dcfc259 100644
---- a/sysdeps/x86_64/dl-machine.h
-+++ b/sysdeps/x86_64/dl-machine.h
-@@ -529,7 +529,8 @@ elf_machine_lazy_rel (struct link_map *map,
- 	value = ((ElfW(Addr) (*) (void)) value) ();
-       *reloc_addr = value;
-     }
--  else
-+  /* for graphene, get around R_X86_64_NONE */
-+  else if (__builtin_expect (r_type != R_X86_64_NONE, 1))
-     _dl_reloc_bad_type (map, r_type, 1);
- }
- 

+ 0 - 29
LibOS/glibc-patches/hp-timing-2.19.patch

@@ -1,29 +0,0 @@
-diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h
-index d88206c..886c500 100644
---- a/sysdeps/x86_64/hp-timing.h
-+++ b/sysdeps/x86_64/hp-timing.h
-@@ -18,23 +18,6 @@
- 
- #ifndef _HP_TIMING_H
- 
--/* We can use some of the i686 implementation without changes.  */
--# include <sysdeps/i386/i686/hp-timing.h>
--
--/* The "=A" constraint used in 32-bit mode does not work in 64-bit mode.  */
--# undef HP_TIMING_NOW
--# define HP_TIMING_NOW(Var) \
--  ({ unsigned int _hi, _lo; \
--     asm volatile ("rdtsc" : "=a" (_lo), "=d" (_hi)); \
--     (Var) = ((unsigned long long int) _hi << 32) | _lo; })
--
--/* The funny business for 32-bit mode is not required here.  */
--# undef HP_TIMING_ACCUM
--# define HP_TIMING_ACCUM(Sum, Diff)					      \
--  do {									      \
--    hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);		      \
--    __asm__ __volatile__ ("lock; addq %1, %0"				      \
--			  : "=m" (Sum) : "r" (__diff), "m" (Sum));	      \
--  } while (0)
-+#include <sysdeps/generic/hp-timing.h>
- 
- #endif /* hp-timing.h */

+ 0 - 25
LibOS/glibc-patches/liblibos-2.19.patch

@@ -1,25 +0,0 @@
-diff --git a/Versions.def b/Versions.def
-index 759c754..e1a270e 100644
---- a/Versions.def
-+++ b/Versions.def
-@@ -148,3 +152,6 @@ libanl {
- libcidn {
-   GLIBC_PRIVATE
- }
-+liblibos {
-+  GLIBC_2.19
-+}
-diff --git a/shlib-versions b/shlib-versions
-index 78b0ad7..5c3dcf2 100644
---- a/shlib-versions
-+++ b/shlib-versions
-@@ -64,6 +64,9 @@ sh.*-.*-linux.*		ld=ld-linux.so.2	GLIBC_
- # The -ldl interface (see <dlfcn.h>) is the same on all platforms.
- .*-.*-.*		libdl=2
- 
-+# Interface for Graphene
-+.*-.*-.*		liblibos=1
-+
- # So far the -lutil interface is the same on all platforms, except for the
- # `struct utmp' format, which depends on libc.
- .*-.*-.*		libutil=1

+ 0 - 84
LibOS/glibc-patches/no-pie.patch

@@ -1,84 +0,0 @@
-diff -ruNp glibc-2.19.old/config.make.in glibc-2.19/config.make.in
---- glibc-2.19.old/config.make.in	2018-08-24 13:30:14.939687483 -0700
-+++ glibc-2.19/config.make.in	2018-08-24 13:57:37.098712466 -0700
-@@ -83,6 +83,7 @@ nss-crypt = @libc_cv_nss_crypt@
- # Configuration options.
- build-shared = @shared@
- build-pic-default= @libc_cv_pic_default@
-+build-pie-default= @libc_cv_pie_default@
- build-profile = @profile@
- build-static-nss = @static_nss@
- add-ons = @add_ons@
-diff -ruNp glibc-2.19.old/configure glibc-2.19/configure
---- glibc-2.19.old/configure	2018-08-24 13:30:15.335684965 -0700
-+++ glibc-2.19/configure	2018-08-24 14:09:29.444245054 -0700
-@@ -577,6 +577,7 @@ DEFINES
- static_nss
- profile
- libc_cv_pic_default
-+libc_cv_pie_default
- shared
- static
- ldd_rewrite_script
-@@ -7475,7 +7476,24 @@ $as_echo "$libc_cv_pic_default" >&6; }
- 
- 
- 
--
-+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
-+$as_echo_n "checking whether -fPIE is default... " >&6; }
-+if ${libc_cv_pie_default+:} false; then :
-+  $as_echo_n "(cached) " >&6
-+else
-+  libc_cv_pie_default=yes
-+cat > conftest.c <<EOF
-+#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
-+# error PIE is default.
-+#endif
-+EOF
-+if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
-+  libc_cv_pie_default=no
-+fi
-+rm -f conftest.*
-+fi
-+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pie_default" >&5
-+$as_echo "$libc_cv_pie_default" >&6; }
- 
- 
- 
-diff -ruNp glibc-2.19.old/configure.ac glibc-2.19/configure.ac
---- glibc-2.19.old/configure.ac	2018-08-24 13:30:14.939687483 -0700
-+++ glibc-2.19/configure.ac	2018-08-24 14:01:45.041985550 -0700
-@@ -2160,6 +2160,19 @@ fi
- rm -f conftest.*])
- AC_SUBST(libc_cv_pic_default)
- 
-+AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
-+[libc_cv_pie_default=yes
-+cat > conftest.c <<EOF
-+#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
-+# error PIE is default.
-+#endif
-+EOF
-+if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
-+  libc_cv_pie_default=no
-+fi
-+rm -f conftest.*])
-+AC_SUBST(libc_cv_pie_default)
-+
- AC_SUBST(profile)
- AC_SUBST(static_nss)
- 
-diff -ruNp glibc-2.19.old/Makeconfig glibc-2.19/Makeconfig
---- glibc-2.19.old/Makeconfig	2018-08-24 13:30:15.331684992 -0700
-+++ glibc-2.19/Makeconfig	2018-08-24 14:09:01.436358826 -0700
-@@ -424,6 +424,9 @@ ifndef +link-static
- endif
- # Commands for linking programs with the C library.
- ifndef +link
-+ifeq (yes,$(build-pie-default))
-+LDFLAGS += -no-pie
-+endif
- ifeq (yes,$(build-shared))
- +link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
- 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \