Merge "Fixed int fast types for LP64"
diff --git a/HACKING.txt b/HACKING.txt
new file mode 100644
index 0000000..5785b30
--- /dev/null
+++ b/HACKING.txt
@@ -0,0 +1,163 @@
+Working on bionic
+=================
+
+What are the big pieces of bionic?
+----------------------------------
+
+libc/ --- libc.so, libc.a
+  The C library. Stuff like fopen(3) and kill(2).
+libm/ --- libm.so, libm.a
+  The math library. Traditionally Unix systems kept stuff like sin(3) and
+  cos(3) in a separate library to save space in the days before shared
+  libraries.
+libdl/ --- libdl.so
+  The dynamic linker interface library. This is actually just a bunch of
+  stubs that the dynamic linker replaces with pointers to its own
+  implementation at runtime. This is where stuff like dlopen(3) lives.
+libstdc++/ --- libstdc++.so
+  The C++ ABI support functions. The C++ compiler doesn't know how to
+  implement thread-safe static initialization and the like, so it just calls
+  functions that are supplied by the system. Stuff like __cxa_guard_acquire
+  and __cxa_pure_virtual live here.
+
+linker/ --- /system/bin/linker and /system/bin/linker64
+  The dynamic linker. When you run a dynamically-linked executable, its ELF
+  file has a DT_INTERP entry that says "use the following program to start me".
+  On Android, that's either linker or linker64 (depending on whether it's a
+  32-bit or 64-bit executable). It's responsible for loading the ELF executable
+  into memory and resolving references to symbols (so that when your code tries
+  to jump to fopen(3), say, it lands in the right place).
+
+tests/ --- unit tests
+  The tests/ directory contains unit tests. Roughly arranged as one file per
+  publicly-exported header file.
+benchmarks/ --- benchmarks
+  The benchmarks/ directory contains benchmarks.
+
+
+What's in libc/?
+----------------
+
+libc/
+  arch-arm/
+  arch-arm64/
+  arch-common/
+  arch-mips/
+  arch-mips64/
+  arch-x86/
+  arch-x86_64/
+    # Each architecture has its own subdirectory for stuff that isn't shared
+    # because it's architecture-specific. There will be a .mk file in here that
+    # drags in all the architecture-specific files.
+    bionic/
+      # Every architecture needs a handful of machine-specific assembler files.
+      # They live here.
+    include/
+      machine/
+        # The majority of header files are actually in libc/include/, but many
+        # of them pull in a <machine/something.h> for things like limits,
+        # endianness, and how floating point numbers are represented. Those
+        # headers live here.
+    string/
+      # Most architectures have a handful of optional assembler files
+      # implementing optimized versions of various routines. The <string.h>
+      # functions are particular favorites.
+    syscalls/
+      # The syscalls directories contain script-generated assembler files.
+      # See 'Adding system calls' later.
+
+  include/
+    # The public header files on everyone's include path. These are a mixture of
+    # files written by us and files taken from BSD.
+
+  kernel/
+    # The kernel uapi header files. These are scrubbed copies of the originals
+    # in external/kernel-headers/. These files must not be edited directly. The
+    # generate_uapi_headers.sh script should be used to go from a kernel tree to
+    # external/kernel-headers/ --- this takes care of the architecture-specific
+    # details. The update_all.py script should be used to regenerate bionic's
+    # scrubbed headers from external/kernel-headers/.
+
+  private/
+    # These are private header files meant for use within bionic itself.
+
+  netbsd/
+  stdio/
+  stdlib/
+  string/
+  unistd/
+  wchar/
+    # These are legacy files of unknown provenance. In the past, bionic was a
+    # mess of random versions of random files from all three of FreeBSD, NetBSD,
+    # and OpenBSD! We've been working to clean that up, but these directories
+    # are basically where all the stuff we haven't got to yet lives.
+    # The 'netbsd' directory misleadingly contains the DNS resolver (which will
+    # probably be forked sometime soon, and that directory simply renamed).
+    # The other directories contain stuff that still needs to be sorted.
+
+  upstream-dlmalloc/
+  upstream-freebsd/
+  upstream-netbsd/
+  upstream-openbsd/
+    # These directories contain unmolested upstream source. Any time we can
+    # just use a BSD implementation of something unmodified, we should.
+    # See files like netbsd-compat.h for various ways in which we manage to
+    # build BSD source in bionic.
+
+  bionic/
+    # This is the biggest mess. The C++ files are files we own, typically
+    # because the Linux kernel interface is sufficiently different that we
+    # can't use any of the BSD implementations. The C files are usually
+    # legacy mess that needs to be sorted out, either by replacing it with
+    # current upstream source in one of the upstream directories or by
+    # switching the file to C++ and cleaning it up.
+
+  tools/
+    # Various tools used to maintain bionic.
+
+  tzcode/
+    # A modified superset of the IANA tzcode. Most of the modifications relate
+    # to Android's use of a single file (with corresponding index) to contain
+    # time zone data.
+  zoneinfo/
+    # Android-format time zone data.
+    # See 'Updating tzdata' later.
+
+
+Adding system calls
+-------------------
+
+Adding a system call usually involves:
+
+  1. Add entries to SYSCALLS.TXT.
+     See SYSCALLS.TXT itself for documentation on the format.
+  2. Run the gensyscalls.py script.
+  3. Add constants (and perhaps types) to the appropriate header file.
+     Note that you should check to see whether the constants are already in
+     kernel uapi header files, in which case you just need to make sure that
+     that appropriate POSIX header file in libc/include/ includes the
+     relevant file or files.
+  4. Add function declarations to the appropriate header file.
+  5. Add at least basic tests. Even a test that deliberately supplies
+     an invalid argument helps check that we're generating the right symbol
+     and have the right declaration in the header file. (And strace(1) can
+     confirm that the correct system call is being made.)
+
+
+Updating kernel header files
+----------------------------
+
+As mentioned above, this is currently a two-step process:
+
+  1. Use generate_uapi_headers.sh to go from a Linux source tree to appropriate
+     contents for external/kernel-headers/.
+  2. Run update_all.py to scrub those headers and import them into bionic.
+
+
+Updating tzdata
+---------------
+
+This is fully automated:
+
+  1. Run update-tzdata.py.
+
diff --git a/libc/Android.mk b/libc/Android.mk
index ad5fb1c..9cde073 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -156,38 +156,6 @@
     wchar/wcswidth.c \
     wchar/wcsxfrm.c \
 
-
-libc_dns_src_files += \
-    netbsd/gethnamaddr.c \
-    netbsd/inet/nsap_addr.c \
-    netbsd/nameser/ns_name.c \
-    netbsd/nameser/ns_netint.c \
-    netbsd/nameser/ns_parse.c \
-    netbsd/nameser/ns_print.c \
-    netbsd/nameser/ns_samedomain.c \
-    netbsd/nameser/ns_ttl.c \
-    netbsd/net/base64.c \
-    netbsd/net/getaddrinfo.c \
-    netbsd/net/getnameinfo.c \
-    netbsd/net/getservbyname.c \
-    netbsd/net/getservbyport.c \
-    netbsd/net/getservent.c \
-    netbsd/net/nsdispatch.c \
-    netbsd/resolv/__dn_comp.c \
-    netbsd/resolv/herror.c \
-    netbsd/resolv/res_cache.c \
-    netbsd/resolv/__res_close.c \
-    netbsd/resolv/res_comp.c \
-    netbsd/resolv/res_data.c \
-    netbsd/resolv/res_debug.c \
-    netbsd/resolv/res_init.c \
-    netbsd/resolv/res_mkquery.c \
-    netbsd/resolv/res_query.c \
-    netbsd/resolv/__res_send.c \
-    netbsd/resolv/res_send.c \
-    netbsd/resolv/res_state.c \
-
-
 # Fortify implementations of libc functions.
 libc_common_src_files += \
     bionic/__FD_chk.cpp \
@@ -309,7 +277,6 @@
     bionic/wait.cpp \
     bionic/wchar.cpp \
 
-
 libc_upstream_freebsd_src_files := \
     upstream-freebsd/lib/libc/gen/sleep.c \
     upstream-freebsd/lib/libc/gen/usleep.c \
@@ -378,47 +345,47 @@
 libc_upstream_netbsd_src_files := \
     upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
     upstream-netbsd/common/lib/libc/inet/inet_addr.c \
-    upstream-netbsd/libc/gen/ftw.c \
-    upstream-netbsd/libc/gen/nftw.c \
-    upstream-netbsd/libc/gen/nice.c \
-    upstream-netbsd/libc/gen/popen.c \
-    upstream-netbsd/libc/gen/psignal.c \
-    upstream-netbsd/libc/gen/setjmperr.c \
-    upstream-netbsd/libc/gen/utime.c \
-    upstream-netbsd/libc/inet/inet_ntoa.c \
-    upstream-netbsd/libc/inet/inet_ntop.c \
-    upstream-netbsd/libc/inet/inet_pton.c \
-    upstream-netbsd/libc/isc/ev_streams.c \
-    upstream-netbsd/libc/isc/ev_timers.c \
-    upstream-netbsd/libc/regex/regcomp.c \
-    upstream-netbsd/libc/regex/regerror.c \
-    upstream-netbsd/libc/regex/regexec.c \
-    upstream-netbsd/libc/regex/regfree.c \
-    upstream-netbsd/libc/stdio/getdelim.c \
-    upstream-netbsd/libc/stdio/getline.c \
-    upstream-netbsd/libc/stdlib/bsearch.c \
-    upstream-netbsd/libc/stdlib/div.c \
-    upstream-netbsd/libc/stdlib/drand48.c \
-    upstream-netbsd/libc/stdlib/erand48.c \
-    upstream-netbsd/libc/stdlib/exit.c \
-    upstream-netbsd/libc/stdlib/jrand48.c \
-    upstream-netbsd/libc/stdlib/ldiv.c \
-    upstream-netbsd/libc/stdlib/lldiv.c \
-    upstream-netbsd/libc/stdlib/lrand48.c \
-    upstream-netbsd/libc/stdlib/mrand48.c \
-    upstream-netbsd/libc/stdlib/nrand48.c \
-    upstream-netbsd/libc/stdlib/_rand48.c \
-    upstream-netbsd/libc/stdlib/seed48.c \
-    upstream-netbsd/libc/stdlib/srand48.c \
-    upstream-netbsd/libc/stdlib/tdelete.c \
-    upstream-netbsd/libc/stdlib/tfind.c \
-    upstream-netbsd/libc/stdlib/tsearch.c \
-    upstream-netbsd/libc/string/memccpy.c \
-    upstream-netbsd/libc/string/strcasestr.c \
-    upstream-netbsd/libc/string/strcoll.c \
-    upstream-netbsd/libc/string/strxfrm.c \
-    upstream-netbsd/libc/thread-stub/__isthreaded.c \
-    upstream-netbsd/libc/unistd/killpg.c \
+    upstream-netbsd/lib/libc/gen/ftw.c \
+    upstream-netbsd/lib/libc/gen/nftw.c \
+    upstream-netbsd/lib/libc/gen/nice.c \
+    upstream-netbsd/lib/libc/gen/popen.c \
+    upstream-netbsd/lib/libc/gen/psignal.c \
+    upstream-netbsd/lib/libc/gen/setjmperr.c \
+    upstream-netbsd/lib/libc/gen/utime.c \
+    upstream-netbsd/lib/libc/inet/inet_ntoa.c \
+    upstream-netbsd/lib/libc/inet/inet_ntop.c \
+    upstream-netbsd/lib/libc/inet/inet_pton.c \
+    upstream-netbsd/lib/libc/isc/ev_streams.c \
+    upstream-netbsd/lib/libc/isc/ev_timers.c \
+    upstream-netbsd/lib/libc/regex/regcomp.c \
+    upstream-netbsd/lib/libc/regex/regerror.c \
+    upstream-netbsd/lib/libc/regex/regexec.c \
+    upstream-netbsd/lib/libc/regex/regfree.c \
+    upstream-netbsd/lib/libc/stdio/getdelim.c \
+    upstream-netbsd/lib/libc/stdio/getline.c \
+    upstream-netbsd/lib/libc/stdlib/bsearch.c \
+    upstream-netbsd/lib/libc/stdlib/div.c \
+    upstream-netbsd/lib/libc/stdlib/drand48.c \
+    upstream-netbsd/lib/libc/stdlib/erand48.c \
+    upstream-netbsd/lib/libc/stdlib/exit.c \
+    upstream-netbsd/lib/libc/stdlib/jrand48.c \
+    upstream-netbsd/lib/libc/stdlib/ldiv.c \
+    upstream-netbsd/lib/libc/stdlib/lldiv.c \
+    upstream-netbsd/lib/libc/stdlib/lrand48.c \
+    upstream-netbsd/lib/libc/stdlib/mrand48.c \
+    upstream-netbsd/lib/libc/stdlib/nrand48.c \
+    upstream-netbsd/lib/libc/stdlib/_rand48.c \
+    upstream-netbsd/lib/libc/stdlib/seed48.c \
+    upstream-netbsd/lib/libc/stdlib/srand48.c \
+    upstream-netbsd/lib/libc/stdlib/tdelete.c \
+    upstream-netbsd/lib/libc/stdlib/tfind.c \
+    upstream-netbsd/lib/libc/stdlib/tsearch.c \
+    upstream-netbsd/lib/libc/string/memccpy.c \
+    upstream-netbsd/lib/libc/string/strcasestr.c \
+    upstream-netbsd/lib/libc/string/strcoll.c \
+    upstream-netbsd/lib/libc/string/strxfrm.c \
+    upstream-netbsd/lib/libc/thread-stub/__isthreaded.c \
+    upstream-netbsd/lib/libc/unistd/killpg.c \
 
 libc_arch_static_src_files := \
     bionic/dl_iterate_phdr_static.cpp \
@@ -512,13 +479,7 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := \
-    tzcode/asctime.c \
-    tzcode/difftime.c \
-    tzcode/localtime.c \
-    tzcode/strftime.c \
-    tzcode/strptime.c \
-
+LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
 LOCAL_CFLAGS := \
     $(libc_common_cflags) \
     -DSTD_INSPIRED=1 \
@@ -542,13 +503,12 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := $(libc_dns_src_files)
+LOCAL_SRC_FILES := $(call all-c-files-under,netbsd)
 LOCAL_CFLAGS := \
     $(libc_common_cflags) \
     -DINET6 \
     -I$(LOCAL_PATH)/private \
-    -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for NetBSD private headers
-
+    -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include # for NetBSD private headers
 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 LOCAL_CPPFLAGS := $(libc_common_cppflags)
 LOCAL_C_INCLUDES := $(libc_common_c_includes)
@@ -600,7 +560,7 @@
     $(libc_common_cflags) \
     -DPOSIX_MISTAKE \
     -I$(LOCAL_PATH)/upstream-netbsd \
-    -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
+    -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
     -include upstream-netbsd/netbsd-compat.h
 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 LOCAL_CPPFLAGS := $(libc_common_cppflags)
diff --git a/libc/arch-arm/arm.mk b/libc/arch-arm/arm.mk
index ccdf5a1..55f9978 100644
--- a/libc/arch-arm/arm.mk
+++ b/libc/arch-arm/arm.mk
@@ -41,10 +41,7 @@
 #    bionic/__strcpy_chk.cpp \
 #    bionic/__strcat_chk.cpp \
 
-# cflags
-libc_common_cflags_arm := \
-    -DSOFTFLOAT \
-    -fstrict-aliasing
+libc_common_cflags_arm := -DSOFTFLOAT
 
 ##########################################
 ### CPU specific source files
@@ -64,13 +61,8 @@
     arch-arm/bionic/sigsetjmp.S \
     arch-arm/bionic/syscall.S \
 
-# These are used by the static and dynamic versions of the libc
-# respectively.
-libc_arch_static_src_files_arm := \
-    arch-arm/bionic/exidx_static.c \
-
-libc_arch_dynamic_src_files_arm := \
-    arch-arm/bionic/exidx_dynamic.c \
+libc_arch_static_src_files_arm := arch-arm/bionic/exidx_static.c
+libc_arch_dynamic_src_files_arm := arch-arm/bionic/exidx_dynamic.c
 
 ## CPU variant specific source files
 ifeq ($(strip $(TARGET_$(my_2nd_arch_prefix)CPU_VARIANT)),)
@@ -85,8 +77,7 @@
 
 cpu_variant_mk :=
 
-##########################################
-# crt-related
+
 libc_crt_target_cflags_arm := \
     -I$(LOCAL_PATH)/arch-arm/include \
     -mthumb-interwork
diff --git a/libc/arch-arm/bionic/__get_sp.S b/libc/arch-arm/bionic/__get_sp.S
index 2a7e7b7..aabec6d 100644
--- a/libc/arch-arm/bionic/__get_sp.S
+++ b/libc/arch-arm/bionic/__get_sp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(__get_sp)
   mov r0, sp
diff --git a/libc/arch-arm/bionic/_setjmp.S b/libc/arch-arm/bionic/_setjmp.S
index 6b8aa50..64a0a31 100644
--- a/libc/arch-arm/bionic/_setjmp.S
+++ b/libc/arch-arm/bionic/_setjmp.S
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 #include <machine/cpu-features.h>
 
@@ -107,7 +107,7 @@
 
 	/* validation failed, die die die. */
 botch:
-	bl	PIC_SYM(_C_LABEL(longjmperror), PLT)
-	bl	PIC_SYM(_C_LABEL(abort), PLT)
+	bl	PIC_SYM(longjmperror, PLT)
+	bl	PIC_SYM(abort, PLT)
 	b	. - 8		/* Cannot get here */
 END(_longjmp)
diff --git a/libc/arch-arm/bionic/abort_arm.S b/libc/arch-arm/bionic/abort_arm.S
index 1aaf21a..6b181ef 100644
--- a/libc/arch-arm/bionic/abort_arm.S
+++ b/libc/arch-arm/bionic/abort_arm.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * Coding the abort function in assembly so that registers are guaranteed to
@@ -40,5 +40,5 @@
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r3, 0
     .cfi_rel_offset r14, 4
-    bl      PIC_SYM(_C_LABEL(__libc_android_abort), PLT)
+    bl      PIC_SYM(__libc_android_abort, PLT)
 END(abort)
diff --git a/libc/arch-arm/bionic/libgcc_compat.c b/libc/arch-arm/bionic/libgcc_compat.c
index f694060..c45e6e2 100644
--- a/libc/arch-arm/bionic/libgcc_compat.c
+++ b/libc/arch-arm/bionic/libgcc_compat.c
@@ -1,176 +1,90 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* This file contains dummy references to libgcc.a functions to force the
- * dynamic linker to copy their definition into the final libc.so binary.
- *
- * They are required to ensure backwards binary compatibility with
- * libc.so provided by the platform and binaries built with the NDK or
- * different versions/configurations of toolchains.
- *
- * Now, for a more elaborate description of the issue:
- *
- * libgcc.a is a compiler-specific library containing various helper
- * functions used to implement certain operations that are not necessarily
- * supported by the target CPU. For example, integer division doesn't have a
- * corresponding CPU instruction on ARMv5, and is instead implemented in the
- * compiler-generated machine code as a call to an __idiv helper function.
- *
- * Normally, one has to place libgcc.a in the link command used to generate
- * target binaries (shared libraries and executables) after all objects and
- * static libraries, but before dependent shared libraries, i.e. something
- * like:
- *         gcc <options> -o libfoo.so  foo.a libgcc.a -lc -lm
- *
- * This ensures that any helper function needed by the code in foo.a is copied
- * into the final libfoo.so. However, doing so will link a bunch of other __cxa
- * functions from libgcc.a into each .so and executable, causing 4k+ increase
- * in every binary. Therefore the Android platform build system has been
- * using this instead:
- *
- *         gcc <options> -o libfoo.so foo.a -lc -lm libgcc.a
- *
- * The problem with this is that if one helper function needed by foo.a has
- * already been copied into libc.so or libm.so, then nothing will be copied
- * into libfoo.so. Instead, a symbol import definition will be added to it
- * so libfoo.so can directly call the one in libc.so at runtime.
- *
- * When refreshing toolchains for new versions or using different architecture
- * flags, the set of helper functions copied to libc.so may change, which
- * resulted in some native shared libraries generated with the NDK or prebuilts
- * from vendors to fail to load properly.
- *
- * The NDK has been fixed after 1.6_r1 to use the correct link command, so
- * any native shared library generated with it should now be safe from that
- * problem. On the other hand, existing shared libraries distributed with
- * applications that were generated with a previous version of the NDK
- * still need all 1.5/1.6 helper functions in libc.so and libm.so
- *
- * After 3.2, the toolchain was updated again, adding __aeabi_f2uiz to the
- * list of requirements. Technically, this is due to mis-linked NDK libraries
- * but it is easier to add a single function here than asking several app
- * developers to fix their build.
- *
- * The __aeabi_idiv function is added to the list since cortex-a15 supports
- * HW idiv instructions so the system libc.so doesn't pull in the reference to
- * __aeabi_idiv but legacy libraries built against cortex-a9 targets still need
- * it.
- *
- * Final note: some of the functions below should really be in libm.so to
- *             completely reflect the state of 1.5/1.6 system images. However,
- *             since libm.so depends on libc.so, it's easier to put all of
- *             these in libc.so instead, since the dynamic linker will always
- *             search in libc.so before libm.so for dependencies.
- */
+/* Generated by genlibgcc_compat.py */
 
 #define   COMPAT_FUNCTIONS_LIST \
-    XX(__adddf3)             \
-    XX(__addsf3)             \
-    XX(__aeabi_cdcmpeq)      \
-    XX(__aeabi_cdcmple)      \
-    XX(__aeabi_cdrcmple)     \
-    XX(__aeabi_d2f)          \
-    XX(__aeabi_d2iz)         \
-    XX(__aeabi_dadd)         \
-    XX(__aeabi_dcmpeq)       \
-    XX(__aeabi_dcmpge)       \
-    XX(__aeabi_dcmpgt)       \
-    XX(__aeabi_dcmple)       \
-    XX(__aeabi_dcmplt)       \
-    XX(__aeabi_dcmpun)       \
-    XX(__aeabi_ddiv)         \
-    XX(__aeabi_dmul)         \
-    XX(__aeabi_drsub)        \
-    XX(__aeabi_dsub)         \
-    XX(__aeabi_f2d)          \
-    XX(__aeabi_f2iz)         \
-    XX(__aeabi_f2uiz)        \
-    XX(__aeabi_fadd)         \
-    XX(__aeabi_fcmpun)       \
-    XX(__aeabi_fdiv)         \
-    XX(__aeabi_fmul)         \
-    XX(__aeabi_frsub)        \
-    XX(__aeabi_fsub)         \
-    XX(__aeabi_i2d)          \
-    XX(__aeabi_i2f)          \
-    XX(__aeabi_idiv)         \
-    XX(__aeabi_idivmod)      \
-    XX(__aeabi_l2d)          \
-    XX(__aeabi_l2f)          \
-    XX(__aeabi_lasr)         \
-    XX(__aeabi_ldivmod)      \
-    XX(__aeabi_llsl)         \
-    XX(__aeabi_llsr)         \
-    XX(__aeabi_lmul)         \
-    XX(__aeabi_ui2d)         \
-    XX(__aeabi_ui2f)         \
-    XX(__aeabi_uidiv)        \
-    XX(__aeabi_uidivmod)     \
-    XX(__aeabi_ul2d)         \
-    XX(__aeabi_ul2f)         \
-    XX(__aeabi_uldivmod)     \
-    XX(__cmpdf2)             \
-    XX(__divdf3)             \
-    XX(__divsf3)             \
-    XX(__eqdf2)              \
-    XX(__extendsfdf2)        \
-    XX(__fixdfsi)            \
-    XX(__fixsfsi)            \
-    XX(__floatdidf)          \
-    XX(__floatdisf)          \
-    XX(__floatsidf)          \
-    XX(__floatsisf)          \
-    XX(__floatundidf)        \
-    XX(__floatundisf)        \
-    XX(__floatunsidf)        \
-    XX(__floatunsisf)        \
-    XX(__gedf2)              \
-    XX(__gtdf2)              \
-    XX(__ledf2)              \
-    XX(__ltdf2)              \
-    XX(__muldf3)             \
-    XX(__muldi3)             \
-    XX(__mulsf3)             \
-    XX(__nedf2)              \
-    XX(__popcountsi2)        \
-    XX(__popcount_tab)       \
-    XX(__subdf3)             \
-    XX(__subsf3)             \
-    XX(__truncdfsf2)         \
-    XX(__unorddf2)           \
-    XX(__unordsf2)           \
+    XX(__adddf3) \
+    XX(__addsf3) \
+    XX(__aeabi_cdcmpeq) \
+    XX(__aeabi_cdcmple) \
+    XX(__aeabi_cdrcmple) \
+    XX(__aeabi_d2f) \
+    XX(__aeabi_d2iz) \
+    XX(__aeabi_dadd) \
+    XX(__aeabi_dcmpeq) \
+    XX(__aeabi_dcmpge) \
+    XX(__aeabi_dcmpgt) \
+    XX(__aeabi_dcmple) \
+    XX(__aeabi_dcmplt) \
+    XX(__aeabi_dcmpun) \
+    XX(__aeabi_ddiv) \
+    XX(__aeabi_dmul) \
+    XX(__aeabi_drsub) \
+    XX(__aeabi_dsub) \
+    XX(__aeabi_f2d) \
+    XX(__aeabi_f2iz) \
+    XX(__aeabi_f2uiz) \
+    XX(__aeabi_fadd) \
+    XX(__aeabi_fcmpun) \
+    XX(__aeabi_fdiv) \
+    XX(__aeabi_fmul) \
+    XX(__aeabi_frsub) \
+    XX(__aeabi_fsub) \
+    XX(__aeabi_i2d) \
+    XX(__aeabi_i2f) \
+    XX(__aeabi_idiv) \
+    XX(__aeabi_idivmod) \
+    XX(__aeabi_l2d) \
+    XX(__aeabi_l2f) \
+    XX(__aeabi_lasr) \
+    XX(__aeabi_ldivmod) \
+    XX(__aeabi_llsl) \
+    XX(__aeabi_llsr) \
+    XX(__aeabi_lmul) \
+    XX(__aeabi_ui2d) \
+    XX(__aeabi_ui2f) \
+    XX(__aeabi_uidiv) \
+    XX(__aeabi_uidivmod) \
+    XX(__aeabi_ul2d) \
+    XX(__aeabi_ul2f) \
+    XX(__aeabi_uldivmod) \
+    XX(__aeabi_unwind_cpp_pr0) \
+    XX(__aeabi_unwind_cpp_pr1) \
+    XX(__cmpdf2) \
+    XX(__divdf3) \
+    XX(__divsf3) \
+    XX(__eqdf2) \
+    XX(__extendsfdf2) \
+    XX(__fixdfsi) \
+    XX(__fixsfsi) \
+    XX(__floatdidf) \
+    XX(__floatdisf) \
+    XX(__floatsidf) \
+    XX(__floatsisf) \
+    XX(__floatundidf) \
+    XX(__floatundisf) \
+    XX(__floatunsidf) \
+    XX(__floatunsisf) \
+    XX(__gedf2) \
+    XX(__gtdf2) \
+    XX(__ledf2) \
+    XX(__ltdf2) \
+    XX(__muldf3) \
+    XX(__muldi3) \
+    XX(__mulsf3) \
+    XX(__nedf2) \
+    XX(__popcount_tab) \
+    XX(__popcountsi2) \
+    XX(__subdf3) \
+    XX(__subsf3) \
+    XX(__truncdfsf2) \
+    XX(__unorddf2) \
+    XX(__unordsf2) \
+
 
 #define  XX(f)    extern void f(void);
 COMPAT_FUNCTIONS_LIST
 #undef XX
 
-void  __bionic_libgcc_compat_hooks(void)
-{
+void __bionic_libgcc_compat_hooks(void) {
 #define XX(f)    f();
 COMPAT_FUNCTIONS_LIST
 #undef XX
diff --git a/libc/arch-arm/bionic/memcmp.S b/libc/arch-arm/bionic/memcmp.S
index 0dc3af0..70a2a58 100644
--- a/libc/arch-arm/bionic/memcmp.S
+++ b/libc/arch-arm/bionic/memcmp.S
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 
 #ifdef HAVE_32_BYTE_CACHE_LINE
diff --git a/libc/arch-arm/bionic/memcmp16.S b/libc/arch-arm/bionic/memcmp16.S
index afbb1b0..3f2f2f1 100644
--- a/libc/arch-arm/bionic/memcmp16.S
+++ b/libc/arch-arm/bionic/memcmp16.S
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * Optimized memcmp16() for ARM9.
diff --git a/libc/arch-arm/bionic/memcpy.S b/libc/arch-arm/bionic/memcpy.S
index f25b3e3..2c9b10c 100644
--- a/libc/arch-arm/bionic/memcpy.S
+++ b/libc/arch-arm/bionic/memcpy.S
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 #if defined(__ARM_NEON__) && !defined(ARCH_ARM_USE_NON_NEON_MEMCPY)
 
diff --git a/libc/arch-arm/bionic/memcpy.a9.S b/libc/arch-arm/bionic/memcpy.a9.S
index 2ba1ff5..259701d 100644
--- a/libc/arch-arm/bionic/memcpy.a9.S
+++ b/libc/arch-arm/bionic/memcpy.a9.S
@@ -44,7 +44,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 	.syntax unified
 	/* This implementation requires ARM state.  */
diff --git a/libc/arch-arm/bionic/setjmp.S b/libc/arch-arm/bionic/setjmp.S
index 65b93fd..ed59d07 100644
--- a/libc/arch-arm/bionic/setjmp.S
+++ b/libc/arch-arm/bionic/setjmp.S
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 #include <machine/cpu-features.h>
 
@@ -56,7 +56,7 @@
 	.cfi_rel_offset r14, 4
 	mov	r0, #0x00000000
 
-	bl	PIC_SYM(_C_LABEL(sigblock), PLT)
+	bl	PIC_SYM(sigblock, PLT)
 	mov	r1, r0
 
 	ldmfd	sp!, {r0, r14}
@@ -108,11 +108,11 @@
 	.cfi_adjust_cfa_offset 4
 
 	mov	r0, r2
-	bl	PIC_SYM(_C_LABEL(sigsetmask), PLT)
+	bl	PIC_SYM(sigsetmask, PLT)
 
 	add	sp, sp, #4	/* unalign the stack */
 	.cfi_adjust_cfa_offset -4
-	ldmfd	sp!, {r0, r1, r14} 
+	ldmfd	sp!, {r0, r1, r14}
 	.cfi_def_cfa_offset 0
 
 #ifdef __ARM_HAVE_VFP
@@ -147,7 +147,7 @@
 
 	/* validation failed, die die die. */
 botch:
-	bl	PIC_SYM(_C_LABEL(longjmperror), PLT)
-	bl	PIC_SYM(_C_LABEL(abort), PLT)
+	bl	PIC_SYM(longjmperror, PLT)
+	bl	PIC_SYM(abort, PLT)
 	b	. - 8		/* Cannot get here */
 END(longjmp)
diff --git a/libc/arch-arm/bionic/sigsetjmp.S b/libc/arch-arm/bionic/sigsetjmp.S
index 12311e5..7016f50 100644
--- a/libc/arch-arm/bionic/sigsetjmp.S
+++ b/libc/arch-arm/bionic/sigsetjmp.S
@@ -35,7 +35,7 @@
 
 #define _ALIGN_TEXT .align 0
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
@@ -50,8 +50,8 @@
 
 ENTRY(sigsetjmp)
 	teq	r1, #0
-	beq	PIC_SYM(_C_LABEL(_setjmp), PLT)
-	b	PIC_SYM(_C_LABEL(setjmp), PLT)
+	beq	PIC_SYM(_setjmp, PLT)
+	b	PIC_SYM(setjmp, PLT)
 END(sigsetjmp)
 
 .L_setjmp_magic:
@@ -61,6 +61,6 @@
 	ldr	r2, .L_setjmp_magic
 	ldr	r3, [r0]
 	teq	r2, r3
-	beq	PIC_SYM(_C_LABEL(_longjmp), PLT)
-	b	PIC_SYM(_C_LABEL(longjmp), PLT)
+	beq	PIC_SYM(_longjmp, PLT)
+	b	PIC_SYM(longjmp, PLT)
 END(siglongjmp)
diff --git a/libc/arch-arm/bionic/strcmp.S b/libc/arch-arm/bionic/strcmp.S
index 42d41d1..6dba942 100644
--- a/libc/arch-arm/bionic/strcmp.S
+++ b/libc/arch-arm/bionic/strcmp.S
@@ -28,7 +28,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 	.text
 
diff --git a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
index dc86150..36da2d9 100644
--- a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
+++ b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
index 95aaf4f..c3e3e14 100644
--- a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
+++ b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a15/bionic/memcpy.S b/libc/arch-arm/cortex-a15/bionic/memcpy.S
index badc93b..da4f3dd 100644
--- a/libc/arch-arm/cortex-a15/bionic/memcpy.S
+++ b/libc/arch-arm/cortex-a15/bionic/memcpy.S
@@ -55,8 +55,8 @@
 
 // Prototype: void *memcpy (void *dst, const void *src, size_t count).
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
         .text
         .syntax unified
diff --git a/libc/arch-arm/cortex-a15/bionic/memset.S b/libc/arch-arm/cortex-a15/bionic/memset.S
index 4e6d322..12c68d6 100644
--- a/libc/arch-arm/cortex-a15/bionic/memset.S
+++ b/libc/arch-arm/cortex-a15/bionic/memset.S
@@ -27,8 +27,8 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
         /*
          * Optimized memset() for ARM.
diff --git a/libc/arch-arm/cortex-a15/bionic/strcat.S b/libc/arch-arm/cortex-a15/bionic/strcat.S
index 72d4e9e..b95be94 100644
--- a/libc/arch-arm/cortex-a15/bionic/strcat.S
+++ b/libc/arch-arm/cortex-a15/bionic/strcat.S
@@ -53,7 +53,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a15/bionic/strcmp.S b/libc/arch-arm/cortex-a15/bionic/strcmp.S
index 0cccf06..12da115 100644
--- a/libc/arch-arm/cortex-a15/bionic/strcmp.S
+++ b/libc/arch-arm/cortex-a15/bionic/strcmp.S
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 #ifdef __ARMEB__
 #define S2LOMEM lsl
diff --git a/libc/arch-arm/cortex-a15/bionic/strcpy.S b/libc/arch-arm/cortex-a15/bionic/strcpy.S
index 5773540..cb878c4 100644
--- a/libc/arch-arm/cortex-a15/bionic/strcpy.S
+++ b/libc/arch-arm/cortex-a15/bionic/strcpy.S
@@ -53,7 +53,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a15/bionic/strlen.S b/libc/arch-arm/cortex-a15/bionic/strlen.S
index 08f6d19..9a0ce62 100644
--- a/libc/arch-arm/cortex-a15/bionic/strlen.S
+++ b/libc/arch-arm/cortex-a15/bionic/strlen.S
@@ -53,7 +53,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
index 7009168..651aefc 100644
--- a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
+++ b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
     .syntax unified
     .fpu    neon
diff --git a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
index 908eec4..2447780 100644
--- a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
+++ b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
     .syntax unified
     .fpu    neon
diff --git a/libc/arch-arm/cortex-a9/bionic/memcpy.S b/libc/arch-arm/cortex-a9/bionic/memcpy.S
index 72c1a66..8dcd937 100644
--- a/libc/arch-arm/cortex-a9/bionic/memcpy.S
+++ b/libc/arch-arm/cortex-a9/bionic/memcpy.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
 /*
  * This code assumes it is running on a processor that supports all arm v7
diff --git a/libc/arch-arm/cortex-a9/bionic/memset.S b/libc/arch-arm/cortex-a9/bionic/memset.S
index 7f77dad..a5057eb 100644
--- a/libc/arch-arm/cortex-a9/bionic/memset.S
+++ b/libc/arch-arm/cortex-a9/bionic/memset.S
@@ -26,9 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/cpu-features.h>
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
 /*
  * This code assumes it is running on a processor that supports all arm v7
diff --git a/libc/arch-arm/cortex-a9/bionic/strcat.S b/libc/arch-arm/cortex-a9/bionic/strcat.S
index 0f5baef..f5a855e 100644
--- a/libc/arch-arm/cortex-a9/bionic/strcat.S
+++ b/libc/arch-arm/cortex-a9/bionic/strcat.S
@@ -53,7 +53,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a9/bionic/strcmp.S b/libc/arch-arm/cortex-a9/bionic/strcmp.S
index eacdb89..2411c65 100644
--- a/libc/arch-arm/cortex-a9/bionic/strcmp.S
+++ b/libc/arch-arm/cortex-a9/bionic/strcmp.S
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 #ifdef __ARMEB__
 #define S2LOMEM lsl
diff --git a/libc/arch-arm/cortex-a9/bionic/strcpy.S b/libc/arch-arm/cortex-a9/bionic/strcpy.S
index 9aa4f88..9e9610b 100644
--- a/libc/arch-arm/cortex-a9/bionic/strcpy.S
+++ b/libc/arch-arm/cortex-a9/bionic/strcpy.S
@@ -53,7 +53,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/cortex-a9/bionic/strlen.S b/libc/arch-arm/cortex-a9/bionic/strlen.S
index 259eda0..b92b043 100644
--- a/libc/arch-arm/cortex-a9/bionic/strlen.S
+++ b/libc/arch-arm/cortex-a9/bionic/strlen.S
@@ -53,7 +53,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/generic/bionic/memcpy.S b/libc/arch-arm/generic/bionic/memcpy.S
index 699b88d..cd4a13d 100644
--- a/libc/arch-arm/generic/bionic/memcpy.S
+++ b/libc/arch-arm/generic/bionic/memcpy.S
@@ -27,8 +27,8 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
         /*
          * Optimized memcpy() for ARM.
diff --git a/libc/arch-arm/generic/bionic/memset.S b/libc/arch-arm/generic/bionic/memset.S
index baeb519..be35de9 100644
--- a/libc/arch-arm/generic/bionic/memset.S
+++ b/libc/arch-arm/generic/bionic/memset.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
         /*
          * Optimized memset() for ARM.
diff --git a/libc/arch-arm/generic/bionic/strcmp.S b/libc/arch-arm/generic/bionic/strcmp.S
index 42d41d1..6dba942 100644
--- a/libc/arch-arm/generic/bionic/strcmp.S
+++ b/libc/arch-arm/generic/bionic/strcmp.S
@@ -28,7 +28,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 	.text
 
diff --git a/libc/arch-arm/generic/bionic/strcpy.S b/libc/arch-arm/generic/bionic/strcpy.S
index cc997f4..802a62d 100644
--- a/libc/arch-arm/generic/bionic/strcpy.S
+++ b/libc/arch-arm/generic/bionic/strcpy.S
@@ -30,7 +30,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(strcpy)
 	pld	[r1, #0]
diff --git a/libc/arch-arm/include/machine/asm.h b/libc/arch-arm/include/machine/asm.h
index f16baf8..7954f05 100644
--- a/libc/arch-arm/include/machine/asm.h
+++ b/libc/arch-arm/include/machine/asm.h
@@ -38,107 +38,22 @@
 #ifndef _ARM32_ASM_H_
 #define _ARM32_ASM_H_
 
-#ifdef __ELF__
-# define _C_LABEL(x)	x
-#else
-# ifdef __STDC__
-#  define _C_LABEL(x)	_ ## x
-# else
-#  define _C_LABEL(x)	_/**/x
-# endif
-#endif
-#define	_ASM_LABEL(x)	x
-
-#ifdef __STDC__
-# define __CONCAT(x,y)	x ## y
-# define __STRING(x)	#x
-#else
-# define __CONCAT(x,y)	x/**/y
-# define __STRING(x)	"x"
-#endif
-
 #ifndef _ALIGN_TEXT
 # define _ALIGN_TEXT .align 0
 #endif
 
-/*
- * gas/arm uses @ as a single comment character and thus cannot be used here
- * Instead it recognised the # instead of an @ symbols in .type directives
- * We define a couple of macros so that assembly code will not be dependant
- * on one or the other.
- */
-#define _ASM_TYPE_FUNCTION	#function
-#define _ASM_TYPE_OBJECT	#object
-#define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart; .cfi_startproc;
+#undef __bionic_asm_custom_entry
+#undef __bionic_asm_custom_end
+#define __bionic_asm_custom_entry(f) .fnstart
+#define __bionic_asm_custom_end(f) .fnend
 
-#define _ASM_SIZE(x)	.size x, .-x;
-
-#define _END(x) \
-	.fnend; .cfi_endproc; \
-	_ASM_SIZE(x)
-
-#ifdef GPROF
-# ifdef __ELF__
-#  define _PROF_PROLOGUE	\
-	mov ip, lr; bl __mcount
-# else
-#  define _PROF_PROLOGUE	\
-	mov ip,lr; bl mcount
-# endif
-#else
-# define _PROF_PROLOGUE
-#endif
-
-#define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
-#define	ENTRY_NP(y)	_ENTRY(_C_LABEL(y))
-#define	END(y)		_END(_C_LABEL(y))
-#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
-#define	ASENTRY_NP(y)	_ENTRY(_ASM_LABEL(y))
-#define	ASEND(y)	_END(_ASM_LABEL(y))
-
-#ifdef __ELF__
-#define ENTRY_PRIVATE(y)  ENTRY(y); .hidden _C_LABEL(y)
-#else
-#define ENTRY_PRIVATE(y)  ENTRY(y)
-#endif
-
-#define	ASMSTR		.asciz
+#undef __bionic_asm_function_type
+#define __bionic_asm_function_type #function
 
 #if defined(__ELF__) && defined(PIC)
-#ifdef __STDC__
-#define	PIC_SYM(x,y)	x ## ( ## y ## )
+#define PIC_SYM(x,y) x ## ( ## y ## )
 #else
-#define	PIC_SYM(x,y)	x/**/(/**/y/**/)
+#define PIC_SYM(x,y) x
 #endif
-#else
-#define	PIC_SYM(x,y)	x
-#endif
-
-#ifdef __ELF__
-#define RCSID(x)	.section ".ident"; .asciz x
-#else
-#define RCSID(x)	.text; .asciz x
-#endif
-
-#ifdef __ELF__
-#define	WEAK_ALIAS(alias,sym)						\
-	.weak alias;							\
-	alias = sym
-#endif
-
-#ifdef __STDC__
-#define	WARN_REFERENCES(sym,msg)					\
-	.stabs msg ## ,30,0,0,0 ;					\
-	.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
-#elif defined(__ELF__)
-#define	WARN_REFERENCES(sym,msg)					\
-	.stabs msg,30,0,0,0 ;						\
-	.stabs __STRING(sym),1,0,0,0
-#else
-#define	WARN_REFERENCES(sym,msg)					\
-	.stabs msg,30,0,0,0 ;						\
-	.stabs __STRING(_/**/sym),1,0,0,0
-#endif /* __STDC__ */
 
 #endif /* !_ARM_ASM_H_ */
diff --git a/libc/arch-arm/krait/bionic/__strcat_chk.S b/libc/arch-arm/krait/bionic/__strcat_chk.S
index a5d06f3..34becdb 100644
--- a/libc/arch-arm/krait/bionic/__strcat_chk.S
+++ b/libc/arch-arm/krait/bionic/__strcat_chk.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/krait/bionic/__strcpy_chk.S b/libc/arch-arm/krait/bionic/__strcpy_chk.S
index 95aaf4f..c3e3e14 100644
--- a/libc/arch-arm/krait/bionic/__strcpy_chk.S
+++ b/libc/arch-arm/krait/bionic/__strcpy_chk.S
@@ -26,8 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
     .syntax unified
 
diff --git a/libc/arch-arm/krait/bionic/memcpy.S b/libc/arch-arm/krait/bionic/memcpy.S
index 54405fa..0b7b276 100644
--- a/libc/arch-arm/krait/bionic/memcpy.S
+++ b/libc/arch-arm/krait/bionic/memcpy.S
@@ -28,8 +28,8 @@
 
 /* Assumes neon instructions and a cache line size of 32 bytes. */
 
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
 /*
  * This code assumes it is running on a processor that supports all arm v7
diff --git a/libc/arch-arm/krait/bionic/memset.S b/libc/arch-arm/krait/bionic/memset.S
index 1563327..5d1943b 100644
--- a/libc/arch-arm/krait/bionic/memset.S
+++ b/libc/arch-arm/krait/bionic/memset.S
@@ -27,8 +27,8 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
-#include "private/libc_events.h"
+#include <private/bionic_asm.h>
+#include <private/libc_events.h>
 
 /*
  * This code assumes it is running on a processor that supports all arm v7
diff --git a/libc/arch-arm/krait/bionic/strcmp.S b/libc/arch-arm/krait/bionic/strcmp.S
index f735fb5..eacb82a 100644
--- a/libc/arch-arm/krait/bionic/strcmp.S
+++ b/libc/arch-arm/krait/bionic/strcmp.S
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 #ifdef __ARMEB__
 #define S2LOMEM lsl
diff --git a/libc/arch-arm64/arm64.mk b/libc/arch-arm64/arm64.mk
index 4b47c6d..a645949 100644
--- a/libc/arch-arm64/arm64.mk
+++ b/libc/arch-arm64/arm64.mk
@@ -53,14 +53,7 @@
     arch-arm64/bionic/syscall.S \
     arch-arm64/bionic/vfork.S \
 
-# These are used by the static and dynamic versions of the libc
-# respectively.
-libc_arch_static_src_files_arm64 :=
 
-libc_arch_dynamic_src_files_arm64 :=
-
-##########################################
-# crt-related
 libc_crt_target_cflags_arm64 := \
     -I$(LOCAL_PATH)/arch-arm64/include
 
diff --git a/libc/arch-arm64/bionic/__get_sp.S b/libc/arch-arm64/bionic/__get_sp.S
index 3cd4ceb..d495b6a 100644
--- a/libc/arch-arm64/bionic/__get_sp.S
+++ b/libc/arch-arm64/bionic/__get_sp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(__get_sp)
     mov x0, sp
diff --git a/libc/arch-arm64/bionic/__rt_sigreturn.S b/libc/arch-arm64/bionic/__rt_sigreturn.S
index d176ea3..8fb6f0c 100644
--- a/libc/arch-arm64/bionic/__rt_sigreturn.S
+++ b/libc/arch-arm64/bionic/__rt_sigreturn.S
@@ -26,8 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY_PRIVATE(__rt_sigreturn)
   mov     x8, __NR_rt_sigreturn
diff --git a/libc/arch-arm64/bionic/_setjmp.S b/libc/arch-arm64/bionic/_setjmp.S
index ea70a52..dfa861b 100644
--- a/libc/arch-arm64/bionic/_setjmp.S
+++ b/libc/arch-arm64/bionic/_setjmp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
@@ -105,7 +105,7 @@
 
     /* validation failed, die die die */
 botch:
-    bl      PIC_SYM(_C_LABEL(longjmperror), PLT)
-    bl      PIC_SYM(_C_LABEL(abort), PLT)
+    bl      PIC_SYM(longjmperror, PLT)
+    bl      PIC_SYM(abort, PLT)
     b        . - 8       /* Cannot get here */
 END(_longjmp)
diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S
index b1ec0a8..9a68d86 100644
--- a/libc/arch-arm64/bionic/setjmp.S
+++ b/libc/arch-arm64/bionic/setjmp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
@@ -45,7 +45,7 @@
     stp     x0, x30, [sp, #-16]!
 
     mov     x0, xzr
-    bl      PIC_SYM(_C_LABEL(sigblock), PLT)
+    bl      PIC_SYM(sigblock, PLT)
     mov     w1, w0
 
     ldp     x0, x30, [sp], #16
@@ -117,7 +117,7 @@
 
     /* validation failed, die die die */
 botch:
-    bl      PIC_SYM(_C_LABEL(longjmperror), PLT)
-    bl      PIC_SYM(_C_LABEL(abort), PLT)
+    bl      PIC_SYM(longjmperror, PLT)
+    bl      PIC_SYM(abort, PLT)
     b       . - 8       /* Cannot get here */
 END(longjmp)
diff --git a/libc/arch-arm64/bionic/sigsetjmp.S b/libc/arch-arm64/bionic/sigsetjmp.S
index 3afceab..4fdb367 100644
--- a/libc/arch-arm64/bionic/sigsetjmp.S
+++ b/libc/arch-arm64/bionic/sigsetjmp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
@@ -35,8 +35,8 @@
  */
 
 ENTRY(sigsetjmp)
-    cbz     w1, PIC_SYM(_C_LABEL(_setjmp), PLT)
-    b       PIC_SYM(_C_LABEL(setjmp), PLT)
+    cbz     w1, PIC_SYM(_setjmp, PLT)
+    b       PIC_SYM(setjmp, PLT)
 END(sigsetjmp)
 
 .L_setjmp_magic:
@@ -46,6 +46,6 @@
     ldr     w2, .L_setjmp_magic
     ldr     w3, [x0]
     cmp     w2, w3
-    b.eq    PIC_SYM(_C_LABEL(_longjmp), PLT)
-    b       PIC_SYM(_C_LABEL(longjmp), PLT)
+    b.eq    PIC_SYM(_longjmp, PLT)
+    b       PIC_SYM(longjmp, PLT)
 END(siglongjmp)
diff --git a/libc/arch-arm64/include/machine/asm.h b/libc/arch-arm64/include/machine/asm.h
index 3f8b908..4bfabaf 100644
--- a/libc/arch-arm64/include/machine/asm.h
+++ b/libc/arch-arm64/include/machine/asm.h
@@ -38,91 +38,17 @@
 #ifndef _AARCH64_ASM_H_
 #define _AARCH64_ASM_H_
 
-/* TODO: Add cfi directives for creating/restoring FP */
-#ifdef __ELF__
-# define	_C_LABEL(x)	x
-#else
-# ifdef __STDC__
-#  define	_C_LABEL(x)	_ ## x
-# else
-#  define	_C_LABEL(x)	_/**/x
-# endif
-#endif
-#define	_ASM_LABEL(x)	x
-
-#ifdef __STDC__
-# define	__CONCAT(x,y)	x ## y
-# define	__STRING(x)	#x
-#else
-# define	__CONCAT(x,y)	x/**/y
-# define	__STRING(x)	"x"
-#endif
-
 #ifndef _ALIGN_TEXT
-# define	_ALIGN_TEXT	.align 0
+# define _ALIGN_TEXT .align 0
 #endif
 
-#define	_ASM_TYPE_FUNCTION	%function
-#define	_ASM_TYPE_OBJECT	%object
-#define	_ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .cfi_startproc
-
-#define	_ASM_SIZE(x)	.size x, .-x;
-
-#define _END(x) \
-	.cfi_endproc; \
-	_ASM_SIZE(x)
-
-#define	ENTRY(y)	_ENTRY(_C_LABEL(y));
-#define	ENTRY_NP(y)	_ENTRY(_C_LABEL(y))
-#define	END(y)		_END(_C_LABEL(y))
-#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
-#define	ASENTRY_NP(y)	_ENTRY(_ASM_LABEL(y))
-#define	ASEND(y)	_END(_ASM_LABEL(y))
-
-#ifdef __ELF__
-#define	ENTRY_PRIVATE(y)  ENTRY(y); .hidden _C_LABEL(y)
-#else
-#define	ENTRY_PRIVATE(y)  ENTRY(y)
-#endif
-
-#define	ASMSTR		.asciz
+#undef __bionic_asm_function_type
+#define __bionic_asm_function_type %function
 
 #if defined(__ELF__) && defined(PIC)
-#ifdef __STDC__
-#define	PIC_SYM(x,y)	x ## ( ## y ## )
+#define PIC_SYM(x,y) x ## ( ## y ## )
 #else
-#define	PIC_SYM(x,y)	x/**/(/**/y/**/)
+#define PIC_SYM(x,y) x
 #endif
-#else
-#define	PIC_SYM(x,y)	x
-#endif
-
-#ifdef __ELF__
-#define	RCSID(x)	.section ".ident"; .asciz x
-#else
-#define	RCSID(x)	.text; .asciz x
-#endif
-
-#ifdef __ELF__
-#define	WEAK_ALIAS(alias,sym)						\
-	.weak alias;							\
-	alias = sym
-#endif
-
-#ifdef __STDC__
-#define	WARN_REFERENCES(sym,msg)					\
-	.stabs msg ## ,30,0,0,0 ;					\
-	.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
-#elif defined(__ELF__)
-#define	WARN_REFERENCES(sym,msg)					\
-	.stabs msg,30,0,0,0 ;						\
-	.stabs __STRING(sym),1,0,0,0
-#else
-#define	WARN_REFERENCES(sym,msg)					\
-	.stabs msg,30,0,0,0 ;						\
-	.stabs __STRING(_/**/sym),1,0,0,0
-#endif /* __STDC__ */
 
 #endif /* _AARCH64_ASM_H_ */
-
diff --git a/libc/arch-arm64/syscalls/__brk.S b/libc/arch-arm64/syscalls/__brk.S
index 98055cc..918edf0 100644
--- a/libc/arch-arm64/syscalls/__brk.S
+++ b/libc/arch-arm64/syscalls/__brk.S
@@ -19,4 +19,4 @@
 
     ret
 END(__brk)
-.hidden _C_LABEL(__brk)
+.hidden __brk
diff --git a/libc/arch-arm64/syscalls/__epoll_pwait.S b/libc/arch-arm64/syscalls/__epoll_pwait.S
index d512c7c..b487360 100644
--- a/libc/arch-arm64/syscalls/__epoll_pwait.S
+++ b/libc/arch-arm64/syscalls/__epoll_pwait.S
@@ -19,4 +19,4 @@
 
     ret
 END(__epoll_pwait)
-.hidden _C_LABEL(__epoll_pwait)
+.hidden __epoll_pwait
diff --git a/libc/arch-arm64/syscalls/__exit.S b/libc/arch-arm64/syscalls/__exit.S
index 50cd45a..5e97928 100644
--- a/libc/arch-arm64/syscalls/__exit.S
+++ b/libc/arch-arm64/syscalls/__exit.S
@@ -19,4 +19,4 @@
 
     ret
 END(__exit)
-.hidden _C_LABEL(__exit)
+.hidden __exit
diff --git a/libc/arch-arm64/syscalls/__getcpu.S b/libc/arch-arm64/syscalls/__getcpu.S
index 698e8ff..a312188 100644
--- a/libc/arch-arm64/syscalls/__getcpu.S
+++ b/libc/arch-arm64/syscalls/__getcpu.S
@@ -19,4 +19,4 @@
 
     ret
 END(__getcpu)
-.hidden _C_LABEL(__getcpu)
+.hidden __getcpu
diff --git a/libc/arch-arm64/syscalls/__getcwd.S b/libc/arch-arm64/syscalls/__getcwd.S
index f0543f0..4b27a9c 100644
--- a/libc/arch-arm64/syscalls/__getcwd.S
+++ b/libc/arch-arm64/syscalls/__getcwd.S
@@ -19,4 +19,4 @@
 
     ret
 END(__getcwd)
-.hidden _C_LABEL(__getcwd)
+.hidden __getcwd
diff --git a/libc/arch-arm64/syscalls/__getpriority.S b/libc/arch-arm64/syscalls/__getpriority.S
index f7fd1b8..3ccd104 100644
--- a/libc/arch-arm64/syscalls/__getpriority.S
+++ b/libc/arch-arm64/syscalls/__getpriority.S
@@ -19,4 +19,4 @@
 
     ret
 END(__getpriority)
-.hidden _C_LABEL(__getpriority)
+.hidden __getpriority
diff --git a/libc/arch-arm64/syscalls/__ioctl.S b/libc/arch-arm64/syscalls/__ioctl.S
index 2569fdf..68d89bc 100644
--- a/libc/arch-arm64/syscalls/__ioctl.S
+++ b/libc/arch-arm64/syscalls/__ioctl.S
@@ -19,4 +19,4 @@
 
     ret
 END(__ioctl)
-.hidden _C_LABEL(__ioctl)
+.hidden __ioctl
diff --git a/libc/arch-arm64/syscalls/__openat.S b/libc/arch-arm64/syscalls/__openat.S
index cca66ce..a49eaff 100644
--- a/libc/arch-arm64/syscalls/__openat.S
+++ b/libc/arch-arm64/syscalls/__openat.S
@@ -19,4 +19,4 @@
 
     ret
 END(__openat)
-.hidden _C_LABEL(__openat)
+.hidden __openat
diff --git a/libc/arch-arm64/syscalls/__ppoll.S b/libc/arch-arm64/syscalls/__ppoll.S
index 68efc09..370e768 100644
--- a/libc/arch-arm64/syscalls/__ppoll.S
+++ b/libc/arch-arm64/syscalls/__ppoll.S
@@ -19,4 +19,4 @@
 
     ret
 END(__ppoll)
-.hidden _C_LABEL(__ppoll)
+.hidden __ppoll
diff --git a/libc/arch-arm64/syscalls/__pselect6.S b/libc/arch-arm64/syscalls/__pselect6.S
index 295b71a..193e19f 100644
--- a/libc/arch-arm64/syscalls/__pselect6.S
+++ b/libc/arch-arm64/syscalls/__pselect6.S
@@ -19,4 +19,4 @@
 
     ret
 END(__pselect6)
-.hidden _C_LABEL(__pselect6)
+.hidden __pselect6
diff --git a/libc/arch-arm64/syscalls/__ptrace.S b/libc/arch-arm64/syscalls/__ptrace.S
index aa41071..ee63cb0 100644
--- a/libc/arch-arm64/syscalls/__ptrace.S
+++ b/libc/arch-arm64/syscalls/__ptrace.S
@@ -19,4 +19,4 @@
 
     ret
 END(__ptrace)
-.hidden _C_LABEL(__ptrace)
+.hidden __ptrace
diff --git a/libc/arch-arm64/syscalls/__reboot.S b/libc/arch-arm64/syscalls/__reboot.S
index 9680bdc..10b33ad 100644
--- a/libc/arch-arm64/syscalls/__reboot.S
+++ b/libc/arch-arm64/syscalls/__reboot.S
@@ -19,4 +19,4 @@
 
     ret
 END(__reboot)
-.hidden _C_LABEL(__reboot)
+.hidden __reboot
diff --git a/libc/arch-arm64/syscalls/__rt_sigaction.S b/libc/arch-arm64/syscalls/__rt_sigaction.S
index 77f83ea..cea0941 100644
--- a/libc/arch-arm64/syscalls/__rt_sigaction.S
+++ b/libc/arch-arm64/syscalls/__rt_sigaction.S
@@ -19,4 +19,4 @@
 
     ret
 END(__rt_sigaction)
-.hidden _C_LABEL(__rt_sigaction)
+.hidden __rt_sigaction
diff --git a/libc/arch-arm64/syscalls/__rt_sigpending.S b/libc/arch-arm64/syscalls/__rt_sigpending.S
index 59a2e1e..97db3b9 100644
--- a/libc/arch-arm64/syscalls/__rt_sigpending.S
+++ b/libc/arch-arm64/syscalls/__rt_sigpending.S
@@ -19,4 +19,4 @@
 
     ret
 END(__rt_sigpending)
-.hidden _C_LABEL(__rt_sigpending)
+.hidden __rt_sigpending
diff --git a/libc/arch-arm64/syscalls/__rt_sigprocmask.S b/libc/arch-arm64/syscalls/__rt_sigprocmask.S
index c5a51ed..97dabe1 100644
--- a/libc/arch-arm64/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-arm64/syscalls/__rt_sigprocmask.S
@@ -19,4 +19,4 @@
 
     ret
 END(__rt_sigprocmask)
-.hidden _C_LABEL(__rt_sigprocmask)
+.hidden __rt_sigprocmask
diff --git a/libc/arch-arm64/syscalls/__rt_sigsuspend.S b/libc/arch-arm64/syscalls/__rt_sigsuspend.S
index 7a1c22e..d8eaa3e 100644
--- a/libc/arch-arm64/syscalls/__rt_sigsuspend.S
+++ b/libc/arch-arm64/syscalls/__rt_sigsuspend.S
@@ -19,4 +19,4 @@
 
     ret
 END(__rt_sigsuspend)
-.hidden _C_LABEL(__rt_sigsuspend)
+.hidden __rt_sigsuspend
diff --git a/libc/arch-arm64/syscalls/__rt_sigtimedwait.S b/libc/arch-arm64/syscalls/__rt_sigtimedwait.S
index b3d950c..95f031a 100644
--- a/libc/arch-arm64/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-arm64/syscalls/__rt_sigtimedwait.S
@@ -19,4 +19,4 @@
 
     ret
 END(__rt_sigtimedwait)
-.hidden _C_LABEL(__rt_sigtimedwait)
+.hidden __rt_sigtimedwait
diff --git a/libc/arch-arm64/syscalls/__sched_getaffinity.S b/libc/arch-arm64/syscalls/__sched_getaffinity.S
index 9b785ad..58715d0 100644
--- a/libc/arch-arm64/syscalls/__sched_getaffinity.S
+++ b/libc/arch-arm64/syscalls/__sched_getaffinity.S
@@ -19,4 +19,4 @@
 
     ret
 END(__sched_getaffinity)
-.hidden _C_LABEL(__sched_getaffinity)
+.hidden __sched_getaffinity
diff --git a/libc/arch-arm64/syscalls/__set_tid_address.S b/libc/arch-arm64/syscalls/__set_tid_address.S
index b7541fc..3cc452c 100644
--- a/libc/arch-arm64/syscalls/__set_tid_address.S
+++ b/libc/arch-arm64/syscalls/__set_tid_address.S
@@ -19,4 +19,4 @@
 
     ret
 END(__set_tid_address)
-.hidden _C_LABEL(__set_tid_address)
+.hidden __set_tid_address
diff --git a/libc/arch-arm64/syscalls/__syslog.S b/libc/arch-arm64/syscalls/__syslog.S
index 625a7eb..2e1fb1d 100644
--- a/libc/arch-arm64/syscalls/__syslog.S
+++ b/libc/arch-arm64/syscalls/__syslog.S
@@ -19,4 +19,4 @@
 
     ret
 END(__syslog)
-.hidden _C_LABEL(__syslog)
+.hidden __syslog
diff --git a/libc/arch-arm64/syscalls/__timer_create.S b/libc/arch-arm64/syscalls/__timer_create.S
index bfce448..b551048 100644
--- a/libc/arch-arm64/syscalls/__timer_create.S
+++ b/libc/arch-arm64/syscalls/__timer_create.S
@@ -19,4 +19,4 @@
 
     ret
 END(__timer_create)
-.hidden _C_LABEL(__timer_create)
+.hidden __timer_create
diff --git a/libc/arch-arm64/syscalls/__timer_delete.S b/libc/arch-arm64/syscalls/__timer_delete.S
index 03ed44e..2aff540 100644
--- a/libc/arch-arm64/syscalls/__timer_delete.S
+++ b/libc/arch-arm64/syscalls/__timer_delete.S
@@ -19,4 +19,4 @@
 
     ret
 END(__timer_delete)
-.hidden _C_LABEL(__timer_delete)
+.hidden __timer_delete
diff --git a/libc/arch-arm64/syscalls/__timer_getoverrun.S b/libc/arch-arm64/syscalls/__timer_getoverrun.S
index a458941..b11e356 100644
--- a/libc/arch-arm64/syscalls/__timer_getoverrun.S
+++ b/libc/arch-arm64/syscalls/__timer_getoverrun.S
@@ -19,4 +19,4 @@
 
     ret
 END(__timer_getoverrun)
-.hidden _C_LABEL(__timer_getoverrun)
+.hidden __timer_getoverrun
diff --git a/libc/arch-arm64/syscalls/__timer_gettime.S b/libc/arch-arm64/syscalls/__timer_gettime.S
index b6ae29e..c7c4d09 100644
--- a/libc/arch-arm64/syscalls/__timer_gettime.S
+++ b/libc/arch-arm64/syscalls/__timer_gettime.S
@@ -19,4 +19,4 @@
 
     ret
 END(__timer_gettime)
-.hidden _C_LABEL(__timer_gettime)
+.hidden __timer_gettime
diff --git a/libc/arch-arm64/syscalls/__timer_settime.S b/libc/arch-arm64/syscalls/__timer_settime.S
index 3c44b53..4f5f5fc 100644
--- a/libc/arch-arm64/syscalls/__timer_settime.S
+++ b/libc/arch-arm64/syscalls/__timer_settime.S
@@ -19,4 +19,4 @@
 
     ret
 END(__timer_settime)
-.hidden _C_LABEL(__timer_settime)
+.hidden __timer_settime
diff --git a/libc/arch-arm64/syscalls/__waitid.S b/libc/arch-arm64/syscalls/__waitid.S
index 4244018..66e986a 100644
--- a/libc/arch-arm64/syscalls/__waitid.S
+++ b/libc/arch-arm64/syscalls/__waitid.S
@@ -19,4 +19,4 @@
 
     ret
 END(__waitid)
-.hidden _C_LABEL(__waitid)
+.hidden __waitid
diff --git a/libc/arch-mips/bionic/__bionic_clone.S b/libc/arch-mips/bionic/__bionic_clone.S
index 8970b6e..9273134 100644
--- a/libc/arch-mips/bionic/__bionic_clone.S
+++ b/libc/arch-mips/bionic/__bionic_clone.S
@@ -26,49 +26,43 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 
 // pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
-	.text
-	.type __bionic_clone, @function
-	.global __bionic_clone
-	.align 4
-        .ent __bionic_clone
-__bionic_clone:
+ENTRY(__bionic_clone)
         .set	noreorder
-        .cpload $t9
+        .cpload t9
         .set	reorder
 
 	# set up child stack
-	subu	$a1,16
-	lw	$t0,20($sp)     # fn
-	lw	$t1,24($sp)     # arg
-	sw	$t0,0($a1)	# fn
-	sw	$t1,4($a1)	# arg
+	subu	a1,16
+	lw	t0,20(sp)     # fn
+	lw	t1,24(sp)     # arg
+	sw	t0,0(a1)	# fn
+	sw	t1,4(a1)	# arg
 
 	# remainder of arguments are correct for clone system call
-        li	$v0,__NR_clone
+        li	v0,__NR_clone
         syscall
 
-        bnez	$a3,.L__error_bc
+        bnez	a3,.L__error_bc
 
-        beqz	$v0,.L__thread_start_bc
+        beqz	v0,.L__thread_start_bc
 
-        j $ra
+        j ra
 
 .L__thread_start_bc:
-        lw	$a0,0($sp)	#  fn
-        lw	$a1,4($sp)	#  arg
+        lw	a0,0(sp)	#  fn
+        lw	a1,4(sp)	#  arg
 
 	# void __bionic_clone_entry(int (*func)(void*), void *arg)
-        la	$t9,__bionic_clone_entry
-        j	$t9
+        la	t9,__bionic_clone_entry
+        j	t9
 
 .L__error_bc:
-	move	$a0,$v0
-	la	$t9,__set_errno
-	j	$t9
-
-        .end __bionic_clone
+	move	a0,v0
+	la	t9,__set_errno
+	j	t9
+END(__bionic_clone)
diff --git a/libc/arch-mips/bionic/__get_sp.S b/libc/arch-mips/bionic/__get_sp.S
index 834c89d..d4b278b 100644
--- a/libc/arch-mips/bionic/__get_sp.S
+++ b/libc/arch-mips/bionic/__get_sp.S
@@ -25,15 +25,11 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-	.text
 
-/* void *__get_sp(void) */
+#include <private/bionic_asm.h>
 
-	.type	__get_sp, @function
-	.global	__get_sp
-	.align	4
-	.ent	__get_sp
-__get_sp:
-	move	$v0, $sp
-	j	$ra
-	.end	__get_sp
+// void* __get_sp()
+ENTRY(__get_sp)
+  move v0, sp
+  j ra
+END(__get_sp)
diff --git a/libc/arch-mips/bionic/_exit_with_stack_teardown.S b/libc/arch-mips/bionic/_exit_with_stack_teardown.S
index 8f624c3..129e3f9 100644
--- a/libc/arch-mips/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-mips/bionic/_exit_with_stack_teardown.S
@@ -26,23 +26,16 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
-
-	.text
+#include <private/bionic_asm.h>
 
 // void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
-
-	.type	_exit_with_stack_teardown, @function
-	.global	_exit_with_stack_teardown
-	.align	4
-	.ent	_exit_with_stack_teardown
-_exit_with_stack_teardown:
-	li	$v0, __NR_munmap
+ENTRY(_exit_with_stack_teardown)
+	li	v0, __NR_munmap
 	syscall
 	// If munmap failed, we ignore the failure and exit anyway.
 
-	li	$a0, 0
-	li	$v0, __NR_exit
+	li	a0, 0
+	li	v0, __NR_exit
 	syscall
         // The exit syscall does not return.
-	.end	_exit_with_stack_teardown
+END(_exit_with_stack_teardown)
diff --git a/libc/arch-mips/bionic/_setjmp.S b/libc/arch-mips/bionic/_setjmp.S
index e7083ae..4465cd2 100644
--- a/libc/arch-mips/bionic/_setjmp.S
+++ b/libc/arch-mips/bionic/_setjmp.S
@@ -2,7 +2,7 @@
 
 /*
  * Copyright (c) 2002 Opsycon AB  (www.opsycon.se / www.opsycon.com)
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -29,7 +29,7 @@
  *
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/regnum.h>
 #include <machine/signal.h>
 
@@ -48,13 +48,13 @@
         swc1    FPR, OFF(BASE)  ;       \
         mfhc1   t0, FPR         ;       \
         sw      t0, OFF+4(BASE) ;
-        
+
 #define FPREG64_L(FPR, OFF, BASE)       \
         lw      t0, OFF+4(BASE) ;       \
         lw      t1, OFF(BASE)   ;       \
         mtc1    t1, FPR         ;       \
         mthc1   t0, FPR         ;       \
-        
+
 LEAF(_setjmp, FRAMESZ)
 	PTR_SUBU sp, FRAMESZ
 	SETUP_GP64(GPOFF, _setjmp)
@@ -185,4 +185,3 @@
 	RESTORE_GP64
 	PTR_ADDU sp, FRAMESZ
 END(_longjmp)
-
diff --git a/libc/arch-mips/bionic/bzero.S b/libc/arch-mips/bionic/bzero.S
index 6739345..6e5d294 100644
--- a/libc/arch-mips/bionic/bzero.S
+++ b/libc/arch-mips/bionic/bzero.S
@@ -25,21 +25,15 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-	.text
 
-/*
- * void bzero(void *s, size_t n);
- */
-	.type	bzero, @function
-	.global	bzero
-	.align	4
-	.ent	bzero
+#include <private/bionic_asm.h>
+
+// void bzero(void*, size_t);
+ENTRY(bzero)
 	.set	noreorder
-bzero:
-	.cpload	$t9
-	move	$a2,$a1
-	la	$t9,memset
-	j	$t9
-	 move	$a1,$zero
-	.end	bzero
-
+	.cpload	t9
+	move	a2,a1
+	la	t9,memset
+	j	t9
+	 move	a1,zero
+END(bzero)
diff --git a/libc/arch-mips/bionic/futex_mips.S b/libc/arch-mips/bionic/futex_mips.S
index 5247b79..7626a7c 100644
--- a/libc/arch-mips/bionic/futex_mips.S
+++ b/libc/arch-mips/bionic/futex_mips.S
@@ -32,101 +32,85 @@
 #define FUTEX_WAKE 1
 
 // int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
-	.type	__futex_wait, @function
-	.global	__futex_wait
-	.align	4
-	.ent	__futex_wait
-__futex_wait:
-	subu	$sp,4*6
-	sw	$0,20($sp)	/* val3 */
-	sw	$0,16($sp)	/* addr2 */
-	move	$a3,$a2		/* timespec */
-	move	$a2,$a1		/* val */
-	li	$a1,FUTEX_WAIT	/* op */
-#	move	$a0,$a0		/* ftx */
-	li	$v0,__NR_futex
+ENTRY(__futex_wait)
+	subu	sp,4*6
+	sw	$0,20(sp)	/* val3 */
+	sw	$0,16(sp)	/* addr2 */
+	move	a3,a2		/* timespec */
+	move	a2,a1		/* val */
+	li	a1,FUTEX_WAIT	/* op */
+#	move	a0,a0		/* ftx */
+	li	v0,__NR_futex
 	syscall
 	.set noreorder
-	bnez	$a3, 1f		/* Check for error */
-         neg	$v0		/* Negate error number if it's valid */
-	move	$v0,$0		/* Otherwise return 0 */
+	bnez	a3, 1f		/* Check for error */
+         neg	v0		/* Negate error number if it's valid */
+	move	v0,$0		/* Otherwise return 0 */
 1:
 	.set reorder
-	addu	$sp,4*6
-	j	$ra
-	.end	__futex_wait
+	addu	sp,4*6
+	j	ra
+END(__futex_wait)
 
 // int __futex_wake(volatile void* ftx, int count)
-	.type	__futex_wake, @function
-	.globl	__futex_wake
-	.align	4
-	.ent	__futex_wake
-__futex_wake:
-	subu	$sp,4*6
-	sw	$0,20($sp)	/* val3 */
-	sw	$0,16($sp)	/* addr2 */
-	move	$a3,$0		/* timespec */
-	move	$a2,$a1		/* val */
-	li	$a1,FUTEX_WAKE	/* op */
-#	move	$a0,$a0		/* ftx */
-	li	$v0,__NR_futex
+ENTRY(__futex_wake)
+	subu	sp,4*6
+	sw	$0,20(sp)	/* val3 */
+	sw	$0,16(sp)	/* addr2 */
+	move	a3,$0		/* timespec */
+	move	a2,a1		/* val */
+	li	a1,FUTEX_WAKE	/* op */
+#	move	a0,a0		/* ftx */
+	li	v0,__NR_futex
 	syscall
 	.set noreorder
-	bnez	$a3, 1f		/* Check for error */
-         neg	$v0		/* Negate error number if it's valid */
-	move	$v0,$0		/* Otherwise return 0 */
+	bnez	a3, 1f		/* Check for error */
+         neg	v0		/* Negate error number if it's valid */
+	move	v0,$0		/* Otherwise return 0 */
 1:
 	.set reorder
-	addu	$sp,4*6
-	j	$ra
-	.end	__futex_wake
+	addu	sp,4*6
+	j	ra
+END(__futex_wake)
 
 // int __futex_syscall3(volatile void* ftx, int op, int count)
-	.type	__futex_syscall3, @function
-	.global	__futex_syscall3
-	.align	4
-	.ent	__futex_syscall3
-__futex_syscall3:
-	subu	$sp,4*6
-	sw	$0,20($sp)	/* val3 */
-	sw	$0,16($sp)	/* addr2 */
-	move	$a3,$0		/* timespec */
-#	move	$a2,$a2		/* val */
-#	li	$a1,$a1		/* op */
-#	move	$a0,$a0		/* ftx */
-	li	$v0,__NR_futex
+ENTRY(__futex_syscall3)
+	subu	sp,4*6
+	sw	$0,20(sp)	/* val3 */
+	sw	$0,16(sp)	/* addr2 */
+	move	a3,$0		/* timespec */
+#	move	a2,a2		/* val */
+#	li	a1,a1		/* op */
+#	move	a0,a0		/* ftx */
+	li	v0,__NR_futex
 	syscall
 	.set noreorder
-	bnez	$a3, 1f		/* Check for error */
-         neg	$v0		/* Negate error number if it's valid */
-	move	$v0,$0		/* Otherwise return 0 */
+	bnez	a3, 1f		/* Check for error */
+         neg	v0		/* Negate error number if it's valid */
+	move	v0,$0		/* Otherwise return 0 */
 1:
 	.set reorder
-	addu	$sp,4*6
-	j	$ra
-	.end	__futex_syscall3
+	addu	sp,4*6
+	j	ra
+END(__futex_syscall3)
 
 // int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
-	.type	__futex_syscall4, @function
-	.global	__futex_syscall4
-	.align	4
-	.ent	__futex_syscall4
-__futex_syscall4:
-	subu	$sp,4*6
-	sw	$0,20($sp)	/* val3 */
-	sw	$0,16($sp)	/* addr2 */
-#	move	$a3,$a3		/* timespec */
-#	move	$a2,$a2		/* val */
-#	li	$a1,$a1		/* op */
-#	move	$a0,$a0		/* ftx */
-	li	$v0,__NR_futex
+ENTRY(__futex_syscall4)
+	subu	sp,4*6
+	sw	$0,20(sp)	/* val3 */
+	sw	$0,16(sp)	/* addr2 */
+#	move	a3,a3		/* timespec */
+#	move	a2,a2		/* val */
+#	li	a1,a1		/* op */
+#	move	a0,a0		/* ftx */
+	li	v0,__NR_futex
 	syscall
 	.set noreorder
-	bnez	$a3, 1f		/* Check for error */
-         neg	$v0		/* Negate error number if it's valid */
-	move	$v0,$0		/* Otherwise return 0 */
+	bnez	a3, 1f		/* Check for error */
+         neg	v0		/* Negate error number if it's valid */
+	move	v0,$0		/* Otherwise return 0 */
 1:
 	.set reorder
-	addu	$sp,4*6
-	j	$ra
-	.end	__futex_syscall4
+	addu	sp,4*6
+	j	ra
+END(__futex_syscall4)
diff --git a/libc/arch-mips/bionic/memcmp16.S b/libc/arch-mips/bionic/memcmp16.S
index a2b2544..f9d14a9 100644
--- a/libc/arch-mips/bionic/memcmp16.S
+++ b/libc/arch-mips/bionic/memcmp16.S
@@ -25,31 +25,26 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-	.text
 
-/*
- * u4 __memcmp16(const u2* s0, const u2* s1, size_t count);
- */
-	.type	__memcmp16, @function
-	.global	__memcmp16
-	.align	4
-	.ent __memcmp16
-__memcmp16:
-	li	$t0,0
-	li	$t1,0
-	beqz	$a2,done		/* 0 length string */ 
-	beq	$a0,$a1,done		/* strings are identical */
+#include <private/bionic_asm.h>
+
+// u4 __memcmp16(const u2*, const u2*, size_t);
+ENTRY(__memcmp16)
+	li	t0,0
+	li	t1,0
+	beqz	a2,done		/* 0 length string */ 
+	beq	a0,a1,done		/* strings are identical */
 
 	/* Unoptimised... */
-1:	lhu	$t0,0($a0)
-	lhu	$t1,0($a1)
-	addu	$a1,2
-	bne	$t0,$t1,done
-	addu	$a0,2
-	subu	$a2,1
-	bnez	$a2,1b
+1:	lhu	t0,0(a0)
+	lhu	t1,0(a1)
+	addu	a1,2
+	bne	t0,t1,done
+	addu	a0,2
+	subu	a2,1
+	bnez	a2,1b
 
 done:
-	subu	$v0,$t0,$t1
-	j	$ra
-        .end __memcmp16
+	subu	v0,t0,t1
+	j	ra
+END(__memcmp16)
diff --git a/libc/arch-mips/bionic/setjmp.S b/libc/arch-mips/bionic/setjmp.S
index 7c21195..2af1fbd 100644
--- a/libc/arch-mips/bionic/setjmp.S
+++ b/libc/arch-mips/bionic/setjmp.S
@@ -29,7 +29,7 @@
  *
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/regnum.h>
 #include <machine/signal.h>
 
@@ -49,13 +49,13 @@
         swc1    FPR, OFF(BASE)  ;       \
         mfhc1   t0, FPR         ;       \
         sw      t0, OFF+4(BASE) ;
-        
+
 #define FPREG64_L(FPR, OFF, BASE)       \
         lw      t0, OFF+4(BASE) ;       \
         lw      t1, OFF(BASE)   ;       \
         mtc1    t1, FPR         ;       \
         mthc1   t0, FPR         ;       \
-        
+
 NON_LEAF(setjmp, FRAMESZ, ra)
 	.mask	0x80000000, RAOFF
 	PTR_SUBU sp, FRAMESZ			# allocate stack frame
@@ -154,7 +154,7 @@
 	lw	a0, A0OFF(sp)
 	lw	a1, A1OFF(sp)
 
-	.set	noreorder	
+	.set	noreorder
 	REG_L	v0, SC_REGS+ZERO*REGSZ(a0)
 	bne	v0, 0xACEDBADE, botch		# jump if error
 	REG_L	ra, SC_PC(a0)
@@ -169,9 +169,9 @@
 	REG_L	s8, SC_REGS+S8*REGSZ(a0)
 	REG_L	gp, SC_REGS+GP*REGSZ(a0)
 	REG_L	sp, SC_REGS+SP*REGSZ(a0)
-	
+
 #if !defined(SOFTFLOAT)
-	REG_L	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)	
+	REG_L	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 	ctc1	v0, $31
 #if _MIPS_FPSET == 32
         FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
diff --git a/libc/arch-mips/bionic/sigsetjmp.S b/libc/arch-mips/bionic/sigsetjmp.S
index b05454c..9d2e5ea 100644
--- a/libc/arch-mips/bionic/sigsetjmp.S
+++ b/libc/arch-mips/bionic/sigsetjmp.S
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/regnum.h>
 #include <machine/setjmp.h>
 
diff --git a/libc/arch-mips/bionic/syscall.S b/libc/arch-mips/bionic/syscall.S
index af5bcc9..db477a5 100644
--- a/libc/arch-mips/bionic/syscall.S
+++ b/libc/arch-mips/bionic/syscall.S
@@ -26,11 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
-    .text
-    .globl syscall
-    .align 4
-    .ent syscall
+#include <private/bionic_asm.h>
 
 /*
  * The caller is only required to allocate 16 bytes of stack for a0-a3.
@@ -38,28 +34,28 @@
  */
 #define STACKSIZE 2*4
 
-syscall:
+ENTRY(syscall)
     .set noreorder
-    .cpload $t9
-    move    $v0, $a0
-    move    $a0, $a1
-    move    $a1, $a2
-    move    $a2, $a3
-    lw      $a3, 16($sp)
-    lw      $t0, 20($sp)
-    lw      $t1, 24($sp)
-    subu    $sp, STACKSIZE
-    sw      $t0, 16($sp)
-    sw      $t1, 20($sp)
+    .cpload t9
+    move    v0, a0
+    move    a0, a1
+    move    a1, a2
+    move    a2, a3
+    lw      a3, 16(sp)
+    lw      t0, 20(sp)
+    lw      t1, 24(sp)
+    subu    sp, STACKSIZE
+    sw      t0, 16(sp)
+    sw      t1, 20(sp)
     syscall
-    addu    $sp, STACKSIZE
-    bnez    $a3, 1f
-    move    $a0, $v0
-    j       $ra
+    addu    sp, STACKSIZE
+    bnez    a3, 1f
+    move    a0, v0
+    j       ra
     nop
 1:
-    la      $t9,__set_errno
-    j       $t9
+    la      t9,__set_errno
+    j       t9
     nop
     .set reorder
-    .end syscall
+END(syscall)
diff --git a/libc/arch-mips/bionic/vfork.S b/libc/arch-mips/bionic/vfork.S
index 414caaf..96de69e 100644
--- a/libc/arch-mips/bionic/vfork.S
+++ b/libc/arch-mips/bionic/vfork.S
@@ -26,39 +26,33 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
 #include <linux/sched.h>
 
 // TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__.
 // #include <asm/signal.h>
 #define SIGCHLD 18
 
-	.text
-
-	.type	vfork, @function
-	.global	vfork
-	.align	4
-	.ent	vfork
-vfork:
+ENTRY(vfork)
 	.set	noreorder
-	.cpload	$t9
+	.cpload	t9
 
-	li	$a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
-	li	$a1, 0
-	li	$a2, 0
-	li	$a3, 0
-	subu	$sp, 8
-	sw	$0, 16($sp)
-	li	$v0, __NR_clone
+	li	a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
+	li	a1, 0
+	li	a2, 0
+	li	a3, 0
+	subu	sp, 8
+	sw	$0, 16(sp)
+	li	v0, __NR_clone
 	syscall
-	addu	$sp, 8
-	bnez	$a3, 1f
-	 move	$a0, $v0
+	addu	sp, 8
+	bnez	a3, 1f
+	 move	a0, v0
 
-	j	$ra
+	j	ra
 	 nop
 1:
-	la	$t9, __set_errno
-	j	$t9
+	la	t9, __set_errno
+	j	t9
 	 nop
-	.end	vfork
+END(vfork)
diff --git a/libc/arch-mips/include/machine/asm.h b/libc/arch-mips/include/machine/asm.h
index 43dbc09..5eacde3 100644
--- a/libc/arch-mips/include/machine/asm.h
+++ b/libc/arch-mips/include/machine/asm.h
@@ -28,25 +28,24 @@
 #ifndef _MIPS64_ASM_H
 #define _MIPS64_ASM_H
 
-#include <machine/regdef.h>
-
-#ifdef NEED_OLD_RM7KFIX
-#define ITLBNOPFIX      nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
-#else
-#define ITLBNOPFIX      nop;nop;nop;nop
+#ifndef _ALIGN_TEXT
+# define _ALIGN_TEXT .align 4
 #endif
 
+#undef __bionic_asm_custom_entry
+#undef __bionic_asm_custom_end
+#define __bionic_asm_custom_entry(f) .ent f
+#define __bionic_asm_custom_end(f) .end f
+
+#include <machine/regdef.h>
+
 #define	_MIPS_ISA_MIPS1	1	/* R2000/R3000 */
 #define	_MIPS_ISA_MIPS2	2	/* R4000/R6000 */
 #define	_MIPS_ISA_MIPS3	3	/* R4000 */
 #define	_MIPS_ISA_MIPS4	4	/* TFP (R1x000) */
-#ifdef __linux__
 #define	_MIPS_ISA_MIPS5 5
 #define	_MIPS_ISA_MIPS32 6
 #define	_MIPS_ISA_MIPS64 7
-#else
-#define	_MIPS_ISA_MIPS32 32	/* MIPS32 */
-#endif
 
 #if !defined(ABICALLS) && !defined(_NO_ABICALLS)
 #define	ABICALLS	.abicalls
@@ -56,8 +55,6 @@
 	ABICALLS
 #endif
 
-#define _C_LABEL(x) x		/* XXX Obsolete but keep for a while */
-
 #if !defined(__MIPSEL__) && !defined(__MIPSEB__)
 #error "__MIPSEL__ or __MIPSEB__ must be defined"
 #endif
@@ -90,15 +87,6 @@
  */
 #if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
 
-#ifndef _MIPS_SIM
-#define _MIPS_SIM 1
-#define _ABIO32	1
-#endif
-#ifndef _MIPS_ISA
-#define _MIPS_ISA 2
-#define _MIPS_ISA_MIPS2 2
-#endif
-
 #if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
 #define NARGSAVE	4
 
@@ -151,7 +139,7 @@
 #define	CF_RA_OFFS	20	/* Call ra save offset */
 #endif
 
-#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4)
+#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || _MIPS_ISA == _MIPS_ISA_MIPS64)
 #define REGSZ		8	/* 64 bit mode register size */
 #define LOGREGSZ	3	/* log rsize */
 #define	REG_S	sd
@@ -190,28 +178,6 @@
 #endif
 
 /*
- * Define -pg profile entry code.
- */
-#if defined(XGPROF) || defined(XPROF)
-#define	MCOUNT			\
-	PTR_SUBU sp, sp, 32;	\
-	SAVE_GP(16);		\
-	sw	ra, 28(sp);	\
-	sw	gp, 24(sp);	\
-	.set	noat;		\
-	.set	noreorder;	\
-	move	AT, ra;		\
-	jal	_mcount;	\
-	PTR_SUBU sp, sp, 8;	\
-	lw	ra, 28(sp);	\
-	PTR_ADDU sp, sp, 32;	\
-	.set reorder;		\
-	.set	at;
-#else
-#define	MCOUNT
-#endif
-
-/*
  * LEAF(x, fsize)
  *
  *	Declare a leaf routine.
@@ -221,26 +187,9 @@
 	.globl x;		\
 	.ent x, 0;		\
 x: ;				\
+	.cfi_startproc; \
 	.frame sp, fsize, ra;	\
 	SETUP_GP		\
-	MCOUNT
-
-#define	ALEAF(x)		\
-	.globl	x;		\
-x:
-
-/*
- * NLEAF(x)
- *
- *	Declare a non-profiled leaf routine.
- */
-#define NLEAF(x, fsize)		\
-	.align	3;		\
-	.globl x;		\
-	.ent x, 0;		\
-x: ;				\
-	.frame sp, fsize, ra;	\
-	SETUP_GP
 
 /*
  * NON_LEAF(x)
@@ -252,54 +201,8 @@
 	.globl x;		\
 	.ent x, 0;		\
 x: ;				\
+	.cfi_startproc; \
 	.frame sp, fsize, retpc; \
 	SETUP_GP		\
-	MCOUNT
-
-/*
- * NNON_LEAF(x)
- *
- *	Declare a non-profiled non-leaf routine
- *	(a routine that makes other C calls).
- */
-#define NNON_LEAF(x, fsize, retpc) \
-	.align	3;		\
-	.globl x;		\
-	.ent x, 0;		\
-x: ;				\
-	.frame sp, fsize, retpc	\
-	SETUP_GP
-
-/*
- * END(x)
- *
- *	Mark end of a procedure.
- */
-#define END(x) \
-	.end x
-
-/*
- * Macros to panic and printf from assembly language.
- */
-#define PANIC(msg) \
-	LA	a0, 9f; \
-	jal	panic;	\
-	nop	;	\
-	MSG(msg)
-
-#define	PRINTF(msg) \
-	la	a0, 9f; \
-	jal	printf; \
-	nop	;	\
-	MSG(msg)
-
-#define	MSG(msg) \
-	.rdata; \
-9:	.asciiz	msg; \
-	.text
-
-#define ASMSTR(str) \
-	.asciiz str; \
-	.align	3
 
 #endif /* !_MIPS_ASM_H */
diff --git a/libc/arch-mips/include/machine/signal.h b/libc/arch-mips/include/machine/signal.h
index f02ec0d..b31715c 100644
--- a/libc/arch-mips/include/machine/signal.h
+++ b/libc/arch-mips/include/machine/signal.h
@@ -37,8 +37,6 @@
 #ifndef _MIPS_SIGNAL_H_
 #define _MIPS_SIGNAL_H_
 
-#include <machine/asm.h>
-
 #define	SC_REGMASK	(0*REGSZ)
 #define	SC_STATUS	(1*REGSZ)
 #define	SC_PC		(2*REGSZ)
diff --git a/libc/arch-mips/mips.mk b/libc/arch-mips/mips.mk
index 4e007e5..0fa1ed6 100644
--- a/libc/arch-mips/mips.mk
+++ b/libc/arch-mips/mips.mk
@@ -43,13 +43,10 @@
     bionic/__strcat_chk.cpp \
 
 
-# cflags
 ifneq ($(ARCH_MIPS_HAS_FPU),true)
 libc_common_cflags_mips := \
     -DSOFTFLOAT
 endif
-libc_common_cflags_mips += \
-    -fstrict-aliasing
 
 ##########################################
 ### CPU specific source files
@@ -71,15 +68,7 @@
     arch-mips/string/memset.S \
     arch-mips/string/mips_strlen.c \
 
-# These are used by the static and dynamic versions of the libc
-# respectively.
-libc_arch_static_src_files_mips :=
 
-libc_arch_dynamic_src_files_mips :=
-
-
-##########################################
-# crt-related
 libc_crt_target_cflags_mips := \
     $($(my_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
     -I$(LOCAL_PATH)/arch-mips/include
diff --git a/libc/arch-mips/string/memcpy.S b/libc/arch-mips/string/memcpy.S
index aabdfcf..dc91096 100644
--- a/libc/arch-mips/string/memcpy.S
+++ b/libc/arch-mips/string/memcpy.S
@@ -39,13 +39,13 @@
  *  Include files
  ************************************************************************/
 
-#include "machine/asm.h"
+#include <private/bionic_asm.h>
 
 
-/* 
+/*
  * This routine could be optimized for MIPS64. The current code only
  * uses MIPS32 instructions.
- */	
+ */
 #if defined(__MIPSEB__)
 #  define LWHI	lwl		/* high part is left in big-endian	*/
 #  define SWHI	swl		/* high part is left in big-endian	*/
diff --git a/libc/arch-mips/string/memset.S b/libc/arch-mips/string/memset.S
index a1c5055..3e630ca 100644
--- a/libc/arch-mips/string/memset.S
+++ b/libc/arch-mips/string/memset.S
@@ -39,12 +39,12 @@
  *  Include files
  ************************************************************************/
 
-#include "machine/asm.h"
+#include <private/bionic_asm.h>
 
-/* 
+/*
  * This routine could be optimized for MIPS64. The current code only
  * uses MIPS32 instructions.
- */	
+ */
 
 #if defined(__MIPSEB__)
 #  define SWHI	swl		/* high part is left in big-endian	*/
@@ -220,7 +220,7 @@
 	sw	a1,-36(a0)
 	nop
 	nop			# the extra nop instructions help to balance
-	nop			# cycles needed for "store" + "fill" + "evict" 
+	nop			# cycles needed for "store" + "fill" + "evict"
 	nop			# For 64byte store there are needed 8 fill
 	nop			# and 8 evict cycles, i.e. at least 32 instr.
 	nop
@@ -320,4 +320,3 @@
 /************************************************************************
  *  Implementation : Static functions
  ************************************************************************/
-
diff --git a/libc/arch-mips/syscalls/__brk.S b/libc/arch-mips/syscalls/__brk.S
index 87e13bd..9325c26 100644
--- a/libc/arch-mips/syscalls/__brk.S
+++ b/libc/arch-mips/syscalls/__brk.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __brk
-    .align 4
-    .ent __brk
+#include <private/bionic_asm.h>
 
-__brk:
+ENTRY(__brk)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_brk
+    .cpload t9
+    li v0, __NR_brk
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __brk
+END(__brk)
diff --git a/libc/arch-mips/syscalls/__epoll_pwait.S b/libc/arch-mips/syscalls/__epoll_pwait.S
index 0a5fdae..a417cdd 100644
--- a/libc/arch-mips/syscalls/__epoll_pwait.S
+++ b/libc/arch-mips/syscalls/__epoll_pwait.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __epoll_pwait
-    .align 4
-    .ent __epoll_pwait
+#include <private/bionic_asm.h>
 
-__epoll_pwait:
+ENTRY(__epoll_pwait)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_epoll_pwait
+    .cpload t9
+    li v0, __NR_epoll_pwait
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __epoll_pwait
+END(__epoll_pwait)
diff --git a/libc/arch-mips/syscalls/__exit.S b/libc/arch-mips/syscalls/__exit.S
index 529e49c..1515b41 100644
--- a/libc/arch-mips/syscalls/__exit.S
+++ b/libc/arch-mips/syscalls/__exit.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __exit
-    .align 4
-    .ent __exit
+#include <private/bionic_asm.h>
 
-__exit:
+ENTRY(__exit)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_exit
+    .cpload t9
+    li v0, __NR_exit
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __exit
+END(__exit)
diff --git a/libc/arch-mips/syscalls/__fcntl64.S b/libc/arch-mips/syscalls/__fcntl64.S
index 39ed4cf..b9815a1 100644
--- a/libc/arch-mips/syscalls/__fcntl64.S
+++ b/libc/arch-mips/syscalls/__fcntl64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __fcntl64
-    .align 4
-    .ent __fcntl64
+#include <private/bionic_asm.h>
 
-__fcntl64:
+ENTRY(__fcntl64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fcntl64
+    .cpload t9
+    li v0, __NR_fcntl64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __fcntl64
+END(__fcntl64)
diff --git a/libc/arch-mips/syscalls/__fstatfs64.S b/libc/arch-mips/syscalls/__fstatfs64.S
index 3389a8d..8774a53 100644
--- a/libc/arch-mips/syscalls/__fstatfs64.S
+++ b/libc/arch-mips/syscalls/__fstatfs64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __fstatfs64
-    .align 4
-    .ent __fstatfs64
+#include <private/bionic_asm.h>
 
-__fstatfs64:
+ENTRY(__fstatfs64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fstatfs64
+    .cpload t9
+    li v0, __NR_fstatfs64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __fstatfs64
+END(__fstatfs64)
diff --git a/libc/arch-mips/syscalls/__getcpu.S b/libc/arch-mips/syscalls/__getcpu.S
index d29bd62..2352e01 100644
--- a/libc/arch-mips/syscalls/__getcpu.S
+++ b/libc/arch-mips/syscalls/__getcpu.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __getcpu
-    .align 4
-    .ent __getcpu
+#include <private/bionic_asm.h>
 
-__getcpu:
+ENTRY(__getcpu)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getcpu
+    .cpload t9
+    li v0, __NR_getcpu
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __getcpu
+END(__getcpu)
diff --git a/libc/arch-mips/syscalls/__getcwd.S b/libc/arch-mips/syscalls/__getcwd.S
index ce05d92..e844f9a 100644
--- a/libc/arch-mips/syscalls/__getcwd.S
+++ b/libc/arch-mips/syscalls/__getcwd.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __getcwd
-    .align 4
-    .ent __getcwd
+#include <private/bionic_asm.h>
 
-__getcwd:
+ENTRY(__getcwd)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getcwd
+    .cpload t9
+    li v0, __NR_getcwd
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __getcwd
+END(__getcwd)
diff --git a/libc/arch-mips/syscalls/__getpriority.S b/libc/arch-mips/syscalls/__getpriority.S
index 767b6d0..882386b 100644
--- a/libc/arch-mips/syscalls/__getpriority.S
+++ b/libc/arch-mips/syscalls/__getpriority.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __getpriority
-    .align 4
-    .ent __getpriority
+#include <private/bionic_asm.h>
 
-__getpriority:
+ENTRY(__getpriority)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getpriority
+    .cpload t9
+    li v0, __NR_getpriority
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __getpriority
+END(__getpriority)
diff --git a/libc/arch-mips/syscalls/__ioctl.S b/libc/arch-mips/syscalls/__ioctl.S
index 3d83c60..ddf5323 100644
--- a/libc/arch-mips/syscalls/__ioctl.S
+++ b/libc/arch-mips/syscalls/__ioctl.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __ioctl
-    .align 4
-    .ent __ioctl
+#include <private/bionic_asm.h>
 
-__ioctl:
+ENTRY(__ioctl)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ioctl
+    .cpload t9
+    li v0, __NR_ioctl
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __ioctl
+END(__ioctl)
diff --git a/libc/arch-mips/syscalls/__llseek.S b/libc/arch-mips/syscalls/__llseek.S
index 9a3753b..10819f7 100644
--- a/libc/arch-mips/syscalls/__llseek.S
+++ b/libc/arch-mips/syscalls/__llseek.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __llseek
-    .align 4
-    .ent __llseek
+#include <private/bionic_asm.h>
 
-__llseek:
+ENTRY(__llseek)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR__llseek
+    .cpload t9
+    li v0, __NR__llseek
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __llseek
+END(__llseek)
diff --git a/libc/arch-mips/syscalls/__mmap2.S b/libc/arch-mips/syscalls/__mmap2.S
index 723e80ef..5372817 100644
--- a/libc/arch-mips/syscalls/__mmap2.S
+++ b/libc/arch-mips/syscalls/__mmap2.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __mmap2
-    .align 4
-    .ent __mmap2
+#include <private/bionic_asm.h>
 
-__mmap2:
+ENTRY(__mmap2)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mmap2
+    .cpload t9
+    li v0, __NR_mmap2
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __mmap2
+END(__mmap2)
diff --git a/libc/arch-mips/syscalls/__openat.S b/libc/arch-mips/syscalls/__openat.S
index e55e71d..f833dd8 100644
--- a/libc/arch-mips/syscalls/__openat.S
+++ b/libc/arch-mips/syscalls/__openat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __openat
-    .align 4
-    .ent __openat
+#include <private/bionic_asm.h>
 
-__openat:
+ENTRY(__openat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_openat
+    .cpload t9
+    li v0, __NR_openat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __openat
+END(__openat)
diff --git a/libc/arch-mips/syscalls/__ppoll.S b/libc/arch-mips/syscalls/__ppoll.S
index ef6d343..a5711d9 100644
--- a/libc/arch-mips/syscalls/__ppoll.S
+++ b/libc/arch-mips/syscalls/__ppoll.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __ppoll
-    .align 4
-    .ent __ppoll
+#include <private/bionic_asm.h>
 
-__ppoll:
+ENTRY(__ppoll)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ppoll
+    .cpload t9
+    li v0, __NR_ppoll
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __ppoll
+END(__ppoll)
diff --git a/libc/arch-mips/syscalls/__pselect6.S b/libc/arch-mips/syscalls/__pselect6.S
index 26af92a..4c0a0a5 100644
--- a/libc/arch-mips/syscalls/__pselect6.S
+++ b/libc/arch-mips/syscalls/__pselect6.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __pselect6
-    .align 4
-    .ent __pselect6
+#include <private/bionic_asm.h>
 
-__pselect6:
+ENTRY(__pselect6)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_pselect6
+    .cpload t9
+    li v0, __NR_pselect6
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __pselect6
+END(__pselect6)
diff --git a/libc/arch-mips/syscalls/__ptrace.S b/libc/arch-mips/syscalls/__ptrace.S
index f2ea8c7..fcbe529 100644
--- a/libc/arch-mips/syscalls/__ptrace.S
+++ b/libc/arch-mips/syscalls/__ptrace.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __ptrace
-    .align 4
-    .ent __ptrace
+#include <private/bionic_asm.h>
 
-__ptrace:
+ENTRY(__ptrace)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ptrace
+    .cpload t9
+    li v0, __NR_ptrace
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __ptrace
+END(__ptrace)
diff --git a/libc/arch-mips/syscalls/__reboot.S b/libc/arch-mips/syscalls/__reboot.S
index 95ba5d8..4aa0e7a 100644
--- a/libc/arch-mips/syscalls/__reboot.S
+++ b/libc/arch-mips/syscalls/__reboot.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __reboot
-    .align 4
-    .ent __reboot
+#include <private/bionic_asm.h>
 
-__reboot:
+ENTRY(__reboot)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_reboot
+    .cpload t9
+    li v0, __NR_reboot
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __reboot
+END(__reboot)
diff --git a/libc/arch-mips/syscalls/__rt_sigaction.S b/libc/arch-mips/syscalls/__rt_sigaction.S
index 73253d6..6c5bc37 100644
--- a/libc/arch-mips/syscalls/__rt_sigaction.S
+++ b/libc/arch-mips/syscalls/__rt_sigaction.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __rt_sigaction
-    .align 4
-    .ent __rt_sigaction
+#include <private/bionic_asm.h>
 
-__rt_sigaction:
+ENTRY(__rt_sigaction)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_rt_sigaction
+    .cpload t9
+    li v0, __NR_rt_sigaction
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __rt_sigaction
+END(__rt_sigaction)
diff --git a/libc/arch-mips/syscalls/__rt_sigpending.S b/libc/arch-mips/syscalls/__rt_sigpending.S
index 90357b3..e62f079 100644
--- a/libc/arch-mips/syscalls/__rt_sigpending.S
+++ b/libc/arch-mips/syscalls/__rt_sigpending.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __rt_sigpending
-    .align 4
-    .ent __rt_sigpending
+#include <private/bionic_asm.h>
 
-__rt_sigpending:
+ENTRY(__rt_sigpending)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_rt_sigpending
+    .cpload t9
+    li v0, __NR_rt_sigpending
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __rt_sigpending
+END(__rt_sigpending)
diff --git a/libc/arch-mips/syscalls/__rt_sigprocmask.S b/libc/arch-mips/syscalls/__rt_sigprocmask.S
index 0d34e37..94ef493 100644
--- a/libc/arch-mips/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-mips/syscalls/__rt_sigprocmask.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __rt_sigprocmask
-    .align 4
-    .ent __rt_sigprocmask
+#include <private/bionic_asm.h>
 
-__rt_sigprocmask:
+ENTRY(__rt_sigprocmask)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_rt_sigprocmask
+    .cpload t9
+    li v0, __NR_rt_sigprocmask
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __rt_sigprocmask
+END(__rt_sigprocmask)
diff --git a/libc/arch-mips/syscalls/__rt_sigsuspend.S b/libc/arch-mips/syscalls/__rt_sigsuspend.S
index 3ff4723..077746f 100644
--- a/libc/arch-mips/syscalls/__rt_sigsuspend.S
+++ b/libc/arch-mips/syscalls/__rt_sigsuspend.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __rt_sigsuspend
-    .align 4
-    .ent __rt_sigsuspend
+#include <private/bionic_asm.h>
 
-__rt_sigsuspend:
+ENTRY(__rt_sigsuspend)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_rt_sigsuspend
+    .cpload t9
+    li v0, __NR_rt_sigsuspend
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __rt_sigsuspend
+END(__rt_sigsuspend)
diff --git a/libc/arch-mips/syscalls/__rt_sigtimedwait.S b/libc/arch-mips/syscalls/__rt_sigtimedwait.S
index 19a5ce9..404eab7 100644
--- a/libc/arch-mips/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-mips/syscalls/__rt_sigtimedwait.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __rt_sigtimedwait
-    .align 4
-    .ent __rt_sigtimedwait
+#include <private/bionic_asm.h>
 
-__rt_sigtimedwait:
+ENTRY(__rt_sigtimedwait)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_rt_sigtimedwait
+    .cpload t9
+    li v0, __NR_rt_sigtimedwait
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __rt_sigtimedwait
+END(__rt_sigtimedwait)
diff --git a/libc/arch-mips/syscalls/__sched_getaffinity.S b/libc/arch-mips/syscalls/__sched_getaffinity.S
index 0038ff9..da71709 100644
--- a/libc/arch-mips/syscalls/__sched_getaffinity.S
+++ b/libc/arch-mips/syscalls/__sched_getaffinity.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __sched_getaffinity
-    .align 4
-    .ent __sched_getaffinity
+#include <private/bionic_asm.h>
 
-__sched_getaffinity:
+ENTRY(__sched_getaffinity)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_getaffinity
+    .cpload t9
+    li v0, __NR_sched_getaffinity
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __sched_getaffinity
+END(__sched_getaffinity)
diff --git a/libc/arch-mips/syscalls/__set_thread_area.S b/libc/arch-mips/syscalls/__set_thread_area.S
index 69383e9..f83249e 100644
--- a/libc/arch-mips/syscalls/__set_thread_area.S
+++ b/libc/arch-mips/syscalls/__set_thread_area.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __set_thread_area
-    .align 4
-    .ent __set_thread_area
+#include <private/bionic_asm.h>
 
-__set_thread_area:
+ENTRY(__set_thread_area)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_set_thread_area
+    .cpload t9
+    li v0, __NR_set_thread_area
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __set_thread_area
+END(__set_thread_area)
diff --git a/libc/arch-mips/syscalls/__set_tid_address.S b/libc/arch-mips/syscalls/__set_tid_address.S
index 4fcc82a..146cd0d 100644
--- a/libc/arch-mips/syscalls/__set_tid_address.S
+++ b/libc/arch-mips/syscalls/__set_tid_address.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __set_tid_address
-    .align 4
-    .ent __set_tid_address
+#include <private/bionic_asm.h>
 
-__set_tid_address:
+ENTRY(__set_tid_address)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_set_tid_address
+    .cpload t9
+    li v0, __NR_set_tid_address
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __set_tid_address
+END(__set_tid_address)
diff --git a/libc/arch-mips/syscalls/__sigaction.S b/libc/arch-mips/syscalls/__sigaction.S
index cc53ab4..03dd9da 100644
--- a/libc/arch-mips/syscalls/__sigaction.S
+++ b/libc/arch-mips/syscalls/__sigaction.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __sigaction
-    .align 4
-    .ent __sigaction
+#include <private/bionic_asm.h>
 
-__sigaction:
+ENTRY(__sigaction)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sigaction
+    .cpload t9
+    li v0, __NR_sigaction
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __sigaction
+END(__sigaction)
diff --git a/libc/arch-mips/syscalls/__statfs64.S b/libc/arch-mips/syscalls/__statfs64.S
index 4b3351c..9f94e6a 100644
--- a/libc/arch-mips/syscalls/__statfs64.S
+++ b/libc/arch-mips/syscalls/__statfs64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __statfs64
-    .align 4
-    .ent __statfs64
+#include <private/bionic_asm.h>
 
-__statfs64:
+ENTRY(__statfs64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_statfs64
+    .cpload t9
+    li v0, __NR_statfs64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __statfs64
+END(__statfs64)
diff --git a/libc/arch-mips/syscalls/__syslog.S b/libc/arch-mips/syscalls/__syslog.S
index 61a3242..ace69c7 100644
--- a/libc/arch-mips/syscalls/__syslog.S
+++ b/libc/arch-mips/syscalls/__syslog.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __syslog
-    .align 4
-    .ent __syslog
+#include <private/bionic_asm.h>
 
-__syslog:
+ENTRY(__syslog)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_syslog
+    .cpload t9
+    li v0, __NR_syslog
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __syslog
+END(__syslog)
diff --git a/libc/arch-mips/syscalls/__timer_create.S b/libc/arch-mips/syscalls/__timer_create.S
index 054c1b9..449bd28 100644
--- a/libc/arch-mips/syscalls/__timer_create.S
+++ b/libc/arch-mips/syscalls/__timer_create.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __timer_create
-    .align 4
-    .ent __timer_create
+#include <private/bionic_asm.h>
 
-__timer_create:
+ENTRY(__timer_create)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timer_create
+    .cpload t9
+    li v0, __NR_timer_create
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __timer_create
+END(__timer_create)
diff --git a/libc/arch-mips/syscalls/__timer_delete.S b/libc/arch-mips/syscalls/__timer_delete.S
index 2fa6e50..7bc5e05 100644
--- a/libc/arch-mips/syscalls/__timer_delete.S
+++ b/libc/arch-mips/syscalls/__timer_delete.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __timer_delete
-    .align 4
-    .ent __timer_delete
+#include <private/bionic_asm.h>
 
-__timer_delete:
+ENTRY(__timer_delete)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timer_delete
+    .cpload t9
+    li v0, __NR_timer_delete
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __timer_delete
+END(__timer_delete)
diff --git a/libc/arch-mips/syscalls/__timer_getoverrun.S b/libc/arch-mips/syscalls/__timer_getoverrun.S
index 269ac4d..7382c91 100644
--- a/libc/arch-mips/syscalls/__timer_getoverrun.S
+++ b/libc/arch-mips/syscalls/__timer_getoverrun.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __timer_getoverrun
-    .align 4
-    .ent __timer_getoverrun
+#include <private/bionic_asm.h>
 
-__timer_getoverrun:
+ENTRY(__timer_getoverrun)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timer_getoverrun
+    .cpload t9
+    li v0, __NR_timer_getoverrun
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __timer_getoverrun
+END(__timer_getoverrun)
diff --git a/libc/arch-mips/syscalls/__timer_gettime.S b/libc/arch-mips/syscalls/__timer_gettime.S
index 3a18e3d..d6195b9 100644
--- a/libc/arch-mips/syscalls/__timer_gettime.S
+++ b/libc/arch-mips/syscalls/__timer_gettime.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __timer_gettime
-    .align 4
-    .ent __timer_gettime
+#include <private/bionic_asm.h>
 
-__timer_gettime:
+ENTRY(__timer_gettime)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timer_gettime
+    .cpload t9
+    li v0, __NR_timer_gettime
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __timer_gettime
+END(__timer_gettime)
diff --git a/libc/arch-mips/syscalls/__timer_settime.S b/libc/arch-mips/syscalls/__timer_settime.S
index daf671f..9fbab86 100644
--- a/libc/arch-mips/syscalls/__timer_settime.S
+++ b/libc/arch-mips/syscalls/__timer_settime.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __timer_settime
-    .align 4
-    .ent __timer_settime
+#include <private/bionic_asm.h>
 
-__timer_settime:
+ENTRY(__timer_settime)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timer_settime
+    .cpload t9
+    li v0, __NR_timer_settime
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __timer_settime
+END(__timer_settime)
diff --git a/libc/arch-mips/syscalls/__waitid.S b/libc/arch-mips/syscalls/__waitid.S
index 9442ca6..4c9142e 100644
--- a/libc/arch-mips/syscalls/__waitid.S
+++ b/libc/arch-mips/syscalls/__waitid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl __waitid
-    .align 4
-    .ent __waitid
+#include <private/bionic_asm.h>
 
-__waitid:
+ENTRY(__waitid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_waitid
+    .cpload t9
+    li v0, __NR_waitid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end __waitid
+END(__waitid)
diff --git a/libc/arch-mips/syscalls/_exit.S b/libc/arch-mips/syscalls/_exit.S
index 220876a..5a0877d 100644
--- a/libc/arch-mips/syscalls/_exit.S
+++ b/libc/arch-mips/syscalls/_exit.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl _exit
-    .align 4
-    .ent _exit
+#include <private/bionic_asm.h>
 
-_exit:
+ENTRY(_exit)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_exit_group
+    .cpload t9
+    li v0, __NR_exit_group
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end _exit
+END(_exit)
diff --git a/libc/arch-mips/syscalls/_flush_cache.S b/libc/arch-mips/syscalls/_flush_cache.S
index 0ac2576..64967fe 100644
--- a/libc/arch-mips/syscalls/_flush_cache.S
+++ b/libc/arch-mips/syscalls/_flush_cache.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl _flush_cache
-    .align 4
-    .ent _flush_cache
+#include <private/bionic_asm.h>
 
-_flush_cache:
+ENTRY(_flush_cache)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_cacheflush
+    .cpload t9
+    li v0, __NR_cacheflush
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end _flush_cache
+END(_flush_cache)
diff --git a/libc/arch-mips/syscalls/accept.S b/libc/arch-mips/syscalls/accept.S
index f4da4d8..09496ab 100644
--- a/libc/arch-mips/syscalls/accept.S
+++ b/libc/arch-mips/syscalls/accept.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl accept
-    .align 4
-    .ent accept
+#include <private/bionic_asm.h>
 
-accept:
+ENTRY(accept)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_accept
+    .cpload t9
+    li v0, __NR_accept
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end accept
+END(accept)
diff --git a/libc/arch-mips/syscalls/acct.S b/libc/arch-mips/syscalls/acct.S
index c641b9c..6e4a4f2 100644
--- a/libc/arch-mips/syscalls/acct.S
+++ b/libc/arch-mips/syscalls/acct.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl acct
-    .align 4
-    .ent acct
+#include <private/bionic_asm.h>
 
-acct:
+ENTRY(acct)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_acct
+    .cpload t9
+    li v0, __NR_acct
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end acct
+END(acct)
diff --git a/libc/arch-mips/syscalls/bind.S b/libc/arch-mips/syscalls/bind.S
index 912b161..9119aa8 100644
--- a/libc/arch-mips/syscalls/bind.S
+++ b/libc/arch-mips/syscalls/bind.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl bind
-    .align 4
-    .ent bind
+#include <private/bionic_asm.h>
 
-bind:
+ENTRY(bind)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_bind
+    .cpload t9
+    li v0, __NR_bind
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end bind
+END(bind)
diff --git a/libc/arch-mips/syscalls/capget.S b/libc/arch-mips/syscalls/capget.S
index 48f7be3..549dc76 100644
--- a/libc/arch-mips/syscalls/capget.S
+++ b/libc/arch-mips/syscalls/capget.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl capget
-    .align 4
-    .ent capget
+#include <private/bionic_asm.h>
 
-capget:
+ENTRY(capget)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_capget
+    .cpload t9
+    li v0, __NR_capget
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end capget
+END(capget)
diff --git a/libc/arch-mips/syscalls/capset.S b/libc/arch-mips/syscalls/capset.S
index 40223c2..637ac37 100644
--- a/libc/arch-mips/syscalls/capset.S
+++ b/libc/arch-mips/syscalls/capset.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl capset
-    .align 4
-    .ent capset
+#include <private/bionic_asm.h>
 
-capset:
+ENTRY(capset)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_capset
+    .cpload t9
+    li v0, __NR_capset
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end capset
+END(capset)
diff --git a/libc/arch-mips/syscalls/chdir.S b/libc/arch-mips/syscalls/chdir.S
index 4f427a1..752e4e7 100644
--- a/libc/arch-mips/syscalls/chdir.S
+++ b/libc/arch-mips/syscalls/chdir.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl chdir
-    .align 4
-    .ent chdir
+#include <private/bionic_asm.h>
 
-chdir:
+ENTRY(chdir)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_chdir
+    .cpload t9
+    li v0, __NR_chdir
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end chdir
+END(chdir)
diff --git a/libc/arch-mips/syscalls/chroot.S b/libc/arch-mips/syscalls/chroot.S
index a501459..d1ffc97 100644
--- a/libc/arch-mips/syscalls/chroot.S
+++ b/libc/arch-mips/syscalls/chroot.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl chroot
-    .align 4
-    .ent chroot
+#include <private/bionic_asm.h>
 
-chroot:
+ENTRY(chroot)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_chroot
+    .cpload t9
+    li v0, __NR_chroot
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end chroot
+END(chroot)
diff --git a/libc/arch-mips/syscalls/clock_getres.S b/libc/arch-mips/syscalls/clock_getres.S
index d3986fc..49d9bba 100644
--- a/libc/arch-mips/syscalls/clock_getres.S
+++ b/libc/arch-mips/syscalls/clock_getres.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl clock_getres
-    .align 4
-    .ent clock_getres
+#include <private/bionic_asm.h>
 
-clock_getres:
+ENTRY(clock_getres)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_clock_getres
+    .cpload t9
+    li v0, __NR_clock_getres
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end clock_getres
+END(clock_getres)
diff --git a/libc/arch-mips/syscalls/clock_gettime.S b/libc/arch-mips/syscalls/clock_gettime.S
index fa02309..42929e8 100644
--- a/libc/arch-mips/syscalls/clock_gettime.S
+++ b/libc/arch-mips/syscalls/clock_gettime.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl clock_gettime
-    .align 4
-    .ent clock_gettime
+#include <private/bionic_asm.h>
 
-clock_gettime:
+ENTRY(clock_gettime)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_clock_gettime
+    .cpload t9
+    li v0, __NR_clock_gettime
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end clock_gettime
+END(clock_gettime)
diff --git a/libc/arch-mips/syscalls/clock_nanosleep.S b/libc/arch-mips/syscalls/clock_nanosleep.S
index 91a1418..e7c25ce 100644
--- a/libc/arch-mips/syscalls/clock_nanosleep.S
+++ b/libc/arch-mips/syscalls/clock_nanosleep.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl clock_nanosleep
-    .align 4
-    .ent clock_nanosleep
+#include <private/bionic_asm.h>
 
-clock_nanosleep:
+ENTRY(clock_nanosleep)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_clock_nanosleep
+    .cpload t9
+    li v0, __NR_clock_nanosleep
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end clock_nanosleep
+END(clock_nanosleep)
diff --git a/libc/arch-mips/syscalls/clock_settime.S b/libc/arch-mips/syscalls/clock_settime.S
index d8eb8f1..e7dda91 100644
--- a/libc/arch-mips/syscalls/clock_settime.S
+++ b/libc/arch-mips/syscalls/clock_settime.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl clock_settime
-    .align 4
-    .ent clock_settime
+#include <private/bionic_asm.h>
 
-clock_settime:
+ENTRY(clock_settime)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_clock_settime
+    .cpload t9
+    li v0, __NR_clock_settime
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end clock_settime
+END(clock_settime)
diff --git a/libc/arch-mips/syscalls/close.S b/libc/arch-mips/syscalls/close.S
index 098fdd2..bc2c325 100644
--- a/libc/arch-mips/syscalls/close.S
+++ b/libc/arch-mips/syscalls/close.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl close
-    .align 4
-    .ent close
+#include <private/bionic_asm.h>
 
-close:
+ENTRY(close)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_close
+    .cpload t9
+    li v0, __NR_close
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end close
+END(close)
diff --git a/libc/arch-mips/syscalls/connect.S b/libc/arch-mips/syscalls/connect.S
index d3b0cea..6f10652 100644
--- a/libc/arch-mips/syscalls/connect.S
+++ b/libc/arch-mips/syscalls/connect.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl connect
-    .align 4
-    .ent connect
+#include <private/bionic_asm.h>
 
-connect:
+ENTRY(connect)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_connect
+    .cpload t9
+    li v0, __NR_connect
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end connect
+END(connect)
diff --git a/libc/arch-mips/syscalls/delete_module.S b/libc/arch-mips/syscalls/delete_module.S
index ae47697..9247f5a 100644
--- a/libc/arch-mips/syscalls/delete_module.S
+++ b/libc/arch-mips/syscalls/delete_module.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl delete_module
-    .align 4
-    .ent delete_module
+#include <private/bionic_asm.h>
 
-delete_module:
+ENTRY(delete_module)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_delete_module
+    .cpload t9
+    li v0, __NR_delete_module
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end delete_module
+END(delete_module)
diff --git a/libc/arch-mips/syscalls/dup.S b/libc/arch-mips/syscalls/dup.S
index 6cb924f..61b1c03 100644
--- a/libc/arch-mips/syscalls/dup.S
+++ b/libc/arch-mips/syscalls/dup.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl dup
-    .align 4
-    .ent dup
+#include <private/bionic_asm.h>
 
-dup:
+ENTRY(dup)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_dup
+    .cpload t9
+    li v0, __NR_dup
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end dup
+END(dup)
diff --git a/libc/arch-mips/syscalls/dup3.S b/libc/arch-mips/syscalls/dup3.S
index 6a3752c..d0694e8 100644
--- a/libc/arch-mips/syscalls/dup3.S
+++ b/libc/arch-mips/syscalls/dup3.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl dup3
-    .align 4
-    .ent dup3
+#include <private/bionic_asm.h>
 
-dup3:
+ENTRY(dup3)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_dup3
+    .cpload t9
+    li v0, __NR_dup3
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end dup3
+END(dup3)
diff --git a/libc/arch-mips/syscalls/epoll_create1.S b/libc/arch-mips/syscalls/epoll_create1.S
index 0abaeda..2043f39 100644
--- a/libc/arch-mips/syscalls/epoll_create1.S
+++ b/libc/arch-mips/syscalls/epoll_create1.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl epoll_create1
-    .align 4
-    .ent epoll_create1
+#include <private/bionic_asm.h>
 
-epoll_create1:
+ENTRY(epoll_create1)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_epoll_create1
+    .cpload t9
+    li v0, __NR_epoll_create1
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end epoll_create1
+END(epoll_create1)
diff --git a/libc/arch-mips/syscalls/epoll_ctl.S b/libc/arch-mips/syscalls/epoll_ctl.S
index 20d4367..9474d3a 100644
--- a/libc/arch-mips/syscalls/epoll_ctl.S
+++ b/libc/arch-mips/syscalls/epoll_ctl.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl epoll_ctl
-    .align 4
-    .ent epoll_ctl
+#include <private/bionic_asm.h>
 
-epoll_ctl:
+ENTRY(epoll_ctl)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_epoll_ctl
+    .cpload t9
+    li v0, __NR_epoll_ctl
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end epoll_ctl
+END(epoll_ctl)
diff --git a/libc/arch-mips/syscalls/eventfd.S b/libc/arch-mips/syscalls/eventfd.S
index f12bc7d..5282a91 100644
--- a/libc/arch-mips/syscalls/eventfd.S
+++ b/libc/arch-mips/syscalls/eventfd.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl eventfd
-    .align 4
-    .ent eventfd
+#include <private/bionic_asm.h>
 
-eventfd:
+ENTRY(eventfd)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_eventfd2
+    .cpload t9
+    li v0, __NR_eventfd2
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end eventfd
+END(eventfd)
diff --git a/libc/arch-mips/syscalls/execve.S b/libc/arch-mips/syscalls/execve.S
index 750b402..fcaec0a 100644
--- a/libc/arch-mips/syscalls/execve.S
+++ b/libc/arch-mips/syscalls/execve.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl execve
-    .align 4
-    .ent execve
+#include <private/bionic_asm.h>
 
-execve:
+ENTRY(execve)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_execve
+    .cpload t9
+    li v0, __NR_execve
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end execve
+END(execve)
diff --git a/libc/arch-mips/syscalls/faccessat.S b/libc/arch-mips/syscalls/faccessat.S
index ffa4f42..e7afe2a 100644
--- a/libc/arch-mips/syscalls/faccessat.S
+++ b/libc/arch-mips/syscalls/faccessat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl faccessat
-    .align 4
-    .ent faccessat
+#include <private/bionic_asm.h>
 
-faccessat:
+ENTRY(faccessat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_faccessat
+    .cpload t9
+    li v0, __NR_faccessat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end faccessat
+END(faccessat)
diff --git a/libc/arch-mips/syscalls/fallocate64.S b/libc/arch-mips/syscalls/fallocate64.S
index e844d16..d814606 100644
--- a/libc/arch-mips/syscalls/fallocate64.S
+++ b/libc/arch-mips/syscalls/fallocate64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fallocate64
-    .align 4
-    .ent fallocate64
+#include <private/bionic_asm.h>
 
-fallocate64:
+ENTRY(fallocate64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fallocate
+    .cpload t9
+    li v0, __NR_fallocate
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fallocate64
+END(fallocate64)
diff --git a/libc/arch-mips/syscalls/fchdir.S b/libc/arch-mips/syscalls/fchdir.S
index ae0b883..daac0f5 100644
--- a/libc/arch-mips/syscalls/fchdir.S
+++ b/libc/arch-mips/syscalls/fchdir.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fchdir
-    .align 4
-    .ent fchdir
+#include <private/bionic_asm.h>
 
-fchdir:
+ENTRY(fchdir)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fchdir
+    .cpload t9
+    li v0, __NR_fchdir
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fchdir
+END(fchdir)
diff --git a/libc/arch-mips/syscalls/fchmod.S b/libc/arch-mips/syscalls/fchmod.S
index 272964e..e947e41 100644
--- a/libc/arch-mips/syscalls/fchmod.S
+++ b/libc/arch-mips/syscalls/fchmod.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fchmod
-    .align 4
-    .ent fchmod
+#include <private/bionic_asm.h>
 
-fchmod:
+ENTRY(fchmod)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fchmod
+    .cpload t9
+    li v0, __NR_fchmod
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fchmod
+END(fchmod)
diff --git a/libc/arch-mips/syscalls/fchmodat.S b/libc/arch-mips/syscalls/fchmodat.S
index 388d221..4d2a7d3 100644
--- a/libc/arch-mips/syscalls/fchmodat.S
+++ b/libc/arch-mips/syscalls/fchmodat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fchmodat
-    .align 4
-    .ent fchmodat
+#include <private/bionic_asm.h>
 
-fchmodat:
+ENTRY(fchmodat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fchmodat
+    .cpload t9
+    li v0, __NR_fchmodat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fchmodat
+END(fchmodat)
diff --git a/libc/arch-mips/syscalls/fchown.S b/libc/arch-mips/syscalls/fchown.S
index 52d6e59..f59c0f4 100644
--- a/libc/arch-mips/syscalls/fchown.S
+++ b/libc/arch-mips/syscalls/fchown.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fchown
-    .align 4
-    .ent fchown
+#include <private/bionic_asm.h>
 
-fchown:
+ENTRY(fchown)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fchown
+    .cpload t9
+    li v0, __NR_fchown
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fchown
+END(fchown)
diff --git a/libc/arch-mips/syscalls/fchownat.S b/libc/arch-mips/syscalls/fchownat.S
index 6913d6c..af44cbc 100644
--- a/libc/arch-mips/syscalls/fchownat.S
+++ b/libc/arch-mips/syscalls/fchownat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fchownat
-    .align 4
-    .ent fchownat
+#include <private/bionic_asm.h>
 
-fchownat:
+ENTRY(fchownat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fchownat
+    .cpload t9
+    li v0, __NR_fchownat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fchownat
+END(fchownat)
diff --git a/libc/arch-mips/syscalls/fdatasync.S b/libc/arch-mips/syscalls/fdatasync.S
index a1d4056..07e3592 100644
--- a/libc/arch-mips/syscalls/fdatasync.S
+++ b/libc/arch-mips/syscalls/fdatasync.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fdatasync
-    .align 4
-    .ent fdatasync
+#include <private/bionic_asm.h>
 
-fdatasync:
+ENTRY(fdatasync)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fdatasync
+    .cpload t9
+    li v0, __NR_fdatasync
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fdatasync
+END(fdatasync)
diff --git a/libc/arch-mips/syscalls/fgetxattr.S b/libc/arch-mips/syscalls/fgetxattr.S
index 1d645a5..035e71c 100644
--- a/libc/arch-mips/syscalls/fgetxattr.S
+++ b/libc/arch-mips/syscalls/fgetxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fgetxattr
-    .align 4
-    .ent fgetxattr
+#include <private/bionic_asm.h>
 
-fgetxattr:
+ENTRY(fgetxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fgetxattr
+    .cpload t9
+    li v0, __NR_fgetxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fgetxattr
+END(fgetxattr)
diff --git a/libc/arch-mips/syscalls/flistxattr.S b/libc/arch-mips/syscalls/flistxattr.S
index 2cb53c5..500cd97 100644
--- a/libc/arch-mips/syscalls/flistxattr.S
+++ b/libc/arch-mips/syscalls/flistxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl flistxattr
-    .align 4
-    .ent flistxattr
+#include <private/bionic_asm.h>
 
-flistxattr:
+ENTRY(flistxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_flistxattr
+    .cpload t9
+    li v0, __NR_flistxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end flistxattr
+END(flistxattr)
diff --git a/libc/arch-mips/syscalls/flock.S b/libc/arch-mips/syscalls/flock.S
index c1723a1..7d843ab 100644
--- a/libc/arch-mips/syscalls/flock.S
+++ b/libc/arch-mips/syscalls/flock.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl flock
-    .align 4
-    .ent flock
+#include <private/bionic_asm.h>
 
-flock:
+ENTRY(flock)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_flock
+    .cpload t9
+    li v0, __NR_flock
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end flock
+END(flock)
diff --git a/libc/arch-mips/syscalls/fremovexattr.S b/libc/arch-mips/syscalls/fremovexattr.S
index 2526ae0..9f16186 100644
--- a/libc/arch-mips/syscalls/fremovexattr.S
+++ b/libc/arch-mips/syscalls/fremovexattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fremovexattr
-    .align 4
-    .ent fremovexattr
+#include <private/bionic_asm.h>
 
-fremovexattr:
+ENTRY(fremovexattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fremovexattr
+    .cpload t9
+    li v0, __NR_fremovexattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fremovexattr
+END(fremovexattr)
diff --git a/libc/arch-mips/syscalls/fsetxattr.S b/libc/arch-mips/syscalls/fsetxattr.S
index 4552b07..0347128 100644
--- a/libc/arch-mips/syscalls/fsetxattr.S
+++ b/libc/arch-mips/syscalls/fsetxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fsetxattr
-    .align 4
-    .ent fsetxattr
+#include <private/bionic_asm.h>
 
-fsetxattr:
+ENTRY(fsetxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fsetxattr
+    .cpload t9
+    li v0, __NR_fsetxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fsetxattr
+END(fsetxattr)
diff --git a/libc/arch-mips/syscalls/fstat64.S b/libc/arch-mips/syscalls/fstat64.S
index 904ce86..7228541 100644
--- a/libc/arch-mips/syscalls/fstat64.S
+++ b/libc/arch-mips/syscalls/fstat64.S
@@ -1,26 +1,22 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fstat64
-    .align 4
-    .ent fstat64
+#include <private/bionic_asm.h>
 
-fstat64:
+ENTRY(fstat64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fstat64
+    .cpload t9
+    li v0, __NR_fstat64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fstat64
+END(fstat64)
 
     .globl fstat
     .equ fstat, fstat64
diff --git a/libc/arch-mips/syscalls/fstatat64.S b/libc/arch-mips/syscalls/fstatat64.S
index 8c81a9f..b2903f2 100644
--- a/libc/arch-mips/syscalls/fstatat64.S
+++ b/libc/arch-mips/syscalls/fstatat64.S
@@ -1,26 +1,22 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fstatat64
-    .align 4
-    .ent fstatat64
+#include <private/bionic_asm.h>
 
-fstatat64:
+ENTRY(fstatat64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fstatat64
+    .cpload t9
+    li v0, __NR_fstatat64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fstatat64
+END(fstatat64)
 
     .globl fstatat
     .equ fstatat, fstatat64
diff --git a/libc/arch-mips/syscalls/fsync.S b/libc/arch-mips/syscalls/fsync.S
index 383bd0c..96b417d 100644
--- a/libc/arch-mips/syscalls/fsync.S
+++ b/libc/arch-mips/syscalls/fsync.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl fsync
-    .align 4
-    .ent fsync
+#include <private/bionic_asm.h>
 
-fsync:
+ENTRY(fsync)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_fsync
+    .cpload t9
+    li v0, __NR_fsync
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end fsync
+END(fsync)
diff --git a/libc/arch-mips/syscalls/ftruncate.S b/libc/arch-mips/syscalls/ftruncate.S
index 797d239..bd428fb 100644
--- a/libc/arch-mips/syscalls/ftruncate.S
+++ b/libc/arch-mips/syscalls/ftruncate.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl ftruncate
-    .align 4
-    .ent ftruncate
+#include <private/bionic_asm.h>
 
-ftruncate:
+ENTRY(ftruncate)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ftruncate
+    .cpload t9
+    li v0, __NR_ftruncate
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end ftruncate
+END(ftruncate)
diff --git a/libc/arch-mips/syscalls/ftruncate64.S b/libc/arch-mips/syscalls/ftruncate64.S
index e7f7f81..357e9a5 100644
--- a/libc/arch-mips/syscalls/ftruncate64.S
+++ b/libc/arch-mips/syscalls/ftruncate64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl ftruncate64
-    .align 4
-    .ent ftruncate64
+#include <private/bionic_asm.h>
 
-ftruncate64:
+ENTRY(ftruncate64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ftruncate64
+    .cpload t9
+    li v0, __NR_ftruncate64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end ftruncate64
+END(ftruncate64)
diff --git a/libc/arch-mips/syscalls/futex.S b/libc/arch-mips/syscalls/futex.S
index 25c88c8..a865fea 100644
--- a/libc/arch-mips/syscalls/futex.S
+++ b/libc/arch-mips/syscalls/futex.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl futex
-    .align 4
-    .ent futex
+#include <private/bionic_asm.h>
 
-futex:
+ENTRY(futex)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_futex
+    .cpload t9
+    li v0, __NR_futex
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end futex
+END(futex)
diff --git a/libc/arch-mips/syscalls/getdents.S b/libc/arch-mips/syscalls/getdents.S
index 7b8006a..ce92886 100644
--- a/libc/arch-mips/syscalls/getdents.S
+++ b/libc/arch-mips/syscalls/getdents.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getdents
-    .align 4
-    .ent getdents
+#include <private/bionic_asm.h>
 
-getdents:
+ENTRY(getdents)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getdents64
+    .cpload t9
+    li v0, __NR_getdents64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getdents
+END(getdents)
diff --git a/libc/arch-mips/syscalls/getegid.S b/libc/arch-mips/syscalls/getegid.S
index 5d75420..c3a3ac0 100644
--- a/libc/arch-mips/syscalls/getegid.S
+++ b/libc/arch-mips/syscalls/getegid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getegid
-    .align 4
-    .ent getegid
+#include <private/bionic_asm.h>
 
-getegid:
+ENTRY(getegid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getegid
+    .cpload t9
+    li v0, __NR_getegid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getegid
+END(getegid)
diff --git a/libc/arch-mips/syscalls/geteuid.S b/libc/arch-mips/syscalls/geteuid.S
index f878ea7..66e6d4f 100644
--- a/libc/arch-mips/syscalls/geteuid.S
+++ b/libc/arch-mips/syscalls/geteuid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl geteuid
-    .align 4
-    .ent geteuid
+#include <private/bionic_asm.h>
 
-geteuid:
+ENTRY(geteuid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_geteuid
+    .cpload t9
+    li v0, __NR_geteuid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end geteuid
+END(geteuid)
diff --git a/libc/arch-mips/syscalls/getgid.S b/libc/arch-mips/syscalls/getgid.S
index 207d1a1..674d527 100644
--- a/libc/arch-mips/syscalls/getgid.S
+++ b/libc/arch-mips/syscalls/getgid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getgid
-    .align 4
-    .ent getgid
+#include <private/bionic_asm.h>
 
-getgid:
+ENTRY(getgid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getgid
+    .cpload t9
+    li v0, __NR_getgid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getgid
+END(getgid)
diff --git a/libc/arch-mips/syscalls/getgroups.S b/libc/arch-mips/syscalls/getgroups.S
index d0a10a3..caa031b 100644
--- a/libc/arch-mips/syscalls/getgroups.S
+++ b/libc/arch-mips/syscalls/getgroups.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getgroups
-    .align 4
-    .ent getgroups
+#include <private/bionic_asm.h>
 
-getgroups:
+ENTRY(getgroups)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getgroups
+    .cpload t9
+    li v0, __NR_getgroups
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getgroups
+END(getgroups)
diff --git a/libc/arch-mips/syscalls/getitimer.S b/libc/arch-mips/syscalls/getitimer.S
index 40f90f2..e7a655a 100644
--- a/libc/arch-mips/syscalls/getitimer.S
+++ b/libc/arch-mips/syscalls/getitimer.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getitimer
-    .align 4
-    .ent getitimer
+#include <private/bionic_asm.h>
 
-getitimer:
+ENTRY(getitimer)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getitimer
+    .cpload t9
+    li v0, __NR_getitimer
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getitimer
+END(getitimer)
diff --git a/libc/arch-mips/syscalls/getpeername.S b/libc/arch-mips/syscalls/getpeername.S
index 6d491de..31df8ad 100644
--- a/libc/arch-mips/syscalls/getpeername.S
+++ b/libc/arch-mips/syscalls/getpeername.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getpeername
-    .align 4
-    .ent getpeername
+#include <private/bionic_asm.h>
 
-getpeername:
+ENTRY(getpeername)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getpeername
+    .cpload t9
+    li v0, __NR_getpeername
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getpeername
+END(getpeername)
diff --git a/libc/arch-mips/syscalls/getpgid.S b/libc/arch-mips/syscalls/getpgid.S
index dc6ec96..7e3e439 100644
--- a/libc/arch-mips/syscalls/getpgid.S
+++ b/libc/arch-mips/syscalls/getpgid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getpgid
-    .align 4
-    .ent getpgid
+#include <private/bionic_asm.h>
 
-getpgid:
+ENTRY(getpgid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getpgid
+    .cpload t9
+    li v0, __NR_getpgid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getpgid
+END(getpgid)
diff --git a/libc/arch-mips/syscalls/getpid.S b/libc/arch-mips/syscalls/getpid.S
index 244d256..a053f5b 100644
--- a/libc/arch-mips/syscalls/getpid.S
+++ b/libc/arch-mips/syscalls/getpid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getpid
-    .align 4
-    .ent getpid
+#include <private/bionic_asm.h>
 
-getpid:
+ENTRY(getpid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getpid
+    .cpload t9
+    li v0, __NR_getpid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getpid
+END(getpid)
diff --git a/libc/arch-mips/syscalls/getppid.S b/libc/arch-mips/syscalls/getppid.S
index 1973424..3d76fc2 100644
--- a/libc/arch-mips/syscalls/getppid.S
+++ b/libc/arch-mips/syscalls/getppid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getppid
-    .align 4
-    .ent getppid
+#include <private/bionic_asm.h>
 
-getppid:
+ENTRY(getppid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getppid
+    .cpload t9
+    li v0, __NR_getppid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getppid
+END(getppid)
diff --git a/libc/arch-mips/syscalls/getresgid.S b/libc/arch-mips/syscalls/getresgid.S
index b78e90c..235902a 100644
--- a/libc/arch-mips/syscalls/getresgid.S
+++ b/libc/arch-mips/syscalls/getresgid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getresgid
-    .align 4
-    .ent getresgid
+#include <private/bionic_asm.h>
 
-getresgid:
+ENTRY(getresgid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getresgid
+    .cpload t9
+    li v0, __NR_getresgid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getresgid
+END(getresgid)
diff --git a/libc/arch-mips/syscalls/getresuid.S b/libc/arch-mips/syscalls/getresuid.S
index 336c049..c6c4c13 100644
--- a/libc/arch-mips/syscalls/getresuid.S
+++ b/libc/arch-mips/syscalls/getresuid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getresuid
-    .align 4
-    .ent getresuid
+#include <private/bionic_asm.h>
 
-getresuid:
+ENTRY(getresuid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getresuid
+    .cpload t9
+    li v0, __NR_getresuid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getresuid
+END(getresuid)
diff --git a/libc/arch-mips/syscalls/getrlimit.S b/libc/arch-mips/syscalls/getrlimit.S
index 557c2c1..ef4ae89 100644
--- a/libc/arch-mips/syscalls/getrlimit.S
+++ b/libc/arch-mips/syscalls/getrlimit.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getrlimit
-    .align 4
-    .ent getrlimit
+#include <private/bionic_asm.h>
 
-getrlimit:
+ENTRY(getrlimit)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getrlimit
+    .cpload t9
+    li v0, __NR_getrlimit
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getrlimit
+END(getrlimit)
diff --git a/libc/arch-mips/syscalls/getrusage.S b/libc/arch-mips/syscalls/getrusage.S
index c2750f9..21cabfa 100644
--- a/libc/arch-mips/syscalls/getrusage.S
+++ b/libc/arch-mips/syscalls/getrusage.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getrusage
-    .align 4
-    .ent getrusage
+#include <private/bionic_asm.h>
 
-getrusage:
+ENTRY(getrusage)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getrusage
+    .cpload t9
+    li v0, __NR_getrusage
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getrusage
+END(getrusage)
diff --git a/libc/arch-mips/syscalls/getsid.S b/libc/arch-mips/syscalls/getsid.S
index 9ceb65d..b0b21a0 100644
--- a/libc/arch-mips/syscalls/getsid.S
+++ b/libc/arch-mips/syscalls/getsid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getsid
-    .align 4
-    .ent getsid
+#include <private/bionic_asm.h>
 
-getsid:
+ENTRY(getsid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getsid
+    .cpload t9
+    li v0, __NR_getsid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getsid
+END(getsid)
diff --git a/libc/arch-mips/syscalls/getsockname.S b/libc/arch-mips/syscalls/getsockname.S
index 43b28c2..82d0b83 100644
--- a/libc/arch-mips/syscalls/getsockname.S
+++ b/libc/arch-mips/syscalls/getsockname.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getsockname
-    .align 4
-    .ent getsockname
+#include <private/bionic_asm.h>
 
-getsockname:
+ENTRY(getsockname)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getsockname
+    .cpload t9
+    li v0, __NR_getsockname
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getsockname
+END(getsockname)
diff --git a/libc/arch-mips/syscalls/getsockopt.S b/libc/arch-mips/syscalls/getsockopt.S
index affe539..ad360e3 100644
--- a/libc/arch-mips/syscalls/getsockopt.S
+++ b/libc/arch-mips/syscalls/getsockopt.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getsockopt
-    .align 4
-    .ent getsockopt
+#include <private/bionic_asm.h>
 
-getsockopt:
+ENTRY(getsockopt)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getsockopt
+    .cpload t9
+    li v0, __NR_getsockopt
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getsockopt
+END(getsockopt)
diff --git a/libc/arch-mips/syscalls/gettid.S b/libc/arch-mips/syscalls/gettid.S
index d258ef2..cfdc57b 100644
--- a/libc/arch-mips/syscalls/gettid.S
+++ b/libc/arch-mips/syscalls/gettid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl gettid
-    .align 4
-    .ent gettid
+#include <private/bionic_asm.h>
 
-gettid:
+ENTRY(gettid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_gettid
+    .cpload t9
+    li v0, __NR_gettid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end gettid
+END(gettid)
diff --git a/libc/arch-mips/syscalls/gettimeofday.S b/libc/arch-mips/syscalls/gettimeofday.S
index 006752e..e66fd77 100644
--- a/libc/arch-mips/syscalls/gettimeofday.S
+++ b/libc/arch-mips/syscalls/gettimeofday.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl gettimeofday
-    .align 4
-    .ent gettimeofday
+#include <private/bionic_asm.h>
 
-gettimeofday:
+ENTRY(gettimeofday)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_gettimeofday
+    .cpload t9
+    li v0, __NR_gettimeofday
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end gettimeofday
+END(gettimeofday)
diff --git a/libc/arch-mips/syscalls/getuid.S b/libc/arch-mips/syscalls/getuid.S
index 747318a..345af71 100644
--- a/libc/arch-mips/syscalls/getuid.S
+++ b/libc/arch-mips/syscalls/getuid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getuid
-    .align 4
-    .ent getuid
+#include <private/bionic_asm.h>
 
-getuid:
+ENTRY(getuid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getuid
+    .cpload t9
+    li v0, __NR_getuid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getuid
+END(getuid)
diff --git a/libc/arch-mips/syscalls/getxattr.S b/libc/arch-mips/syscalls/getxattr.S
index 2f82c4c..c7e215e 100644
--- a/libc/arch-mips/syscalls/getxattr.S
+++ b/libc/arch-mips/syscalls/getxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl getxattr
-    .align 4
-    .ent getxattr
+#include <private/bionic_asm.h>
 
-getxattr:
+ENTRY(getxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_getxattr
+    .cpload t9
+    li v0, __NR_getxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end getxattr
+END(getxattr)
diff --git a/libc/arch-mips/syscalls/init_module.S b/libc/arch-mips/syscalls/init_module.S
index ee644b3..21ba5b1 100644
--- a/libc/arch-mips/syscalls/init_module.S
+++ b/libc/arch-mips/syscalls/init_module.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl init_module
-    .align 4
-    .ent init_module
+#include <private/bionic_asm.h>
 
-init_module:
+ENTRY(init_module)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_init_module
+    .cpload t9
+    li v0, __NR_init_module
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end init_module
+END(init_module)
diff --git a/libc/arch-mips/syscalls/inotify_add_watch.S b/libc/arch-mips/syscalls/inotify_add_watch.S
index f1c4d92..beb70ec 100644
--- a/libc/arch-mips/syscalls/inotify_add_watch.S
+++ b/libc/arch-mips/syscalls/inotify_add_watch.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl inotify_add_watch
-    .align 4
-    .ent inotify_add_watch
+#include <private/bionic_asm.h>
 
-inotify_add_watch:
+ENTRY(inotify_add_watch)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_inotify_add_watch
+    .cpload t9
+    li v0, __NR_inotify_add_watch
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end inotify_add_watch
+END(inotify_add_watch)
diff --git a/libc/arch-mips/syscalls/inotify_init1.S b/libc/arch-mips/syscalls/inotify_init1.S
index c3fcf48..6c825c6 100644
--- a/libc/arch-mips/syscalls/inotify_init1.S
+++ b/libc/arch-mips/syscalls/inotify_init1.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl inotify_init1
-    .align 4
-    .ent inotify_init1
+#include <private/bionic_asm.h>
 
-inotify_init1:
+ENTRY(inotify_init1)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_inotify_init1
+    .cpload t9
+    li v0, __NR_inotify_init1
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end inotify_init1
+END(inotify_init1)
diff --git a/libc/arch-mips/syscalls/inotify_rm_watch.S b/libc/arch-mips/syscalls/inotify_rm_watch.S
index 13191af..280f2b4 100644
--- a/libc/arch-mips/syscalls/inotify_rm_watch.S
+++ b/libc/arch-mips/syscalls/inotify_rm_watch.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl inotify_rm_watch
-    .align 4
-    .ent inotify_rm_watch
+#include <private/bionic_asm.h>
 
-inotify_rm_watch:
+ENTRY(inotify_rm_watch)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_inotify_rm_watch
+    .cpload t9
+    li v0, __NR_inotify_rm_watch
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end inotify_rm_watch
+END(inotify_rm_watch)
diff --git a/libc/arch-mips/syscalls/ioprio_get.S b/libc/arch-mips/syscalls/ioprio_get.S
index b8bd1d3..fbc8b17 100644
--- a/libc/arch-mips/syscalls/ioprio_get.S
+++ b/libc/arch-mips/syscalls/ioprio_get.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl ioprio_get
-    .align 4
-    .ent ioprio_get
+#include <private/bionic_asm.h>
 
-ioprio_get:
+ENTRY(ioprio_get)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ioprio_get
+    .cpload t9
+    li v0, __NR_ioprio_get
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end ioprio_get
+END(ioprio_get)
diff --git a/libc/arch-mips/syscalls/ioprio_set.S b/libc/arch-mips/syscalls/ioprio_set.S
index c5b3bdc..d0320ed 100644
--- a/libc/arch-mips/syscalls/ioprio_set.S
+++ b/libc/arch-mips/syscalls/ioprio_set.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl ioprio_set
-    .align 4
-    .ent ioprio_set
+#include <private/bionic_asm.h>
 
-ioprio_set:
+ENTRY(ioprio_set)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_ioprio_set
+    .cpload t9
+    li v0, __NR_ioprio_set
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end ioprio_set
+END(ioprio_set)
diff --git a/libc/arch-mips/syscalls/kill.S b/libc/arch-mips/syscalls/kill.S
index 20a484e..0941717 100644
--- a/libc/arch-mips/syscalls/kill.S
+++ b/libc/arch-mips/syscalls/kill.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl kill
-    .align 4
-    .ent kill
+#include <private/bionic_asm.h>
 
-kill:
+ENTRY(kill)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_kill
+    .cpload t9
+    li v0, __NR_kill
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end kill
+END(kill)
diff --git a/libc/arch-mips/syscalls/klogctl.S b/libc/arch-mips/syscalls/klogctl.S
index 5d30db2..ebc8837 100644
--- a/libc/arch-mips/syscalls/klogctl.S
+++ b/libc/arch-mips/syscalls/klogctl.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl klogctl
-    .align 4
-    .ent klogctl
+#include <private/bionic_asm.h>
 
-klogctl:
+ENTRY(klogctl)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_syslog
+    .cpload t9
+    li v0, __NR_syslog
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end klogctl
+END(klogctl)
diff --git a/libc/arch-mips/syscalls/lgetxattr.S b/libc/arch-mips/syscalls/lgetxattr.S
index 6266aaf..8c4a252 100644
--- a/libc/arch-mips/syscalls/lgetxattr.S
+++ b/libc/arch-mips/syscalls/lgetxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl lgetxattr
-    .align 4
-    .ent lgetxattr
+#include <private/bionic_asm.h>
 
-lgetxattr:
+ENTRY(lgetxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_lgetxattr
+    .cpload t9
+    li v0, __NR_lgetxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end lgetxattr
+END(lgetxattr)
diff --git a/libc/arch-mips/syscalls/linkat.S b/libc/arch-mips/syscalls/linkat.S
index dae07dd..cc7278d 100644
--- a/libc/arch-mips/syscalls/linkat.S
+++ b/libc/arch-mips/syscalls/linkat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl linkat
-    .align 4
-    .ent linkat
+#include <private/bionic_asm.h>
 
-linkat:
+ENTRY(linkat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_linkat
+    .cpload t9
+    li v0, __NR_linkat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end linkat
+END(linkat)
diff --git a/libc/arch-mips/syscalls/listen.S b/libc/arch-mips/syscalls/listen.S
index f2e6083..68eba52 100644
--- a/libc/arch-mips/syscalls/listen.S
+++ b/libc/arch-mips/syscalls/listen.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl listen
-    .align 4
-    .ent listen
+#include <private/bionic_asm.h>
 
-listen:
+ENTRY(listen)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_listen
+    .cpload t9
+    li v0, __NR_listen
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end listen
+END(listen)
diff --git a/libc/arch-mips/syscalls/listxattr.S b/libc/arch-mips/syscalls/listxattr.S
index e752340..006bfce 100644
--- a/libc/arch-mips/syscalls/listxattr.S
+++ b/libc/arch-mips/syscalls/listxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl listxattr
-    .align 4
-    .ent listxattr
+#include <private/bionic_asm.h>
 
-listxattr:
+ENTRY(listxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_listxattr
+    .cpload t9
+    li v0, __NR_listxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end listxattr
+END(listxattr)
diff --git a/libc/arch-mips/syscalls/llistxattr.S b/libc/arch-mips/syscalls/llistxattr.S
index 9dc868e..7f833ad 100644
--- a/libc/arch-mips/syscalls/llistxattr.S
+++ b/libc/arch-mips/syscalls/llistxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl llistxattr
-    .align 4
-    .ent llistxattr
+#include <private/bionic_asm.h>
 
-llistxattr:
+ENTRY(llistxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_llistxattr
+    .cpload t9
+    li v0, __NR_llistxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end llistxattr
+END(llistxattr)
diff --git a/libc/arch-mips/syscalls/lremovexattr.S b/libc/arch-mips/syscalls/lremovexattr.S
index d7e6609..21d00ea 100644
--- a/libc/arch-mips/syscalls/lremovexattr.S
+++ b/libc/arch-mips/syscalls/lremovexattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl lremovexattr
-    .align 4
-    .ent lremovexattr
+#include <private/bionic_asm.h>
 
-lremovexattr:
+ENTRY(lremovexattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_lremovexattr
+    .cpload t9
+    li v0, __NR_lremovexattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end lremovexattr
+END(lremovexattr)
diff --git a/libc/arch-mips/syscalls/lseek.S b/libc/arch-mips/syscalls/lseek.S
index 269cc95..82c2776 100644
--- a/libc/arch-mips/syscalls/lseek.S
+++ b/libc/arch-mips/syscalls/lseek.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl lseek
-    .align 4
-    .ent lseek
+#include <private/bionic_asm.h>
 
-lseek:
+ENTRY(lseek)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_lseek
+    .cpload t9
+    li v0, __NR_lseek
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end lseek
+END(lseek)
diff --git a/libc/arch-mips/syscalls/lsetxattr.S b/libc/arch-mips/syscalls/lsetxattr.S
index 2dfd24a..d54ec69 100644
--- a/libc/arch-mips/syscalls/lsetxattr.S
+++ b/libc/arch-mips/syscalls/lsetxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl lsetxattr
-    .align 4
-    .ent lsetxattr
+#include <private/bionic_asm.h>
 
-lsetxattr:
+ENTRY(lsetxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_lsetxattr
+    .cpload t9
+    li v0, __NR_lsetxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end lsetxattr
+END(lsetxattr)
diff --git a/libc/arch-mips/syscalls/madvise.S b/libc/arch-mips/syscalls/madvise.S
index 8318272..9aa2815 100644
--- a/libc/arch-mips/syscalls/madvise.S
+++ b/libc/arch-mips/syscalls/madvise.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl madvise
-    .align 4
-    .ent madvise
+#include <private/bionic_asm.h>
 
-madvise:
+ENTRY(madvise)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_madvise
+    .cpload t9
+    li v0, __NR_madvise
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end madvise
+END(madvise)
diff --git a/libc/arch-mips/syscalls/mincore.S b/libc/arch-mips/syscalls/mincore.S
index 629a468..0db4313 100644
--- a/libc/arch-mips/syscalls/mincore.S
+++ b/libc/arch-mips/syscalls/mincore.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mincore
-    .align 4
-    .ent mincore
+#include <private/bionic_asm.h>
 
-mincore:
+ENTRY(mincore)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mincore
+    .cpload t9
+    li v0, __NR_mincore
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mincore
+END(mincore)
diff --git a/libc/arch-mips/syscalls/mkdirat.S b/libc/arch-mips/syscalls/mkdirat.S
index 3f8bc19..0ac98d4 100644
--- a/libc/arch-mips/syscalls/mkdirat.S
+++ b/libc/arch-mips/syscalls/mkdirat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mkdirat
-    .align 4
-    .ent mkdirat
+#include <private/bionic_asm.h>
 
-mkdirat:
+ENTRY(mkdirat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mkdirat
+    .cpload t9
+    li v0, __NR_mkdirat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mkdirat
+END(mkdirat)
diff --git a/libc/arch-mips/syscalls/mknodat.S b/libc/arch-mips/syscalls/mknodat.S
index fc05bb3..b85d8bf 100644
--- a/libc/arch-mips/syscalls/mknodat.S
+++ b/libc/arch-mips/syscalls/mknodat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mknodat
-    .align 4
-    .ent mknodat
+#include <private/bionic_asm.h>
 
-mknodat:
+ENTRY(mknodat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mknodat
+    .cpload t9
+    li v0, __NR_mknodat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mknodat
+END(mknodat)
diff --git a/libc/arch-mips/syscalls/mlock.S b/libc/arch-mips/syscalls/mlock.S
index 20cacda..0ba2bca 100644
--- a/libc/arch-mips/syscalls/mlock.S
+++ b/libc/arch-mips/syscalls/mlock.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mlock
-    .align 4
-    .ent mlock
+#include <private/bionic_asm.h>
 
-mlock:
+ENTRY(mlock)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mlock
+    .cpload t9
+    li v0, __NR_mlock
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mlock
+END(mlock)
diff --git a/libc/arch-mips/syscalls/mlockall.S b/libc/arch-mips/syscalls/mlockall.S
index 0aac087..642c6e2 100644
--- a/libc/arch-mips/syscalls/mlockall.S
+++ b/libc/arch-mips/syscalls/mlockall.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mlockall
-    .align 4
-    .ent mlockall
+#include <private/bionic_asm.h>
 
-mlockall:
+ENTRY(mlockall)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mlockall
+    .cpload t9
+    li v0, __NR_mlockall
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mlockall
+END(mlockall)
diff --git a/libc/arch-mips/syscalls/mount.S b/libc/arch-mips/syscalls/mount.S
index 1f951ce..f0c5f6b 100644
--- a/libc/arch-mips/syscalls/mount.S
+++ b/libc/arch-mips/syscalls/mount.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mount
-    .align 4
-    .ent mount
+#include <private/bionic_asm.h>
 
-mount:
+ENTRY(mount)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mount
+    .cpload t9
+    li v0, __NR_mount
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mount
+END(mount)
diff --git a/libc/arch-mips/syscalls/mprotect.S b/libc/arch-mips/syscalls/mprotect.S
index 7d9e784..c0ce988 100644
--- a/libc/arch-mips/syscalls/mprotect.S
+++ b/libc/arch-mips/syscalls/mprotect.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mprotect
-    .align 4
-    .ent mprotect
+#include <private/bionic_asm.h>
 
-mprotect:
+ENTRY(mprotect)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mprotect
+    .cpload t9
+    li v0, __NR_mprotect
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mprotect
+END(mprotect)
diff --git a/libc/arch-mips/syscalls/mremap.S b/libc/arch-mips/syscalls/mremap.S
index 22ddda9..bd4c385 100644
--- a/libc/arch-mips/syscalls/mremap.S
+++ b/libc/arch-mips/syscalls/mremap.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl mremap
-    .align 4
-    .ent mremap
+#include <private/bionic_asm.h>
 
-mremap:
+ENTRY(mremap)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_mremap
+    .cpload t9
+    li v0, __NR_mremap
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end mremap
+END(mremap)
diff --git a/libc/arch-mips/syscalls/msync.S b/libc/arch-mips/syscalls/msync.S
index 4969433..e8ecb2a 100644
--- a/libc/arch-mips/syscalls/msync.S
+++ b/libc/arch-mips/syscalls/msync.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl msync
-    .align 4
-    .ent msync
+#include <private/bionic_asm.h>
 
-msync:
+ENTRY(msync)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_msync
+    .cpload t9
+    li v0, __NR_msync
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end msync
+END(msync)
diff --git a/libc/arch-mips/syscalls/munlock.S b/libc/arch-mips/syscalls/munlock.S
index 59f1d44..f8ddc3a 100644
--- a/libc/arch-mips/syscalls/munlock.S
+++ b/libc/arch-mips/syscalls/munlock.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl munlock
-    .align 4
-    .ent munlock
+#include <private/bionic_asm.h>
 
-munlock:
+ENTRY(munlock)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_munlock
+    .cpload t9
+    li v0, __NR_munlock
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end munlock
+END(munlock)
diff --git a/libc/arch-mips/syscalls/munlockall.S b/libc/arch-mips/syscalls/munlockall.S
index d0a8e9f..5ced5c6 100644
--- a/libc/arch-mips/syscalls/munlockall.S
+++ b/libc/arch-mips/syscalls/munlockall.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl munlockall
-    .align 4
-    .ent munlockall
+#include <private/bionic_asm.h>
 
-munlockall:
+ENTRY(munlockall)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_munlockall
+    .cpload t9
+    li v0, __NR_munlockall
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end munlockall
+END(munlockall)
diff --git a/libc/arch-mips/syscalls/munmap.S b/libc/arch-mips/syscalls/munmap.S
index d4c1057..527825c 100644
--- a/libc/arch-mips/syscalls/munmap.S
+++ b/libc/arch-mips/syscalls/munmap.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl munmap
-    .align 4
-    .ent munmap
+#include <private/bionic_asm.h>
 
-munmap:
+ENTRY(munmap)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_munmap
+    .cpload t9
+    li v0, __NR_munmap
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end munmap
+END(munmap)
diff --git a/libc/arch-mips/syscalls/nanosleep.S b/libc/arch-mips/syscalls/nanosleep.S
index ad3b0f9..8dc816a 100644
--- a/libc/arch-mips/syscalls/nanosleep.S
+++ b/libc/arch-mips/syscalls/nanosleep.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl nanosleep
-    .align 4
-    .ent nanosleep
+#include <private/bionic_asm.h>
 
-nanosleep:
+ENTRY(nanosleep)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_nanosleep
+    .cpload t9
+    li v0, __NR_nanosleep
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end nanosleep
+END(nanosleep)
diff --git a/libc/arch-mips/syscalls/perf_event_open.S b/libc/arch-mips/syscalls/perf_event_open.S
index edd8b85..a0e4416 100644
--- a/libc/arch-mips/syscalls/perf_event_open.S
+++ b/libc/arch-mips/syscalls/perf_event_open.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl perf_event_open
-    .align 4
-    .ent perf_event_open
+#include <private/bionic_asm.h>
 
-perf_event_open:
+ENTRY(perf_event_open)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_perf_event_open
+    .cpload t9
+    li v0, __NR_perf_event_open
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end perf_event_open
+END(perf_event_open)
diff --git a/libc/arch-mips/syscalls/personality.S b/libc/arch-mips/syscalls/personality.S
index 59aaeac..e8449a7 100644
--- a/libc/arch-mips/syscalls/personality.S
+++ b/libc/arch-mips/syscalls/personality.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl personality
-    .align 4
-    .ent personality
+#include <private/bionic_asm.h>
 
-personality:
+ENTRY(personality)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_personality
+    .cpload t9
+    li v0, __NR_personality
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end personality
+END(personality)
diff --git a/libc/arch-mips/syscalls/pipe2.S b/libc/arch-mips/syscalls/pipe2.S
index 798bd7b..478d364 100644
--- a/libc/arch-mips/syscalls/pipe2.S
+++ b/libc/arch-mips/syscalls/pipe2.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl pipe2
-    .align 4
-    .ent pipe2
+#include <private/bionic_asm.h>
 
-pipe2:
+ENTRY(pipe2)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_pipe2
+    .cpload t9
+    li v0, __NR_pipe2
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end pipe2
+END(pipe2)
diff --git a/libc/arch-mips/syscalls/prctl.S b/libc/arch-mips/syscalls/prctl.S
index 5e9a28d..e9aff3c 100644
--- a/libc/arch-mips/syscalls/prctl.S
+++ b/libc/arch-mips/syscalls/prctl.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl prctl
-    .align 4
-    .ent prctl
+#include <private/bionic_asm.h>
 
-prctl:
+ENTRY(prctl)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_prctl
+    .cpload t9
+    li v0, __NR_prctl
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end prctl
+END(prctl)
diff --git a/libc/arch-mips/syscalls/pread64.S b/libc/arch-mips/syscalls/pread64.S
index 870b138..55a54c6 100644
--- a/libc/arch-mips/syscalls/pread64.S
+++ b/libc/arch-mips/syscalls/pread64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl pread64
-    .align 4
-    .ent pread64
+#include <private/bionic_asm.h>
 
-pread64:
+ENTRY(pread64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_pread64
+    .cpload t9
+    li v0, __NR_pread64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end pread64
+END(pread64)
diff --git a/libc/arch-mips/syscalls/prlimit64.S b/libc/arch-mips/syscalls/prlimit64.S
index 17e9157..c695d18 100644
--- a/libc/arch-mips/syscalls/prlimit64.S
+++ b/libc/arch-mips/syscalls/prlimit64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl prlimit64
-    .align 4
-    .ent prlimit64
+#include <private/bionic_asm.h>
 
-prlimit64:
+ENTRY(prlimit64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_prlimit64
+    .cpload t9
+    li v0, __NR_prlimit64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end prlimit64
+END(prlimit64)
diff --git a/libc/arch-mips/syscalls/pwrite64.S b/libc/arch-mips/syscalls/pwrite64.S
index 1e808ff..64d3ee1 100644
--- a/libc/arch-mips/syscalls/pwrite64.S
+++ b/libc/arch-mips/syscalls/pwrite64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl pwrite64
-    .align 4
-    .ent pwrite64
+#include <private/bionic_asm.h>
 
-pwrite64:
+ENTRY(pwrite64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_pwrite64
+    .cpload t9
+    li v0, __NR_pwrite64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end pwrite64
+END(pwrite64)
diff --git a/libc/arch-mips/syscalls/read.S b/libc/arch-mips/syscalls/read.S
index c649837..ff548ab 100644
--- a/libc/arch-mips/syscalls/read.S
+++ b/libc/arch-mips/syscalls/read.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl read
-    .align 4
-    .ent read
+#include <private/bionic_asm.h>
 
-read:
+ENTRY(read)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_read
+    .cpload t9
+    li v0, __NR_read
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end read
+END(read)
diff --git a/libc/arch-mips/syscalls/readahead.S b/libc/arch-mips/syscalls/readahead.S
index 09eab9e..674286a 100644
--- a/libc/arch-mips/syscalls/readahead.S
+++ b/libc/arch-mips/syscalls/readahead.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl readahead
-    .align 4
-    .ent readahead
+#include <private/bionic_asm.h>
 
-readahead:
+ENTRY(readahead)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_readahead
+    .cpload t9
+    li v0, __NR_readahead
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end readahead
+END(readahead)
diff --git a/libc/arch-mips/syscalls/readlinkat.S b/libc/arch-mips/syscalls/readlinkat.S
index 3e5d72f..a1c7d6b 100644
--- a/libc/arch-mips/syscalls/readlinkat.S
+++ b/libc/arch-mips/syscalls/readlinkat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl readlinkat
-    .align 4
-    .ent readlinkat
+#include <private/bionic_asm.h>
 
-readlinkat:
+ENTRY(readlinkat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_readlinkat
+    .cpload t9
+    li v0, __NR_readlinkat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end readlinkat
+END(readlinkat)
diff --git a/libc/arch-mips/syscalls/readv.S b/libc/arch-mips/syscalls/readv.S
index 1f367be..af5a4cb 100644
--- a/libc/arch-mips/syscalls/readv.S
+++ b/libc/arch-mips/syscalls/readv.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl readv
-    .align 4
-    .ent readv
+#include <private/bionic_asm.h>
 
-readv:
+ENTRY(readv)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_readv
+    .cpload t9
+    li v0, __NR_readv
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end readv
+END(readv)
diff --git a/libc/arch-mips/syscalls/recvfrom.S b/libc/arch-mips/syscalls/recvfrom.S
index 3c2303c..04b04f6 100644
--- a/libc/arch-mips/syscalls/recvfrom.S
+++ b/libc/arch-mips/syscalls/recvfrom.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl recvfrom
-    .align 4
-    .ent recvfrom
+#include <private/bionic_asm.h>
 
-recvfrom:
+ENTRY(recvfrom)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_recvfrom
+    .cpload t9
+    li v0, __NR_recvfrom
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end recvfrom
+END(recvfrom)
diff --git a/libc/arch-mips/syscalls/recvmsg.S b/libc/arch-mips/syscalls/recvmsg.S
index aaf022f..a0a3a3f 100644
--- a/libc/arch-mips/syscalls/recvmsg.S
+++ b/libc/arch-mips/syscalls/recvmsg.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl recvmsg
-    .align 4
-    .ent recvmsg
+#include <private/bionic_asm.h>
 
-recvmsg:
+ENTRY(recvmsg)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_recvmsg
+    .cpload t9
+    li v0, __NR_recvmsg
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end recvmsg
+END(recvmsg)
diff --git a/libc/arch-mips/syscalls/removexattr.S b/libc/arch-mips/syscalls/removexattr.S
index 29df5d2..0f72ebf 100644
--- a/libc/arch-mips/syscalls/removexattr.S
+++ b/libc/arch-mips/syscalls/removexattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl removexattr
-    .align 4
-    .ent removexattr
+#include <private/bionic_asm.h>
 
-removexattr:
+ENTRY(removexattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_removexattr
+    .cpload t9
+    li v0, __NR_removexattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end removexattr
+END(removexattr)
diff --git a/libc/arch-mips/syscalls/renameat.S b/libc/arch-mips/syscalls/renameat.S
index b7c210e..210b439 100644
--- a/libc/arch-mips/syscalls/renameat.S
+++ b/libc/arch-mips/syscalls/renameat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl renameat
-    .align 4
-    .ent renameat
+#include <private/bionic_asm.h>
 
-renameat:
+ENTRY(renameat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_renameat
+    .cpload t9
+    li v0, __NR_renameat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end renameat
+END(renameat)
diff --git a/libc/arch-mips/syscalls/sched_get_priority_max.S b/libc/arch-mips/syscalls/sched_get_priority_max.S
index 6d63fec..d15a868 100644
--- a/libc/arch-mips/syscalls/sched_get_priority_max.S
+++ b/libc/arch-mips/syscalls/sched_get_priority_max.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_get_priority_max
-    .align 4
-    .ent sched_get_priority_max
+#include <private/bionic_asm.h>
 
-sched_get_priority_max:
+ENTRY(sched_get_priority_max)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_get_priority_max
+    .cpload t9
+    li v0, __NR_sched_get_priority_max
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_get_priority_max
+END(sched_get_priority_max)
diff --git a/libc/arch-mips/syscalls/sched_get_priority_min.S b/libc/arch-mips/syscalls/sched_get_priority_min.S
index de88b3e..5ff21c6 100644
--- a/libc/arch-mips/syscalls/sched_get_priority_min.S
+++ b/libc/arch-mips/syscalls/sched_get_priority_min.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_get_priority_min
-    .align 4
-    .ent sched_get_priority_min
+#include <private/bionic_asm.h>
 
-sched_get_priority_min:
+ENTRY(sched_get_priority_min)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_get_priority_min
+    .cpload t9
+    li v0, __NR_sched_get_priority_min
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_get_priority_min
+END(sched_get_priority_min)
diff --git a/libc/arch-mips/syscalls/sched_getparam.S b/libc/arch-mips/syscalls/sched_getparam.S
index ae261db..1cbe720 100644
--- a/libc/arch-mips/syscalls/sched_getparam.S
+++ b/libc/arch-mips/syscalls/sched_getparam.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_getparam
-    .align 4
-    .ent sched_getparam
+#include <private/bionic_asm.h>
 
-sched_getparam:
+ENTRY(sched_getparam)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_getparam
+    .cpload t9
+    li v0, __NR_sched_getparam
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_getparam
+END(sched_getparam)
diff --git a/libc/arch-mips/syscalls/sched_getscheduler.S b/libc/arch-mips/syscalls/sched_getscheduler.S
index 6a4e6f6..88b16e0 100644
--- a/libc/arch-mips/syscalls/sched_getscheduler.S
+++ b/libc/arch-mips/syscalls/sched_getscheduler.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_getscheduler
-    .align 4
-    .ent sched_getscheduler
+#include <private/bionic_asm.h>
 
-sched_getscheduler:
+ENTRY(sched_getscheduler)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_getscheduler
+    .cpload t9
+    li v0, __NR_sched_getscheduler
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_getscheduler
+END(sched_getscheduler)
diff --git a/libc/arch-mips/syscalls/sched_rr_get_interval.S b/libc/arch-mips/syscalls/sched_rr_get_interval.S
index 436f8b3..647ee3c 100644
--- a/libc/arch-mips/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-mips/syscalls/sched_rr_get_interval.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_rr_get_interval
-    .align 4
-    .ent sched_rr_get_interval
+#include <private/bionic_asm.h>
 
-sched_rr_get_interval:
+ENTRY(sched_rr_get_interval)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_rr_get_interval
+    .cpload t9
+    li v0, __NR_sched_rr_get_interval
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_rr_get_interval
+END(sched_rr_get_interval)
diff --git a/libc/arch-mips/syscalls/sched_setaffinity.S b/libc/arch-mips/syscalls/sched_setaffinity.S
index 98bf458..1184766 100644
--- a/libc/arch-mips/syscalls/sched_setaffinity.S
+++ b/libc/arch-mips/syscalls/sched_setaffinity.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_setaffinity
-    .align 4
-    .ent sched_setaffinity
+#include <private/bionic_asm.h>
 
-sched_setaffinity:
+ENTRY(sched_setaffinity)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_setaffinity
+    .cpload t9
+    li v0, __NR_sched_setaffinity
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_setaffinity
+END(sched_setaffinity)
diff --git a/libc/arch-mips/syscalls/sched_setparam.S b/libc/arch-mips/syscalls/sched_setparam.S
index 2c03e93..1811c74 100644
--- a/libc/arch-mips/syscalls/sched_setparam.S
+++ b/libc/arch-mips/syscalls/sched_setparam.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_setparam
-    .align 4
-    .ent sched_setparam
+#include <private/bionic_asm.h>
 
-sched_setparam:
+ENTRY(sched_setparam)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_setparam
+    .cpload t9
+    li v0, __NR_sched_setparam
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_setparam
+END(sched_setparam)
diff --git a/libc/arch-mips/syscalls/sched_setscheduler.S b/libc/arch-mips/syscalls/sched_setscheduler.S
index adb1f14..8921d30 100644
--- a/libc/arch-mips/syscalls/sched_setscheduler.S
+++ b/libc/arch-mips/syscalls/sched_setscheduler.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_setscheduler
-    .align 4
-    .ent sched_setscheduler
+#include <private/bionic_asm.h>
 
-sched_setscheduler:
+ENTRY(sched_setscheduler)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_setscheduler
+    .cpload t9
+    li v0, __NR_sched_setscheduler
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_setscheduler
+END(sched_setscheduler)
diff --git a/libc/arch-mips/syscalls/sched_yield.S b/libc/arch-mips/syscalls/sched_yield.S
index cbe799c..37f09be 100644
--- a/libc/arch-mips/syscalls/sched_yield.S
+++ b/libc/arch-mips/syscalls/sched_yield.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sched_yield
-    .align 4
-    .ent sched_yield
+#include <private/bionic_asm.h>
 
-sched_yield:
+ENTRY(sched_yield)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sched_yield
+    .cpload t9
+    li v0, __NR_sched_yield
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sched_yield
+END(sched_yield)
diff --git a/libc/arch-mips/syscalls/sendfile.S b/libc/arch-mips/syscalls/sendfile.S
index 219a311..84466b9 100644
--- a/libc/arch-mips/syscalls/sendfile.S
+++ b/libc/arch-mips/syscalls/sendfile.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sendfile
-    .align 4
-    .ent sendfile
+#include <private/bionic_asm.h>
 
-sendfile:
+ENTRY(sendfile)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sendfile
+    .cpload t9
+    li v0, __NR_sendfile
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sendfile
+END(sendfile)
diff --git a/libc/arch-mips/syscalls/sendfile64.S b/libc/arch-mips/syscalls/sendfile64.S
index 7669973..d9733f6 100644
--- a/libc/arch-mips/syscalls/sendfile64.S
+++ b/libc/arch-mips/syscalls/sendfile64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sendfile64
-    .align 4
-    .ent sendfile64
+#include <private/bionic_asm.h>
 
-sendfile64:
+ENTRY(sendfile64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sendfile64
+    .cpload t9
+    li v0, __NR_sendfile64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sendfile64
+END(sendfile64)
diff --git a/libc/arch-mips/syscalls/sendmsg.S b/libc/arch-mips/syscalls/sendmsg.S
index faa4cf3..5c37c62 100644
--- a/libc/arch-mips/syscalls/sendmsg.S
+++ b/libc/arch-mips/syscalls/sendmsg.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sendmsg
-    .align 4
-    .ent sendmsg
+#include <private/bionic_asm.h>
 
-sendmsg:
+ENTRY(sendmsg)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sendmsg
+    .cpload t9
+    li v0, __NR_sendmsg
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sendmsg
+END(sendmsg)
diff --git a/libc/arch-mips/syscalls/sendto.S b/libc/arch-mips/syscalls/sendto.S
index 80a6110..580d142 100644
--- a/libc/arch-mips/syscalls/sendto.S
+++ b/libc/arch-mips/syscalls/sendto.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sendto
-    .align 4
-    .ent sendto
+#include <private/bionic_asm.h>
 
-sendto:
+ENTRY(sendto)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sendto
+    .cpload t9
+    li v0, __NR_sendto
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sendto
+END(sendto)
diff --git a/libc/arch-mips/syscalls/setgid.S b/libc/arch-mips/syscalls/setgid.S
index 7e460b8..8fa188e 100644
--- a/libc/arch-mips/syscalls/setgid.S
+++ b/libc/arch-mips/syscalls/setgid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setgid
-    .align 4
-    .ent setgid
+#include <private/bionic_asm.h>
 
-setgid:
+ENTRY(setgid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setgid
+    .cpload t9
+    li v0, __NR_setgid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setgid
+END(setgid)
diff --git a/libc/arch-mips/syscalls/setgroups.S b/libc/arch-mips/syscalls/setgroups.S
index f89a4a4..f2d271c 100644
--- a/libc/arch-mips/syscalls/setgroups.S
+++ b/libc/arch-mips/syscalls/setgroups.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setgroups
-    .align 4
-    .ent setgroups
+#include <private/bionic_asm.h>
 
-setgroups:
+ENTRY(setgroups)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setgroups
+    .cpload t9
+    li v0, __NR_setgroups
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setgroups
+END(setgroups)
diff --git a/libc/arch-mips/syscalls/setitimer.S b/libc/arch-mips/syscalls/setitimer.S
index 5a1850a..a2eea84 100644
--- a/libc/arch-mips/syscalls/setitimer.S
+++ b/libc/arch-mips/syscalls/setitimer.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setitimer
-    .align 4
-    .ent setitimer
+#include <private/bionic_asm.h>
 
-setitimer:
+ENTRY(setitimer)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setitimer
+    .cpload t9
+    li v0, __NR_setitimer
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setitimer
+END(setitimer)
diff --git a/libc/arch-mips/syscalls/setns.S b/libc/arch-mips/syscalls/setns.S
index fd4529e..8a4f674 100644
--- a/libc/arch-mips/syscalls/setns.S
+++ b/libc/arch-mips/syscalls/setns.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setns
-    .align 4
-    .ent setns
+#include <private/bionic_asm.h>
 
-setns:
+ENTRY(setns)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setns
+    .cpload t9
+    li v0, __NR_setns
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setns
+END(setns)
diff --git a/libc/arch-mips/syscalls/setpgid.S b/libc/arch-mips/syscalls/setpgid.S
index d41e01c..c68f9a6 100644
--- a/libc/arch-mips/syscalls/setpgid.S
+++ b/libc/arch-mips/syscalls/setpgid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setpgid
-    .align 4
-    .ent setpgid
+#include <private/bionic_asm.h>
 
-setpgid:
+ENTRY(setpgid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setpgid
+    .cpload t9
+    li v0, __NR_setpgid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setpgid
+END(setpgid)
diff --git a/libc/arch-mips/syscalls/setpriority.S b/libc/arch-mips/syscalls/setpriority.S
index 443d017..2bf9f47 100644
--- a/libc/arch-mips/syscalls/setpriority.S
+++ b/libc/arch-mips/syscalls/setpriority.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setpriority
-    .align 4
-    .ent setpriority
+#include <private/bionic_asm.h>
 
-setpriority:
+ENTRY(setpriority)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setpriority
+    .cpload t9
+    li v0, __NR_setpriority
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setpriority
+END(setpriority)
diff --git a/libc/arch-mips/syscalls/setregid.S b/libc/arch-mips/syscalls/setregid.S
index a91e21b..de77e39 100644
--- a/libc/arch-mips/syscalls/setregid.S
+++ b/libc/arch-mips/syscalls/setregid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setregid
-    .align 4
-    .ent setregid
+#include <private/bionic_asm.h>
 
-setregid:
+ENTRY(setregid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setregid
+    .cpload t9
+    li v0, __NR_setregid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setregid
+END(setregid)
diff --git a/libc/arch-mips/syscalls/setresgid.S b/libc/arch-mips/syscalls/setresgid.S
index dd8a330..b2fd85f 100644
--- a/libc/arch-mips/syscalls/setresgid.S
+++ b/libc/arch-mips/syscalls/setresgid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setresgid
-    .align 4
-    .ent setresgid
+#include <private/bionic_asm.h>
 
-setresgid:
+ENTRY(setresgid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setresgid
+    .cpload t9
+    li v0, __NR_setresgid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setresgid
+END(setresgid)
diff --git a/libc/arch-mips/syscalls/setresuid.S b/libc/arch-mips/syscalls/setresuid.S
index 1319e2c..ad9ea9b 100644
--- a/libc/arch-mips/syscalls/setresuid.S
+++ b/libc/arch-mips/syscalls/setresuid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setresuid
-    .align 4
-    .ent setresuid
+#include <private/bionic_asm.h>
 
-setresuid:
+ENTRY(setresuid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setresuid
+    .cpload t9
+    li v0, __NR_setresuid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setresuid
+END(setresuid)
diff --git a/libc/arch-mips/syscalls/setreuid.S b/libc/arch-mips/syscalls/setreuid.S
index e25f2d9..888d219 100644
--- a/libc/arch-mips/syscalls/setreuid.S
+++ b/libc/arch-mips/syscalls/setreuid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setreuid
-    .align 4
-    .ent setreuid
+#include <private/bionic_asm.h>
 
-setreuid:
+ENTRY(setreuid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setreuid
+    .cpload t9
+    li v0, __NR_setreuid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setreuid
+END(setreuid)
diff --git a/libc/arch-mips/syscalls/setrlimit.S b/libc/arch-mips/syscalls/setrlimit.S
index 65b1cd8..71b49ac 100644
--- a/libc/arch-mips/syscalls/setrlimit.S
+++ b/libc/arch-mips/syscalls/setrlimit.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setrlimit
-    .align 4
-    .ent setrlimit
+#include <private/bionic_asm.h>
 
-setrlimit:
+ENTRY(setrlimit)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setrlimit
+    .cpload t9
+    li v0, __NR_setrlimit
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setrlimit
+END(setrlimit)
diff --git a/libc/arch-mips/syscalls/setsid.S b/libc/arch-mips/syscalls/setsid.S
index a0bad2b..9467a08 100644
--- a/libc/arch-mips/syscalls/setsid.S
+++ b/libc/arch-mips/syscalls/setsid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setsid
-    .align 4
-    .ent setsid
+#include <private/bionic_asm.h>
 
-setsid:
+ENTRY(setsid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setsid
+    .cpload t9
+    li v0, __NR_setsid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setsid
+END(setsid)
diff --git a/libc/arch-mips/syscalls/setsockopt.S b/libc/arch-mips/syscalls/setsockopt.S
index 3192d93..e8dd3f6 100644
--- a/libc/arch-mips/syscalls/setsockopt.S
+++ b/libc/arch-mips/syscalls/setsockopt.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setsockopt
-    .align 4
-    .ent setsockopt
+#include <private/bionic_asm.h>
 
-setsockopt:
+ENTRY(setsockopt)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setsockopt
+    .cpload t9
+    li v0, __NR_setsockopt
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setsockopt
+END(setsockopt)
diff --git a/libc/arch-mips/syscalls/settimeofday.S b/libc/arch-mips/syscalls/settimeofday.S
index 673b7fd..b9b588f 100644
--- a/libc/arch-mips/syscalls/settimeofday.S
+++ b/libc/arch-mips/syscalls/settimeofday.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl settimeofday
-    .align 4
-    .ent settimeofday
+#include <private/bionic_asm.h>
 
-settimeofday:
+ENTRY(settimeofday)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_settimeofday
+    .cpload t9
+    li v0, __NR_settimeofday
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end settimeofday
+END(settimeofday)
diff --git a/libc/arch-mips/syscalls/setuid.S b/libc/arch-mips/syscalls/setuid.S
index abfdafb..55c75c1 100644
--- a/libc/arch-mips/syscalls/setuid.S
+++ b/libc/arch-mips/syscalls/setuid.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setuid
-    .align 4
-    .ent setuid
+#include <private/bionic_asm.h>
 
-setuid:
+ENTRY(setuid)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setuid
+    .cpload t9
+    li v0, __NR_setuid
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setuid
+END(setuid)
diff --git a/libc/arch-mips/syscalls/setxattr.S b/libc/arch-mips/syscalls/setxattr.S
index b9c1aaa..0cca64c 100644
--- a/libc/arch-mips/syscalls/setxattr.S
+++ b/libc/arch-mips/syscalls/setxattr.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl setxattr
-    .align 4
-    .ent setxattr
+#include <private/bionic_asm.h>
 
-setxattr:
+ENTRY(setxattr)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_setxattr
+    .cpload t9
+    li v0, __NR_setxattr
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end setxattr
+END(setxattr)
diff --git a/libc/arch-mips/syscalls/shutdown.S b/libc/arch-mips/syscalls/shutdown.S
index 0f2208f..f6e9979 100644
--- a/libc/arch-mips/syscalls/shutdown.S
+++ b/libc/arch-mips/syscalls/shutdown.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl shutdown
-    .align 4
-    .ent shutdown
+#include <private/bionic_asm.h>
 
-shutdown:
+ENTRY(shutdown)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_shutdown
+    .cpload t9
+    li v0, __NR_shutdown
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end shutdown
+END(shutdown)
diff --git a/libc/arch-mips/syscalls/sigaltstack.S b/libc/arch-mips/syscalls/sigaltstack.S
index ec1d8a1..6632164 100644
--- a/libc/arch-mips/syscalls/sigaltstack.S
+++ b/libc/arch-mips/syscalls/sigaltstack.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sigaltstack
-    .align 4
-    .ent sigaltstack
+#include <private/bionic_asm.h>
 
-sigaltstack:
+ENTRY(sigaltstack)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sigaltstack
+    .cpload t9
+    li v0, __NR_sigaltstack
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sigaltstack
+END(sigaltstack)
diff --git a/libc/arch-mips/syscalls/signalfd4.S b/libc/arch-mips/syscalls/signalfd4.S
index 74e6168..e2c2a30 100644
--- a/libc/arch-mips/syscalls/signalfd4.S
+++ b/libc/arch-mips/syscalls/signalfd4.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl signalfd4
-    .align 4
-    .ent signalfd4
+#include <private/bionic_asm.h>
 
-signalfd4:
+ENTRY(signalfd4)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_signalfd4
+    .cpload t9
+    li v0, __NR_signalfd4
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end signalfd4
+END(signalfd4)
diff --git a/libc/arch-mips/syscalls/socket.S b/libc/arch-mips/syscalls/socket.S
index c67404e..2056bcd 100644
--- a/libc/arch-mips/syscalls/socket.S
+++ b/libc/arch-mips/syscalls/socket.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl socket
-    .align 4
-    .ent socket
+#include <private/bionic_asm.h>
 
-socket:
+ENTRY(socket)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_socket
+    .cpload t9
+    li v0, __NR_socket
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end socket
+END(socket)
diff --git a/libc/arch-mips/syscalls/socketpair.S b/libc/arch-mips/syscalls/socketpair.S
index c0f41e2..6257327 100644
--- a/libc/arch-mips/syscalls/socketpair.S
+++ b/libc/arch-mips/syscalls/socketpair.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl socketpair
-    .align 4
-    .ent socketpair
+#include <private/bionic_asm.h>
 
-socketpair:
+ENTRY(socketpair)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_socketpair
+    .cpload t9
+    li v0, __NR_socketpair
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end socketpair
+END(socketpair)
diff --git a/libc/arch-mips/syscalls/swapoff.S b/libc/arch-mips/syscalls/swapoff.S
index 1ed5083..04b5b70 100644
--- a/libc/arch-mips/syscalls/swapoff.S
+++ b/libc/arch-mips/syscalls/swapoff.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl swapoff
-    .align 4
-    .ent swapoff
+#include <private/bionic_asm.h>
 
-swapoff:
+ENTRY(swapoff)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_swapoff
+    .cpload t9
+    li v0, __NR_swapoff
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end swapoff
+END(swapoff)
diff --git a/libc/arch-mips/syscalls/swapon.S b/libc/arch-mips/syscalls/swapon.S
index 08a85b0..1fe3698 100644
--- a/libc/arch-mips/syscalls/swapon.S
+++ b/libc/arch-mips/syscalls/swapon.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl swapon
-    .align 4
-    .ent swapon
+#include <private/bionic_asm.h>
 
-swapon:
+ENTRY(swapon)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_swapon
+    .cpload t9
+    li v0, __NR_swapon
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end swapon
+END(swapon)
diff --git a/libc/arch-mips/syscalls/symlinkat.S b/libc/arch-mips/syscalls/symlinkat.S
index 9c43241..5bd6e6c 100644
--- a/libc/arch-mips/syscalls/symlinkat.S
+++ b/libc/arch-mips/syscalls/symlinkat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl symlinkat
-    .align 4
-    .ent symlinkat
+#include <private/bionic_asm.h>
 
-symlinkat:
+ENTRY(symlinkat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_symlinkat
+    .cpload t9
+    li v0, __NR_symlinkat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end symlinkat
+END(symlinkat)
diff --git a/libc/arch-mips/syscalls/sync.S b/libc/arch-mips/syscalls/sync.S
index 0e0ee1f..eb788f0 100644
--- a/libc/arch-mips/syscalls/sync.S
+++ b/libc/arch-mips/syscalls/sync.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sync
-    .align 4
-    .ent sync
+#include <private/bionic_asm.h>
 
-sync:
+ENTRY(sync)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sync
+    .cpload t9
+    li v0, __NR_sync
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sync
+END(sync)
diff --git a/libc/arch-mips/syscalls/sysinfo.S b/libc/arch-mips/syscalls/sysinfo.S
index 3acfbf7..7cdccb9 100644
--- a/libc/arch-mips/syscalls/sysinfo.S
+++ b/libc/arch-mips/syscalls/sysinfo.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl sysinfo
-    .align 4
-    .ent sysinfo
+#include <private/bionic_asm.h>
 
-sysinfo:
+ENTRY(sysinfo)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_sysinfo
+    .cpload t9
+    li v0, __NR_sysinfo
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end sysinfo
+END(sysinfo)
diff --git a/libc/arch-mips/syscalls/tgkill.S b/libc/arch-mips/syscalls/tgkill.S
index 5de33d0..9938843 100644
--- a/libc/arch-mips/syscalls/tgkill.S
+++ b/libc/arch-mips/syscalls/tgkill.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl tgkill
-    .align 4
-    .ent tgkill
+#include <private/bionic_asm.h>
 
-tgkill:
+ENTRY(tgkill)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_tgkill
+    .cpload t9
+    li v0, __NR_tgkill
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end tgkill
+END(tgkill)
diff --git a/libc/arch-mips/syscalls/timerfd_create.S b/libc/arch-mips/syscalls/timerfd_create.S
index 2528355..c42f4e1 100644
--- a/libc/arch-mips/syscalls/timerfd_create.S
+++ b/libc/arch-mips/syscalls/timerfd_create.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl timerfd_create
-    .align 4
-    .ent timerfd_create
+#include <private/bionic_asm.h>
 
-timerfd_create:
+ENTRY(timerfd_create)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timerfd_create
+    .cpload t9
+    li v0, __NR_timerfd_create
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end timerfd_create
+END(timerfd_create)
diff --git a/libc/arch-mips/syscalls/timerfd_gettime.S b/libc/arch-mips/syscalls/timerfd_gettime.S
index b38c2d4..469d174 100644
--- a/libc/arch-mips/syscalls/timerfd_gettime.S
+++ b/libc/arch-mips/syscalls/timerfd_gettime.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl timerfd_gettime
-    .align 4
-    .ent timerfd_gettime
+#include <private/bionic_asm.h>
 
-timerfd_gettime:
+ENTRY(timerfd_gettime)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timerfd_gettime
+    .cpload t9
+    li v0, __NR_timerfd_gettime
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end timerfd_gettime
+END(timerfd_gettime)
diff --git a/libc/arch-mips/syscalls/timerfd_settime.S b/libc/arch-mips/syscalls/timerfd_settime.S
index 11dc61b..c7c6f47 100644
--- a/libc/arch-mips/syscalls/timerfd_settime.S
+++ b/libc/arch-mips/syscalls/timerfd_settime.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl timerfd_settime
-    .align 4
-    .ent timerfd_settime
+#include <private/bionic_asm.h>
 
-timerfd_settime:
+ENTRY(timerfd_settime)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_timerfd_settime
+    .cpload t9
+    li v0, __NR_timerfd_settime
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end timerfd_settime
+END(timerfd_settime)
diff --git a/libc/arch-mips/syscalls/times.S b/libc/arch-mips/syscalls/times.S
index 248a23f..157b34c 100644
--- a/libc/arch-mips/syscalls/times.S
+++ b/libc/arch-mips/syscalls/times.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl times
-    .align 4
-    .ent times
+#include <private/bionic_asm.h>
 
-times:
+ENTRY(times)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_times
+    .cpload t9
+    li v0, __NR_times
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end times
+END(times)
diff --git a/libc/arch-mips/syscalls/tkill.S b/libc/arch-mips/syscalls/tkill.S
index a80b506..c1ecb61 100644
--- a/libc/arch-mips/syscalls/tkill.S
+++ b/libc/arch-mips/syscalls/tkill.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl tkill
-    .align 4
-    .ent tkill
+#include <private/bionic_asm.h>
 
-tkill:
+ENTRY(tkill)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_tkill
+    .cpload t9
+    li v0, __NR_tkill
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end tkill
+END(tkill)
diff --git a/libc/arch-mips/syscalls/truncate.S b/libc/arch-mips/syscalls/truncate.S
index a4256dc..7fe4a0f 100644
--- a/libc/arch-mips/syscalls/truncate.S
+++ b/libc/arch-mips/syscalls/truncate.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl truncate
-    .align 4
-    .ent truncate
+#include <private/bionic_asm.h>
 
-truncate:
+ENTRY(truncate)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_truncate
+    .cpload t9
+    li v0, __NR_truncate
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end truncate
+END(truncate)
diff --git a/libc/arch-mips/syscalls/truncate64.S b/libc/arch-mips/syscalls/truncate64.S
index 9f48da0..0911f5f 100644
--- a/libc/arch-mips/syscalls/truncate64.S
+++ b/libc/arch-mips/syscalls/truncate64.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl truncate64
-    .align 4
-    .ent truncate64
+#include <private/bionic_asm.h>
 
-truncate64:
+ENTRY(truncate64)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_truncate64
+    .cpload t9
+    li v0, __NR_truncate64
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end truncate64
+END(truncate64)
diff --git a/libc/arch-mips/syscalls/umask.S b/libc/arch-mips/syscalls/umask.S
index d74cf90..57a6aed 100644
--- a/libc/arch-mips/syscalls/umask.S
+++ b/libc/arch-mips/syscalls/umask.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl umask
-    .align 4
-    .ent umask
+#include <private/bionic_asm.h>
 
-umask:
+ENTRY(umask)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_umask
+    .cpload t9
+    li v0, __NR_umask
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end umask
+END(umask)
diff --git a/libc/arch-mips/syscalls/umount2.S b/libc/arch-mips/syscalls/umount2.S
index 6164f76..bf8267d 100644
--- a/libc/arch-mips/syscalls/umount2.S
+++ b/libc/arch-mips/syscalls/umount2.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl umount2
-    .align 4
-    .ent umount2
+#include <private/bionic_asm.h>
 
-umount2:
+ENTRY(umount2)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_umount2
+    .cpload t9
+    li v0, __NR_umount2
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end umount2
+END(umount2)
diff --git a/libc/arch-mips/syscalls/uname.S b/libc/arch-mips/syscalls/uname.S
index a1051a2..ce77bd5 100644
--- a/libc/arch-mips/syscalls/uname.S
+++ b/libc/arch-mips/syscalls/uname.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl uname
-    .align 4
-    .ent uname
+#include <private/bionic_asm.h>
 
-uname:
+ENTRY(uname)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_uname
+    .cpload t9
+    li v0, __NR_uname
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end uname
+END(uname)
diff --git a/libc/arch-mips/syscalls/unlinkat.S b/libc/arch-mips/syscalls/unlinkat.S
index 0ca77fe..82e584b 100644
--- a/libc/arch-mips/syscalls/unlinkat.S
+++ b/libc/arch-mips/syscalls/unlinkat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl unlinkat
-    .align 4
-    .ent unlinkat
+#include <private/bionic_asm.h>
 
-unlinkat:
+ENTRY(unlinkat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_unlinkat
+    .cpload t9
+    li v0, __NR_unlinkat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end unlinkat
+END(unlinkat)
diff --git a/libc/arch-mips/syscalls/unshare.S b/libc/arch-mips/syscalls/unshare.S
index 592cc61..0521f30 100644
--- a/libc/arch-mips/syscalls/unshare.S
+++ b/libc/arch-mips/syscalls/unshare.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl unshare
-    .align 4
-    .ent unshare
+#include <private/bionic_asm.h>
 
-unshare:
+ENTRY(unshare)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_unshare
+    .cpload t9
+    li v0, __NR_unshare
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end unshare
+END(unshare)
diff --git a/libc/arch-mips/syscalls/utimensat.S b/libc/arch-mips/syscalls/utimensat.S
index 42fe4f9..208ef58 100644
--- a/libc/arch-mips/syscalls/utimensat.S
+++ b/libc/arch-mips/syscalls/utimensat.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl utimensat
-    .align 4
-    .ent utimensat
+#include <private/bionic_asm.h>
 
-utimensat:
+ENTRY(utimensat)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_utimensat
+    .cpload t9
+    li v0, __NR_utimensat
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end utimensat
+END(utimensat)
diff --git a/libc/arch-mips/syscalls/wait4.S b/libc/arch-mips/syscalls/wait4.S
index 8c53eca..ec6bd84 100644
--- a/libc/arch-mips/syscalls/wait4.S
+++ b/libc/arch-mips/syscalls/wait4.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl wait4
-    .align 4
-    .ent wait4
+#include <private/bionic_asm.h>
 
-wait4:
+ENTRY(wait4)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_wait4
+    .cpload t9
+    li v0, __NR_wait4
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end wait4
+END(wait4)
diff --git a/libc/arch-mips/syscalls/write.S b/libc/arch-mips/syscalls/write.S
index 85fe4d0..d10e55a 100644
--- a/libc/arch-mips/syscalls/write.S
+++ b/libc/arch-mips/syscalls/write.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl write
-    .align 4
-    .ent write
+#include <private/bionic_asm.h>
 
-write:
+ENTRY(write)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_write
+    .cpload t9
+    li v0, __NR_write
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end write
+END(write)
diff --git a/libc/arch-mips/syscalls/writev.S b/libc/arch-mips/syscalls/writev.S
index 4e23049..0a2c033 100644
--- a/libc/arch-mips/syscalls/writev.S
+++ b/libc/arch-mips/syscalls/writev.S
@@ -1,23 +1,19 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-    .text
-    .globl writev
-    .align 4
-    .ent writev
+#include <private/bionic_asm.h>
 
-writev:
+ENTRY(writev)
     .set noreorder
-    .cpload $t9
-    li $v0, __NR_writev
+    .cpload t9
+    li v0, __NR_writev
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end writev
+END(writev)
diff --git a/libc/arch-mips64/bionic/__bionic_clone.S b/libc/arch-mips64/bionic/__bionic_clone.S
index 2a9a2b0..e1ade30 100644
--- a/libc/arch-mips64/bionic/__bionic_clone.S
+++ b/libc/arch-mips64/bionic/__bionic_clone.S
@@ -26,8 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 
@@ -43,8 +42,7 @@
 #endif
 
 // pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
-	.text
-LEAF(__bionic_clone,FRAMESZ)
+LEAF(__bionic_clone, FRAMESZ)
 	PTR_SUBU sp, FRAMESZ			# allocate stack frame
 	SETUP_GP64(FRAME_GP,__bionic_clone)
 	SAVE_GP(FRAME_GP)
diff --git a/libc/arch-mips64/bionic/__get_sp.S b/libc/arch-mips64/bionic/__get_sp.S
index 834c89d..8488102 100644
--- a/libc/arch-mips64/bionic/__get_sp.S
+++ b/libc/arch-mips64/bionic/__get_sp.S
@@ -25,15 +25,10 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-	.text
 
-/* void *__get_sp(void) */
+#include <private/bionic_asm.h>
 
-	.type	__get_sp, @function
-	.global	__get_sp
-	.align	4
-	.ent	__get_sp
-__get_sp:
-	move	$v0, $sp
-	j	$ra
-	.end	__get_sp
+ENTRY(__get_sp)
+  move v0, sp
+  j ra
+END(__get_sp)
diff --git a/libc/arch-mips64/bionic/_exit_with_stack_teardown.S b/libc/arch-mips64/bionic/_exit_with_stack_teardown.S
index 8f624c3..3b537eb 100644
--- a/libc/arch-mips64/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-mips64/bionic/_exit_with_stack_teardown.S
@@ -26,23 +26,16 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
-
-	.text
+#include <private/bionic_asm.h>
 
 // void _exit_with_stack_teardown(void* stackBase, size_t stackSize)
+ENTRY(_exit_with_stack_teardown)
+  li	v0, __NR_munmap
+  syscall
+  // If munmap failed, we ignore the failure and exit anyway.
 
-	.type	_exit_with_stack_teardown, @function
-	.global	_exit_with_stack_teardown
-	.align	4
-	.ent	_exit_with_stack_teardown
-_exit_with_stack_teardown:
-	li	$v0, __NR_munmap
-	syscall
-	// If munmap failed, we ignore the failure and exit anyway.
-
-	li	$a0, 0
-	li	$v0, __NR_exit
-	syscall
-        // The exit syscall does not return.
-	.end	_exit_with_stack_teardown
+  li	a0, 0
+  li	v0, __NR_exit
+  syscall
+  // The exit syscall does not return.
+END(_exit_with_stack_teardown)
diff --git a/libc/arch-mips64/bionic/_setjmp.S b/libc/arch-mips64/bionic/_setjmp.S
index e7083ae..4465cd2 100644
--- a/libc/arch-mips64/bionic/_setjmp.S
+++ b/libc/arch-mips64/bionic/_setjmp.S
@@ -2,7 +2,7 @@
 
 /*
  * Copyright (c) 2002 Opsycon AB  (www.opsycon.se / www.opsycon.com)
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -29,7 +29,7 @@
  *
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/regnum.h>
 #include <machine/signal.h>
 
@@ -48,13 +48,13 @@
         swc1    FPR, OFF(BASE)  ;       \
         mfhc1   t0, FPR         ;       \
         sw      t0, OFF+4(BASE) ;
-        
+
 #define FPREG64_L(FPR, OFF, BASE)       \
         lw      t0, OFF+4(BASE) ;       \
         lw      t1, OFF(BASE)   ;       \
         mtc1    t1, FPR         ;       \
         mthc1   t0, FPR         ;       \
-        
+
 LEAF(_setjmp, FRAMESZ)
 	PTR_SUBU sp, FRAMESZ
 	SETUP_GP64(GPOFF, _setjmp)
@@ -185,4 +185,3 @@
 	RESTORE_GP64
 	PTR_ADDU sp, FRAMESZ
 END(_longjmp)
-
diff --git a/libc/arch-mips64/bionic/bzero.S b/libc/arch-mips64/bionic/bzero.S
index d0b5c84..76c6bc2 100644
--- a/libc/arch-mips64/bionic/bzero.S
+++ b/libc/arch-mips64/bionic/bzero.S
@@ -25,9 +25,8 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-	.text
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * void bzero(void *s, size_t n);
@@ -40,4 +39,3 @@
 	RESTORE_GP64
 	j	t9
 END(bzero)
-
diff --git a/libc/arch-mips64/bionic/futex_mips.S b/libc/arch-mips64/bionic/futex_mips.S
index 1a249a7..81f2f22 100644
--- a/libc/arch-mips64/bionic/futex_mips.S
+++ b/libc/arch-mips64/bionic/futex_mips.S
@@ -26,7 +26,6 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
 #include <private/bionic_asm.h>
 
 #define FUTEX_WAIT 0
diff --git a/libc/arch-mips64/bionic/memcmp16.S b/libc/arch-mips64/bionic/memcmp16.S
index b70c078..1c58c1b 100644
--- a/libc/arch-mips64/bionic/memcmp16.S
+++ b/libc/arch-mips64/bionic/memcmp16.S
@@ -27,7 +27,7 @@
  */
 	.text
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * u4 __memcmp16(const u2* s0, const u2* s1, size_t count);
diff --git a/libc/arch-mips64/bionic/setjmp.S b/libc/arch-mips64/bionic/setjmp.S
index 7c21195..2af1fbd 100644
--- a/libc/arch-mips64/bionic/setjmp.S
+++ b/libc/arch-mips64/bionic/setjmp.S
@@ -29,7 +29,7 @@
  *
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/regnum.h>
 #include <machine/signal.h>
 
@@ -49,13 +49,13 @@
         swc1    FPR, OFF(BASE)  ;       \
         mfhc1   t0, FPR         ;       \
         sw      t0, OFF+4(BASE) ;
-        
+
 #define FPREG64_L(FPR, OFF, BASE)       \
         lw      t0, OFF+4(BASE) ;       \
         lw      t1, OFF(BASE)   ;       \
         mtc1    t1, FPR         ;       \
         mthc1   t0, FPR         ;       \
-        
+
 NON_LEAF(setjmp, FRAMESZ, ra)
 	.mask	0x80000000, RAOFF
 	PTR_SUBU sp, FRAMESZ			# allocate stack frame
@@ -154,7 +154,7 @@
 	lw	a0, A0OFF(sp)
 	lw	a1, A1OFF(sp)
 
-	.set	noreorder	
+	.set	noreorder
 	REG_L	v0, SC_REGS+ZERO*REGSZ(a0)
 	bne	v0, 0xACEDBADE, botch		# jump if error
 	REG_L	ra, SC_PC(a0)
@@ -169,9 +169,9 @@
 	REG_L	s8, SC_REGS+S8*REGSZ(a0)
 	REG_L	gp, SC_REGS+GP*REGSZ(a0)
 	REG_L	sp, SC_REGS+SP*REGSZ(a0)
-	
+
 #if !defined(SOFTFLOAT)
-	REG_L	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)	
+	REG_L	v0, SC_FPREGS+((FSR-F0)*REGSZ)(a0)
 	ctc1	v0, $31
 #if _MIPS_FPSET == 32
         FPREG64_L($f20, SC_FPREGS+((F20-F0)*REGSZ_FP), a0)
diff --git a/libc/arch-mips64/bionic/sigsetjmp.S b/libc/arch-mips64/bionic/sigsetjmp.S
index b05454c..9d2e5ea 100644
--- a/libc/arch-mips64/bionic/sigsetjmp.S
+++ b/libc/arch-mips64/bionic/sigsetjmp.S
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/regnum.h>
 #include <machine/setjmp.h>
 
diff --git a/libc/arch-mips64/bionic/syscall.S b/libc/arch-mips64/bionic/syscall.S
index 08aa705..c4fd009 100644
--- a/libc/arch-mips64/bionic/syscall.S
+++ b/libc/arch-mips64/bionic/syscall.S
@@ -26,8 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
 
 #if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
 FRAMESZ		=	MKFSIZ(6,0)
diff --git a/libc/arch-mips64/bionic/vfork.S b/libc/arch-mips64/bionic/vfork.S
index c936945..911a264 100644
--- a/libc/arch-mips64/bionic/vfork.S
+++ b/libc/arch-mips64/bionic/vfork.S
@@ -26,8 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
 #include <linux/sched.h>
 
 // TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__.
@@ -46,7 +45,7 @@
 #if FRAMESZ!=0
 	PTR_SUBU sp, FRAMESZ
 #endif
-	SETUP_GP64(a5,vfork)
+	SETUP_GP64(a5, vfork)
 	LI	a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
 	move	a1, $0
 	move	a2, $0
diff --git a/libc/arch-mips64/include/machine/asm.h b/libc/arch-mips64/include/machine/asm.h
index eabb1bf..5eacde3 100644
--- a/libc/arch-mips64/include/machine/asm.h
+++ b/libc/arch-mips64/include/machine/asm.h
@@ -28,25 +28,24 @@
 #ifndef _MIPS64_ASM_H
 #define _MIPS64_ASM_H
 
-#include <machine/regdef.h>
-
-#ifdef NEED_OLD_RM7KFIX
-#define ITLBNOPFIX      nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
-#else
-#define ITLBNOPFIX      nop;nop;nop;nop
+#ifndef _ALIGN_TEXT
+# define _ALIGN_TEXT .align 4
 #endif
 
+#undef __bionic_asm_custom_entry
+#undef __bionic_asm_custom_end
+#define __bionic_asm_custom_entry(f) .ent f
+#define __bionic_asm_custom_end(f) .end f
+
+#include <machine/regdef.h>
+
 #define	_MIPS_ISA_MIPS1	1	/* R2000/R3000 */
 #define	_MIPS_ISA_MIPS2	2	/* R4000/R6000 */
 #define	_MIPS_ISA_MIPS3	3	/* R4000 */
 #define	_MIPS_ISA_MIPS4	4	/* TFP (R1x000) */
-#ifdef __linux__
 #define	_MIPS_ISA_MIPS5 5
 #define	_MIPS_ISA_MIPS32 6
 #define	_MIPS_ISA_MIPS64 7
-#else
-#define	_MIPS_ISA_MIPS32 32	/* MIPS32 */
-#endif
 
 #if !defined(ABICALLS) && !defined(_NO_ABICALLS)
 #define	ABICALLS	.abicalls
@@ -56,8 +55,6 @@
 	ABICALLS
 #endif
 
-#define _C_LABEL(x) x		/* XXX Obsolete but keep for a while */
-
 #if !defined(__MIPSEL__) && !defined(__MIPSEB__)
 #error "__MIPSEL__ or __MIPSEB__ must be defined"
 #endif
@@ -90,15 +87,6 @@
  */
 #if defined(ABICALLS) && !defined(_KERNEL) && !defined(_STANDALONE)
 
-#ifndef _MIPS_SIM
-#define _MIPS_SIM 1
-#define _ABIO32	1
-#endif
-#ifndef _MIPS_ISA
-#define _MIPS_ISA 2
-#define _MIPS_ISA_MIPS2 2
-#endif
-
 #if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
 #define NARGSAVE	4
 
@@ -190,28 +178,6 @@
 #endif
 
 /*
- * Define -pg profile entry code.
- */
-#if defined(XGPROF) || defined(XPROF)
-#define	MCOUNT			\
-	PTR_SUBU sp, sp, 64;	\
-	SAVE_GP(16);		\
-	sd	ra, 56(sp);	\
-	sd	gp, 48(sp);	\
-	.set	noat;		\
-	.set	noreorder;	\
-	move	AT, ra;		\
-	jal	_mcount;	\
-	PTR_SUBU sp, sp, 16;	\
-	ld	ra, 56(sp);	\
-	PTR_ADDU sp, sp, 64;	\
-	.set reorder;		\
-	.set	at;
-#else
-#define	MCOUNT
-#endif
-
-/*
  * LEAF(x, fsize)
  *
  *	Declare a leaf routine.
@@ -221,26 +187,9 @@
 	.globl x;		\
 	.ent x, 0;		\
 x: ;				\
+	.cfi_startproc; \
 	.frame sp, fsize, ra;	\
 	SETUP_GP		\
-	MCOUNT
-
-#define	ALEAF(x)		\
-	.globl	x;		\
-x:
-
-/*
- * NLEAF(x)
- *
- *	Declare a non-profiled leaf routine.
- */
-#define NLEAF(x, fsize)		\
-	.align	3;		\
-	.globl x;		\
-	.ent x, 0;		\
-x: ;				\
-	.frame sp, fsize, ra;	\
-	SETUP_GP
 
 /*
  * NON_LEAF(x)
@@ -252,54 +201,8 @@
 	.globl x;		\
 	.ent x, 0;		\
 x: ;				\
+	.cfi_startproc; \
 	.frame sp, fsize, retpc; \
 	SETUP_GP		\
-	MCOUNT
-
-/*
- * NNON_LEAF(x)
- *
- *	Declare a non-profiled non-leaf routine
- *	(a routine that makes other C calls).
- */
-#define NNON_LEAF(x, fsize, retpc) \
-	.align	3;		\
-	.globl x;		\
-	.ent x, 0;		\
-x: ;				\
-	.frame sp, fsize, retpc	\
-	SETUP_GP
-
-/*
- * END(x)
- *
- *	Mark end of a procedure.
- */
-#define END(x) \
-	.end x
-
-/*
- * Macros to panic and printf from assembly language.
- */
-#define PANIC(msg) \
-	LA	a0, 9f; \
-	jal	panic;	\
-	nop	;	\
-	MSG(msg)
-
-#define	PRINTF(msg) \
-	LA	a0, 9f; \
-	jal	printf; \
-	nop	;	\
-	MSG(msg)
-
-#define	MSG(msg) \
-	.rdata; \
-9:	.asciiz	msg; \
-	.text
-
-#define ASMSTR(str) \
-	.asciiz str; \
-	.align	3
 
 #endif /* !_MIPS_ASM_H */
diff --git a/libc/arch-mips64/include/machine/signal.h b/libc/arch-mips64/include/machine/signal.h
index f02ec0d..b31715c 100644
--- a/libc/arch-mips64/include/machine/signal.h
+++ b/libc/arch-mips64/include/machine/signal.h
@@ -37,8 +37,6 @@
 #ifndef _MIPS_SIGNAL_H_
 #define _MIPS_SIGNAL_H_
 
-#include <machine/asm.h>
-
 #define	SC_REGMASK	(0*REGSZ)
 #define	SC_STATUS	(1*REGSZ)
 #define	SC_PC		(2*REGSZ)
diff --git a/libc/arch-mips64/mips64.mk b/libc/arch-mips64/mips64.mk
index 6977d6a..11ceb40 100644
--- a/libc/arch-mips64/mips64.mk
+++ b/libc/arch-mips64/mips64.mk
@@ -59,18 +59,13 @@
 libc_bionic_src_files_mips64 += bionic/memset.c
 libc_bionic_src_files_mips64 += string/strlen.c
 
-libc_arch_static_src_files_mips64 :=
 
-libc_arch_dynamic_src_files_mips64 :=
-
-##########################################
-# crt-related
 libc_crt_target_cflags_mips64 := \
     $($(my_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
-    -I$(LOCAL_PATH)/arch-mips/include
+    -I$(LOCAL_PATH)/arch-mips64/include
 
 libc_crt_target_crtbegin_file_mips64 := \
-    $(LOCAL_PATH)/arch-mips/bionic/crtbegin.c
+    $(LOCAL_PATH)/arch-mips64/bionic/crtbegin.c
 
 libc_crt_target_crtbegin_so_file_mips64 := \
     $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c
diff --git a/libc/arch-mips64/string/memcpy.S b/libc/arch-mips64/string/memcpy.S
index aabdfcf..dc91096 100644
--- a/libc/arch-mips64/string/memcpy.S
+++ b/libc/arch-mips64/string/memcpy.S
@@ -39,13 +39,13 @@
  *  Include files
  ************************************************************************/
 
-#include "machine/asm.h"
+#include <private/bionic_asm.h>
 
 
-/* 
+/*
  * This routine could be optimized for MIPS64. The current code only
  * uses MIPS32 instructions.
- */	
+ */
 #if defined(__MIPSEB__)
 #  define LWHI	lwl		/* high part is left in big-endian	*/
 #  define SWHI	swl		/* high part is left in big-endian	*/
diff --git a/libc/arch-mips64/string/memset.S b/libc/arch-mips64/string/memset.S
index a1c5055..3e630ca 100644
--- a/libc/arch-mips64/string/memset.S
+++ b/libc/arch-mips64/string/memset.S
@@ -39,12 +39,12 @@
  *  Include files
  ************************************************************************/
 
-#include "machine/asm.h"
+#include <private/bionic_asm.h>
 
-/* 
+/*
  * This routine could be optimized for MIPS64. The current code only
  * uses MIPS32 instructions.
- */	
+ */
 
 #if defined(__MIPSEB__)
 #  define SWHI	swl		/* high part is left in big-endian	*/
@@ -220,7 +220,7 @@
 	sw	a1,-36(a0)
 	nop
 	nop			# the extra nop instructions help to balance
-	nop			# cycles needed for "store" + "fill" + "evict" 
+	nop			# cycles needed for "store" + "fill" + "evict"
 	nop			# For 64byte store there are needed 8 fill
 	nop			# and 8 evict cycles, i.e. at least 32 instr.
 	nop
@@ -320,4 +320,3 @@
 /************************************************************************
  *  Implementation : Static functions
  ************************************************************************/
-
diff --git a/libc/arch-mips64/syscalls/__brk.S b/libc/arch-mips64/syscalls/__brk.S
index 1e3939a..99a108a 100644
--- a/libc/arch-mips64/syscalls/__brk.S
+++ b/libc/arch-mips64/syscalls/__brk.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __brk
-    .align 4
-    .ent __brk
+#include <private/bionic_asm.h>
 
-__brk:
+ENTRY(__brk)
     .set push
     .set noreorder
     li v0, __NR_brk
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __brk
-.hidden _C_LABEL(__brk)
+END(__brk)
+.hidden __brk
diff --git a/libc/arch-mips64/syscalls/__epoll_pwait.S b/libc/arch-mips64/syscalls/__epoll_pwait.S
index 6167f48..fc3867a 100644
--- a/libc/arch-mips64/syscalls/__epoll_pwait.S
+++ b/libc/arch-mips64/syscalls/__epoll_pwait.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __epoll_pwait
-    .align 4
-    .ent __epoll_pwait
+#include <private/bionic_asm.h>
 
-__epoll_pwait:
+ENTRY(__epoll_pwait)
     .set push
     .set noreorder
     li v0, __NR_epoll_pwait
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __epoll_pwait
-.hidden _C_LABEL(__epoll_pwait)
+END(__epoll_pwait)
+.hidden __epoll_pwait
diff --git a/libc/arch-mips64/syscalls/__exit.S b/libc/arch-mips64/syscalls/__exit.S
index 0297a68..dac53b9 100644
--- a/libc/arch-mips64/syscalls/__exit.S
+++ b/libc/arch-mips64/syscalls/__exit.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __exit
-    .align 4
-    .ent __exit
+#include <private/bionic_asm.h>
 
-__exit:
+ENTRY(__exit)
     .set push
     .set noreorder
     li v0, __NR_exit
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __exit
-.hidden _C_LABEL(__exit)
+END(__exit)
+.hidden __exit
diff --git a/libc/arch-mips64/syscalls/__getcpu.S b/libc/arch-mips64/syscalls/__getcpu.S
index d20369e..9c08710 100644
--- a/libc/arch-mips64/syscalls/__getcpu.S
+++ b/libc/arch-mips64/syscalls/__getcpu.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __getcpu
-    .align 4
-    .ent __getcpu
+#include <private/bionic_asm.h>
 
-__getcpu:
+ENTRY(__getcpu)
     .set push
     .set noreorder
     li v0, __NR_getcpu
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __getcpu
-.hidden _C_LABEL(__getcpu)
+END(__getcpu)
+.hidden __getcpu
diff --git a/libc/arch-mips64/syscalls/__getcwd.S b/libc/arch-mips64/syscalls/__getcwd.S
index 47a32df..79fbca3 100644
--- a/libc/arch-mips64/syscalls/__getcwd.S
+++ b/libc/arch-mips64/syscalls/__getcwd.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __getcwd
-    .align 4
-    .ent __getcwd
+#include <private/bionic_asm.h>
 
-__getcwd:
+ENTRY(__getcwd)
     .set push
     .set noreorder
     li v0, __NR_getcwd
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __getcwd
-.hidden _C_LABEL(__getcwd)
+END(__getcwd)
+.hidden __getcwd
diff --git a/libc/arch-mips64/syscalls/__getdents.S b/libc/arch-mips64/syscalls/__getdents.S
index 3b89c8c..0a70a72 100644
--- a/libc/arch-mips64/syscalls/__getdents.S
+++ b/libc/arch-mips64/syscalls/__getdents.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __getdents
-    .align 4
-    .ent __getdents
+#include <private/bionic_asm.h>
 
-__getdents:
+ENTRY(__getdents)
     .set push
     .set noreorder
     li v0, __NR_getdents
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __getdents
-.hidden _C_LABEL(__getdents)
+END(__getdents)
+.hidden __getdents
diff --git a/libc/arch-mips64/syscalls/__getdents64.S b/libc/arch-mips64/syscalls/__getdents64.S
index eac06aa..6df556a 100644
--- a/libc/arch-mips64/syscalls/__getdents64.S
+++ b/libc/arch-mips64/syscalls/__getdents64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __getdents64
-    .align 4
-    .ent __getdents64
+#include <private/bionic_asm.h>
 
-__getdents64:
+ENTRY(__getdents64)
     .set push
     .set noreorder
     li v0, __NR_getdents64
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __getdents64
-.hidden _C_LABEL(__getdents64)
+END(__getdents64)
+.hidden __getdents64
diff --git a/libc/arch-mips64/syscalls/__getpriority.S b/libc/arch-mips64/syscalls/__getpriority.S
index e3cd90e..6ca2e1f 100644
--- a/libc/arch-mips64/syscalls/__getpriority.S
+++ b/libc/arch-mips64/syscalls/__getpriority.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __getpriority
-    .align 4
-    .ent __getpriority
+#include <private/bionic_asm.h>
 
-__getpriority:
+ENTRY(__getpriority)
     .set push
     .set noreorder
     li v0, __NR_getpriority
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __getpriority
-.hidden _C_LABEL(__getpriority)
+END(__getpriority)
+.hidden __getpriority
diff --git a/libc/arch-mips64/syscalls/__ioctl.S b/libc/arch-mips64/syscalls/__ioctl.S
index c3bd575..013ce18 100644
--- a/libc/arch-mips64/syscalls/__ioctl.S
+++ b/libc/arch-mips64/syscalls/__ioctl.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __ioctl
-    .align 4
-    .ent __ioctl
+#include <private/bionic_asm.h>
 
-__ioctl:
+ENTRY(__ioctl)
     .set push
     .set noreorder
     li v0, __NR_ioctl
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __ioctl
-.hidden _C_LABEL(__ioctl)
+END(__ioctl)
+.hidden __ioctl
diff --git a/libc/arch-mips64/syscalls/__openat.S b/libc/arch-mips64/syscalls/__openat.S
index 0f14454..1d46ef6 100644
--- a/libc/arch-mips64/syscalls/__openat.S
+++ b/libc/arch-mips64/syscalls/__openat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __openat
-    .align 4
-    .ent __openat
+#include <private/bionic_asm.h>
 
-__openat:
+ENTRY(__openat)
     .set push
     .set noreorder
     li v0, __NR_openat
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __openat
-.hidden _C_LABEL(__openat)
+END(__openat)
+.hidden __openat
diff --git a/libc/arch-mips64/syscalls/__ppoll.S b/libc/arch-mips64/syscalls/__ppoll.S
index ac7acb9..fb0e19a 100644
--- a/libc/arch-mips64/syscalls/__ppoll.S
+++ b/libc/arch-mips64/syscalls/__ppoll.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __ppoll
-    .align 4
-    .ent __ppoll
+#include <private/bionic_asm.h>
 
-__ppoll:
+ENTRY(__ppoll)
     .set push
     .set noreorder
     li v0, __NR_ppoll
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __ppoll
-.hidden _C_LABEL(__ppoll)
+END(__ppoll)
+.hidden __ppoll
diff --git a/libc/arch-mips64/syscalls/__pselect6.S b/libc/arch-mips64/syscalls/__pselect6.S
index 1e5ac2f..3055b31 100644
--- a/libc/arch-mips64/syscalls/__pselect6.S
+++ b/libc/arch-mips64/syscalls/__pselect6.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __pselect6
-    .align 4
-    .ent __pselect6
+#include <private/bionic_asm.h>
 
-__pselect6:
+ENTRY(__pselect6)
     .set push
     .set noreorder
     li v0, __NR_pselect6
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __pselect6
-.hidden _C_LABEL(__pselect6)
+END(__pselect6)
+.hidden __pselect6
diff --git a/libc/arch-mips64/syscalls/__ptrace.S b/libc/arch-mips64/syscalls/__ptrace.S
index 79b75b2..bae7733 100644
--- a/libc/arch-mips64/syscalls/__ptrace.S
+++ b/libc/arch-mips64/syscalls/__ptrace.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __ptrace
-    .align 4
-    .ent __ptrace
+#include <private/bionic_asm.h>
 
-__ptrace:
+ENTRY(__ptrace)
     .set push
     .set noreorder
     li v0, __NR_ptrace
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __ptrace
-.hidden _C_LABEL(__ptrace)
+END(__ptrace)
+.hidden __ptrace
diff --git a/libc/arch-mips64/syscalls/__reboot.S b/libc/arch-mips64/syscalls/__reboot.S
index 31ae824..31a97e3 100644
--- a/libc/arch-mips64/syscalls/__reboot.S
+++ b/libc/arch-mips64/syscalls/__reboot.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __reboot
-    .align 4
-    .ent __reboot
+#include <private/bionic_asm.h>
 
-__reboot:
+ENTRY(__reboot)
     .set push
     .set noreorder
     li v0, __NR_reboot
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __reboot
-.hidden _C_LABEL(__reboot)
+END(__reboot)
+.hidden __reboot
diff --git a/libc/arch-mips64/syscalls/__rt_sigaction.S b/libc/arch-mips64/syscalls/__rt_sigaction.S
index ef537a4..3728c58 100644
--- a/libc/arch-mips64/syscalls/__rt_sigaction.S
+++ b/libc/arch-mips64/syscalls/__rt_sigaction.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __rt_sigaction
-    .align 4
-    .ent __rt_sigaction
+#include <private/bionic_asm.h>
 
-__rt_sigaction:
+ENTRY(__rt_sigaction)
     .set push
     .set noreorder
     li v0, __NR_rt_sigaction
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __rt_sigaction
-.hidden _C_LABEL(__rt_sigaction)
+END(__rt_sigaction)
+.hidden __rt_sigaction
diff --git a/libc/arch-mips64/syscalls/__rt_sigpending.S b/libc/arch-mips64/syscalls/__rt_sigpending.S
index 2dc1bf6..e0d40cc 100644
--- a/libc/arch-mips64/syscalls/__rt_sigpending.S
+++ b/libc/arch-mips64/syscalls/__rt_sigpending.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __rt_sigpending
-    .align 4
-    .ent __rt_sigpending
+#include <private/bionic_asm.h>
 
-__rt_sigpending:
+ENTRY(__rt_sigpending)
     .set push
     .set noreorder
     li v0, __NR_rt_sigpending
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __rt_sigpending
-.hidden _C_LABEL(__rt_sigpending)
+END(__rt_sigpending)
+.hidden __rt_sigpending
diff --git a/libc/arch-mips64/syscalls/__rt_sigprocmask.S b/libc/arch-mips64/syscalls/__rt_sigprocmask.S
index 2814d66..d34a34b 100644
--- a/libc/arch-mips64/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-mips64/syscalls/__rt_sigprocmask.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __rt_sigprocmask
-    .align 4
-    .ent __rt_sigprocmask
+#include <private/bionic_asm.h>
 
-__rt_sigprocmask:
+ENTRY(__rt_sigprocmask)
     .set push
     .set noreorder
     li v0, __NR_rt_sigprocmask
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __rt_sigprocmask
-.hidden _C_LABEL(__rt_sigprocmask)
+END(__rt_sigprocmask)
+.hidden __rt_sigprocmask
diff --git a/libc/arch-mips64/syscalls/__rt_sigsuspend.S b/libc/arch-mips64/syscalls/__rt_sigsuspend.S
index 83c1990..f36e1c3 100644
--- a/libc/arch-mips64/syscalls/__rt_sigsuspend.S
+++ b/libc/arch-mips64/syscalls/__rt_sigsuspend.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __rt_sigsuspend
-    .align 4
-    .ent __rt_sigsuspend
+#include <private/bionic_asm.h>
 
-__rt_sigsuspend:
+ENTRY(__rt_sigsuspend)
     .set push
     .set noreorder
     li v0, __NR_rt_sigsuspend
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __rt_sigsuspend
-.hidden _C_LABEL(__rt_sigsuspend)
+END(__rt_sigsuspend)
+.hidden __rt_sigsuspend
diff --git a/libc/arch-mips64/syscalls/__rt_sigtimedwait.S b/libc/arch-mips64/syscalls/__rt_sigtimedwait.S
index 48daea8..798d6f8 100644
--- a/libc/arch-mips64/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-mips64/syscalls/__rt_sigtimedwait.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __rt_sigtimedwait
-    .align 4
-    .ent __rt_sigtimedwait
+#include <private/bionic_asm.h>
 
-__rt_sigtimedwait:
+ENTRY(__rt_sigtimedwait)
     .set push
     .set noreorder
     li v0, __NR_rt_sigtimedwait
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __rt_sigtimedwait
-.hidden _C_LABEL(__rt_sigtimedwait)
+END(__rt_sigtimedwait)
+.hidden __rt_sigtimedwait
diff --git a/libc/arch-mips64/syscalls/__sched_getaffinity.S b/libc/arch-mips64/syscalls/__sched_getaffinity.S
index 006e395..a287815 100644
--- a/libc/arch-mips64/syscalls/__sched_getaffinity.S
+++ b/libc/arch-mips64/syscalls/__sched_getaffinity.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __sched_getaffinity
-    .align 4
-    .ent __sched_getaffinity
+#include <private/bionic_asm.h>
 
-__sched_getaffinity:
+ENTRY(__sched_getaffinity)
     .set push
     .set noreorder
     li v0, __NR_sched_getaffinity
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __sched_getaffinity
-.hidden _C_LABEL(__sched_getaffinity)
+END(__sched_getaffinity)
+.hidden __sched_getaffinity
diff --git a/libc/arch-mips64/syscalls/__set_thread_area.S b/libc/arch-mips64/syscalls/__set_thread_area.S
index 009d004..c28ee4a 100644
--- a/libc/arch-mips64/syscalls/__set_thread_area.S
+++ b/libc/arch-mips64/syscalls/__set_thread_area.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __set_thread_area
-    .align 4
-    .ent __set_thread_area
+#include <private/bionic_asm.h>
 
-__set_thread_area:
+ENTRY(__set_thread_area)
     .set push
     .set noreorder
     li v0, __NR_set_thread_area
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __set_thread_area
-.hidden _C_LABEL(__set_thread_area)
+END(__set_thread_area)
+.hidden __set_thread_area
diff --git a/libc/arch-mips64/syscalls/__set_tid_address.S b/libc/arch-mips64/syscalls/__set_tid_address.S
index 4c1f97d..8757001 100644
--- a/libc/arch-mips64/syscalls/__set_tid_address.S
+++ b/libc/arch-mips64/syscalls/__set_tid_address.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __set_tid_address
-    .align 4
-    .ent __set_tid_address
+#include <private/bionic_asm.h>
 
-__set_tid_address:
+ENTRY(__set_tid_address)
     .set push
     .set noreorder
     li v0, __NR_set_tid_address
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __set_tid_address
-.hidden _C_LABEL(__set_tid_address)
+END(__set_tid_address)
+.hidden __set_tid_address
diff --git a/libc/arch-mips64/syscalls/__syslog.S b/libc/arch-mips64/syscalls/__syslog.S
index 2291401..70eed3a 100644
--- a/libc/arch-mips64/syscalls/__syslog.S
+++ b/libc/arch-mips64/syscalls/__syslog.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __syslog
-    .align 4
-    .ent __syslog
+#include <private/bionic_asm.h>
 
-__syslog:
+ENTRY(__syslog)
     .set push
     .set noreorder
     li v0, __NR_syslog
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __syslog
-.hidden _C_LABEL(__syslog)
+END(__syslog)
+.hidden __syslog
diff --git a/libc/arch-mips64/syscalls/__timer_create.S b/libc/arch-mips64/syscalls/__timer_create.S
index aa024b7..5a4daac 100644
--- a/libc/arch-mips64/syscalls/__timer_create.S
+++ b/libc/arch-mips64/syscalls/__timer_create.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __timer_create
-    .align 4
-    .ent __timer_create
+#include <private/bionic_asm.h>
 
-__timer_create:
+ENTRY(__timer_create)
     .set push
     .set noreorder
     li v0, __NR_timer_create
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __timer_create
-.hidden _C_LABEL(__timer_create)
+END(__timer_create)
+.hidden __timer_create
diff --git a/libc/arch-mips64/syscalls/__timer_delete.S b/libc/arch-mips64/syscalls/__timer_delete.S
index 024f0c4..8bbbdb7 100644
--- a/libc/arch-mips64/syscalls/__timer_delete.S
+++ b/libc/arch-mips64/syscalls/__timer_delete.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __timer_delete
-    .align 4
-    .ent __timer_delete
+#include <private/bionic_asm.h>
 
-__timer_delete:
+ENTRY(__timer_delete)
     .set push
     .set noreorder
     li v0, __NR_timer_delete
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __timer_delete
-.hidden _C_LABEL(__timer_delete)
+END(__timer_delete)
+.hidden __timer_delete
diff --git a/libc/arch-mips64/syscalls/__timer_getoverrun.S b/libc/arch-mips64/syscalls/__timer_getoverrun.S
index 0931111..3bf06cc 100644
--- a/libc/arch-mips64/syscalls/__timer_getoverrun.S
+++ b/libc/arch-mips64/syscalls/__timer_getoverrun.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __timer_getoverrun
-    .align 4
-    .ent __timer_getoverrun
+#include <private/bionic_asm.h>
 
-__timer_getoverrun:
+ENTRY(__timer_getoverrun)
     .set push
     .set noreorder
     li v0, __NR_timer_getoverrun
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __timer_getoverrun
-.hidden _C_LABEL(__timer_getoverrun)
+END(__timer_getoverrun)
+.hidden __timer_getoverrun
diff --git a/libc/arch-mips64/syscalls/__timer_gettime.S b/libc/arch-mips64/syscalls/__timer_gettime.S
index 4eb5f71..a15ec17 100644
--- a/libc/arch-mips64/syscalls/__timer_gettime.S
+++ b/libc/arch-mips64/syscalls/__timer_gettime.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __timer_gettime
-    .align 4
-    .ent __timer_gettime
+#include <private/bionic_asm.h>
 
-__timer_gettime:
+ENTRY(__timer_gettime)
     .set push
     .set noreorder
     li v0, __NR_timer_gettime
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __timer_gettime
-.hidden _C_LABEL(__timer_gettime)
+END(__timer_gettime)
+.hidden __timer_gettime
diff --git a/libc/arch-mips64/syscalls/__timer_settime.S b/libc/arch-mips64/syscalls/__timer_settime.S
index ecac0c5..10e2ca8 100644
--- a/libc/arch-mips64/syscalls/__timer_settime.S
+++ b/libc/arch-mips64/syscalls/__timer_settime.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __timer_settime
-    .align 4
-    .ent __timer_settime
+#include <private/bionic_asm.h>
 
-__timer_settime:
+ENTRY(__timer_settime)
     .set push
     .set noreorder
     li v0, __NR_timer_settime
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __timer_settime
-.hidden _C_LABEL(__timer_settime)
+END(__timer_settime)
+.hidden __timer_settime
diff --git a/libc/arch-mips64/syscalls/__waitid.S b/libc/arch-mips64/syscalls/__waitid.S
index caba21e..4d971e6 100644
--- a/libc/arch-mips64/syscalls/__waitid.S
+++ b/libc/arch-mips64/syscalls/__waitid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl __waitid
-    .align 4
-    .ent __waitid
+#include <private/bionic_asm.h>
 
-__waitid:
+ENTRY(__waitid)
     .set push
     .set noreorder
     li v0, __NR_waitid
@@ -28,5 +22,5 @@
     j t9
     move ra, t0
     .set pop
-    .end __waitid
-.hidden _C_LABEL(__waitid)
+END(__waitid)
+.hidden __waitid
diff --git a/libc/arch-mips64/syscalls/_exit.S b/libc/arch-mips64/syscalls/_exit.S
index 87aff94..9b108a6 100644
--- a/libc/arch-mips64/syscalls/_exit.S
+++ b/libc/arch-mips64/syscalls/_exit.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl _exit
-    .align 4
-    .ent _exit
+#include <private/bionic_asm.h>
 
-_exit:
+ENTRY(_exit)
     .set push
     .set noreorder
     li v0, __NR_exit_group
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end _exit
+END(_exit)
diff --git a/libc/arch-mips64/syscalls/_flush_cache.S b/libc/arch-mips64/syscalls/_flush_cache.S
index c2f8cd6..132fd4e 100644
--- a/libc/arch-mips64/syscalls/_flush_cache.S
+++ b/libc/arch-mips64/syscalls/_flush_cache.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl _flush_cache
-    .align 4
-    .ent _flush_cache
+#include <private/bionic_asm.h>
 
-_flush_cache:
+ENTRY(_flush_cache)
     .set push
     .set noreorder
     li v0, __NR_cacheflush
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end _flush_cache
+END(_flush_cache)
diff --git a/libc/arch-mips64/syscalls/accept.S b/libc/arch-mips64/syscalls/accept.S
index dc9ac59..6c38556 100644
--- a/libc/arch-mips64/syscalls/accept.S
+++ b/libc/arch-mips64/syscalls/accept.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl accept
-    .align 4
-    .ent accept
+#include <private/bionic_asm.h>
 
-accept:
+ENTRY(accept)
     .set push
     .set noreorder
     li v0, __NR_accept
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end accept
+END(accept)
diff --git a/libc/arch-mips64/syscalls/acct.S b/libc/arch-mips64/syscalls/acct.S
index 0b23866..7185877 100644
--- a/libc/arch-mips64/syscalls/acct.S
+++ b/libc/arch-mips64/syscalls/acct.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl acct
-    .align 4
-    .ent acct
+#include <private/bionic_asm.h>
 
-acct:
+ENTRY(acct)
     .set push
     .set noreorder
     li v0, __NR_acct
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end acct
+END(acct)
diff --git a/libc/arch-mips64/syscalls/bind.S b/libc/arch-mips64/syscalls/bind.S
index da81dad..cb28bb4 100644
--- a/libc/arch-mips64/syscalls/bind.S
+++ b/libc/arch-mips64/syscalls/bind.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl bind
-    .align 4
-    .ent bind
+#include <private/bionic_asm.h>
 
-bind:
+ENTRY(bind)
     .set push
     .set noreorder
     li v0, __NR_bind
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end bind
+END(bind)
diff --git a/libc/arch-mips64/syscalls/capget.S b/libc/arch-mips64/syscalls/capget.S
index 26d74b1..068e076 100644
--- a/libc/arch-mips64/syscalls/capget.S
+++ b/libc/arch-mips64/syscalls/capget.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl capget
-    .align 4
-    .ent capget
+#include <private/bionic_asm.h>
 
-capget:
+ENTRY(capget)
     .set push
     .set noreorder
     li v0, __NR_capget
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end capget
+END(capget)
diff --git a/libc/arch-mips64/syscalls/capset.S b/libc/arch-mips64/syscalls/capset.S
index b4b87de..f29501b 100644
--- a/libc/arch-mips64/syscalls/capset.S
+++ b/libc/arch-mips64/syscalls/capset.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl capset
-    .align 4
-    .ent capset
+#include <private/bionic_asm.h>
 
-capset:
+ENTRY(capset)
     .set push
     .set noreorder
     li v0, __NR_capset
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end capset
+END(capset)
diff --git a/libc/arch-mips64/syscalls/chdir.S b/libc/arch-mips64/syscalls/chdir.S
index af3546a..c2753bd 100644
--- a/libc/arch-mips64/syscalls/chdir.S
+++ b/libc/arch-mips64/syscalls/chdir.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl chdir
-    .align 4
-    .ent chdir
+#include <private/bionic_asm.h>
 
-chdir:
+ENTRY(chdir)
     .set push
     .set noreorder
     li v0, __NR_chdir
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end chdir
+END(chdir)
diff --git a/libc/arch-mips64/syscalls/chroot.S b/libc/arch-mips64/syscalls/chroot.S
index b992774..ca1d4a8 100644
--- a/libc/arch-mips64/syscalls/chroot.S
+++ b/libc/arch-mips64/syscalls/chroot.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl chroot
-    .align 4
-    .ent chroot
+#include <private/bionic_asm.h>
 
-chroot:
+ENTRY(chroot)
     .set push
     .set noreorder
     li v0, __NR_chroot
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end chroot
+END(chroot)
diff --git a/libc/arch-mips64/syscalls/clock_getres.S b/libc/arch-mips64/syscalls/clock_getres.S
index f277ab1..e7a8dd3 100644
--- a/libc/arch-mips64/syscalls/clock_getres.S
+++ b/libc/arch-mips64/syscalls/clock_getres.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl clock_getres
-    .align 4
-    .ent clock_getres
+#include <private/bionic_asm.h>
 
-clock_getres:
+ENTRY(clock_getres)
     .set push
     .set noreorder
     li v0, __NR_clock_getres
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end clock_getres
+END(clock_getres)
diff --git a/libc/arch-mips64/syscalls/clock_gettime.S b/libc/arch-mips64/syscalls/clock_gettime.S
index 8200e75..4c92a38 100644
--- a/libc/arch-mips64/syscalls/clock_gettime.S
+++ b/libc/arch-mips64/syscalls/clock_gettime.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl clock_gettime
-    .align 4
-    .ent clock_gettime
+#include <private/bionic_asm.h>
 
-clock_gettime:
+ENTRY(clock_gettime)
     .set push
     .set noreorder
     li v0, __NR_clock_gettime
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end clock_gettime
+END(clock_gettime)
diff --git a/libc/arch-mips64/syscalls/clock_nanosleep.S b/libc/arch-mips64/syscalls/clock_nanosleep.S
index 9ac95fc..2934591 100644
--- a/libc/arch-mips64/syscalls/clock_nanosleep.S
+++ b/libc/arch-mips64/syscalls/clock_nanosleep.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl clock_nanosleep
-    .align 4
-    .ent clock_nanosleep
+#include <private/bionic_asm.h>
 
-clock_nanosleep:
+ENTRY(clock_nanosleep)
     .set push
     .set noreorder
     li v0, __NR_clock_nanosleep
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end clock_nanosleep
+END(clock_nanosleep)
diff --git a/libc/arch-mips64/syscalls/clock_settime.S b/libc/arch-mips64/syscalls/clock_settime.S
index a8cd723..1969cb6 100644
--- a/libc/arch-mips64/syscalls/clock_settime.S
+++ b/libc/arch-mips64/syscalls/clock_settime.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl clock_settime
-    .align 4
-    .ent clock_settime
+#include <private/bionic_asm.h>
 
-clock_settime:
+ENTRY(clock_settime)
     .set push
     .set noreorder
     li v0, __NR_clock_settime
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end clock_settime
+END(clock_settime)
diff --git a/libc/arch-mips64/syscalls/close.S b/libc/arch-mips64/syscalls/close.S
index cfe5c51..f446000 100644
--- a/libc/arch-mips64/syscalls/close.S
+++ b/libc/arch-mips64/syscalls/close.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl close
-    .align 4
-    .ent close
+#include <private/bionic_asm.h>
 
-close:
+ENTRY(close)
     .set push
     .set noreorder
     li v0, __NR_close
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end close
+END(close)
diff --git a/libc/arch-mips64/syscalls/connect.S b/libc/arch-mips64/syscalls/connect.S
index 80600bb..8fe2d56 100644
--- a/libc/arch-mips64/syscalls/connect.S
+++ b/libc/arch-mips64/syscalls/connect.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl connect
-    .align 4
-    .ent connect
+#include <private/bionic_asm.h>
 
-connect:
+ENTRY(connect)
     .set push
     .set noreorder
     li v0, __NR_connect
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end connect
+END(connect)
diff --git a/libc/arch-mips64/syscalls/delete_module.S b/libc/arch-mips64/syscalls/delete_module.S
index cf2579d..d24adf8 100644
--- a/libc/arch-mips64/syscalls/delete_module.S
+++ b/libc/arch-mips64/syscalls/delete_module.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl delete_module
-    .align 4
-    .ent delete_module
+#include <private/bionic_asm.h>
 
-delete_module:
+ENTRY(delete_module)
     .set push
     .set noreorder
     li v0, __NR_delete_module
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end delete_module
+END(delete_module)
diff --git a/libc/arch-mips64/syscalls/dup.S b/libc/arch-mips64/syscalls/dup.S
index 0a92e57..5d2d7de 100644
--- a/libc/arch-mips64/syscalls/dup.S
+++ b/libc/arch-mips64/syscalls/dup.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl dup
-    .align 4
-    .ent dup
+#include <private/bionic_asm.h>
 
-dup:
+ENTRY(dup)
     .set push
     .set noreorder
     li v0, __NR_dup
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end dup
+END(dup)
diff --git a/libc/arch-mips64/syscalls/dup3.S b/libc/arch-mips64/syscalls/dup3.S
index e9fba1e..90f0f89 100644
--- a/libc/arch-mips64/syscalls/dup3.S
+++ b/libc/arch-mips64/syscalls/dup3.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl dup3
-    .align 4
-    .ent dup3
+#include <private/bionic_asm.h>
 
-dup3:
+ENTRY(dup3)
     .set push
     .set noreorder
     li v0, __NR_dup3
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end dup3
+END(dup3)
diff --git a/libc/arch-mips64/syscalls/epoll_create1.S b/libc/arch-mips64/syscalls/epoll_create1.S
index 9c41868..312887f 100644
--- a/libc/arch-mips64/syscalls/epoll_create1.S
+++ b/libc/arch-mips64/syscalls/epoll_create1.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl epoll_create1
-    .align 4
-    .ent epoll_create1
+#include <private/bionic_asm.h>
 
-epoll_create1:
+ENTRY(epoll_create1)
     .set push
     .set noreorder
     li v0, __NR_epoll_create1
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end epoll_create1
+END(epoll_create1)
diff --git a/libc/arch-mips64/syscalls/epoll_ctl.S b/libc/arch-mips64/syscalls/epoll_ctl.S
index 5f18979..461ad7b 100644
--- a/libc/arch-mips64/syscalls/epoll_ctl.S
+++ b/libc/arch-mips64/syscalls/epoll_ctl.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl epoll_ctl
-    .align 4
-    .ent epoll_ctl
+#include <private/bionic_asm.h>
 
-epoll_ctl:
+ENTRY(epoll_ctl)
     .set push
     .set noreorder
     li v0, __NR_epoll_ctl
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end epoll_ctl
+END(epoll_ctl)
diff --git a/libc/arch-mips64/syscalls/eventfd.S b/libc/arch-mips64/syscalls/eventfd.S
index 9cb87ca..da8866e 100644
--- a/libc/arch-mips64/syscalls/eventfd.S
+++ b/libc/arch-mips64/syscalls/eventfd.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl eventfd
-    .align 4
-    .ent eventfd
+#include <private/bionic_asm.h>
 
-eventfd:
+ENTRY(eventfd)
     .set push
     .set noreorder
     li v0, __NR_eventfd2
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end eventfd
+END(eventfd)
diff --git a/libc/arch-mips64/syscalls/execve.S b/libc/arch-mips64/syscalls/execve.S
index 8edfc34..3cb49b6 100644
--- a/libc/arch-mips64/syscalls/execve.S
+++ b/libc/arch-mips64/syscalls/execve.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl execve
-    .align 4
-    .ent execve
+#include <private/bionic_asm.h>
 
-execve:
+ENTRY(execve)
     .set push
     .set noreorder
     li v0, __NR_execve
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end execve
+END(execve)
diff --git a/libc/arch-mips64/syscalls/faccessat.S b/libc/arch-mips64/syscalls/faccessat.S
index 14de073..d06f420 100644
--- a/libc/arch-mips64/syscalls/faccessat.S
+++ b/libc/arch-mips64/syscalls/faccessat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl faccessat
-    .align 4
-    .ent faccessat
+#include <private/bionic_asm.h>
 
-faccessat:
+ENTRY(faccessat)
     .set push
     .set noreorder
     li v0, __NR_faccessat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end faccessat
+END(faccessat)
diff --git a/libc/arch-mips64/syscalls/fallocate.S b/libc/arch-mips64/syscalls/fallocate.S
index 347ab1f..d1e64b5 100644
--- a/libc/arch-mips64/syscalls/fallocate.S
+++ b/libc/arch-mips64/syscalls/fallocate.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fallocate
-    .align 4
-    .ent fallocate
+#include <private/bionic_asm.h>
 
-fallocate:
+ENTRY(fallocate)
     .set push
     .set noreorder
     li v0, __NR_fallocate
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end fallocate
+END(fallocate)
 
     .globl fallocate64
     .equ fallocate64, fallocate
diff --git a/libc/arch-mips64/syscalls/fchdir.S b/libc/arch-mips64/syscalls/fchdir.S
index 1b5e7cb..0c8ab73 100644
--- a/libc/arch-mips64/syscalls/fchdir.S
+++ b/libc/arch-mips64/syscalls/fchdir.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fchdir
-    .align 4
-    .ent fchdir
+#include <private/bionic_asm.h>
 
-fchdir:
+ENTRY(fchdir)
     .set push
     .set noreorder
     li v0, __NR_fchdir
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fchdir
+END(fchdir)
diff --git a/libc/arch-mips64/syscalls/fchmod.S b/libc/arch-mips64/syscalls/fchmod.S
index b9ce347..4ebb796 100644
--- a/libc/arch-mips64/syscalls/fchmod.S
+++ b/libc/arch-mips64/syscalls/fchmod.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fchmod
-    .align 4
-    .ent fchmod
+#include <private/bionic_asm.h>
 
-fchmod:
+ENTRY(fchmod)
     .set push
     .set noreorder
     li v0, __NR_fchmod
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fchmod
+END(fchmod)
diff --git a/libc/arch-mips64/syscalls/fchmodat.S b/libc/arch-mips64/syscalls/fchmodat.S
index f21aea7..4887324 100644
--- a/libc/arch-mips64/syscalls/fchmodat.S
+++ b/libc/arch-mips64/syscalls/fchmodat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fchmodat
-    .align 4
-    .ent fchmodat
+#include <private/bionic_asm.h>
 
-fchmodat:
+ENTRY(fchmodat)
     .set push
     .set noreorder
     li v0, __NR_fchmodat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fchmodat
+END(fchmodat)
diff --git a/libc/arch-mips64/syscalls/fchown.S b/libc/arch-mips64/syscalls/fchown.S
index 2eb7fa4..c21c831 100644
--- a/libc/arch-mips64/syscalls/fchown.S
+++ b/libc/arch-mips64/syscalls/fchown.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fchown
-    .align 4
-    .ent fchown
+#include <private/bionic_asm.h>
 
-fchown:
+ENTRY(fchown)
     .set push
     .set noreorder
     li v0, __NR_fchown
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fchown
+END(fchown)
diff --git a/libc/arch-mips64/syscalls/fchownat.S b/libc/arch-mips64/syscalls/fchownat.S
index 896ba43..eba230c 100644
--- a/libc/arch-mips64/syscalls/fchownat.S
+++ b/libc/arch-mips64/syscalls/fchownat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fchownat
-    .align 4
-    .ent fchownat
+#include <private/bionic_asm.h>
 
-fchownat:
+ENTRY(fchownat)
     .set push
     .set noreorder
     li v0, __NR_fchownat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fchownat
+END(fchownat)
diff --git a/libc/arch-mips64/syscalls/fcntl.S b/libc/arch-mips64/syscalls/fcntl.S
index 755361d..1f54b0e 100644
--- a/libc/arch-mips64/syscalls/fcntl.S
+++ b/libc/arch-mips64/syscalls/fcntl.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fcntl
-    .align 4
-    .ent fcntl
+#include <private/bionic_asm.h>
 
-fcntl:
+ENTRY(fcntl)
     .set push
     .set noreorder
     li v0, __NR_fcntl
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fcntl
+END(fcntl)
diff --git a/libc/arch-mips64/syscalls/fdatasync.S b/libc/arch-mips64/syscalls/fdatasync.S
index f036248..ba1eccc 100644
--- a/libc/arch-mips64/syscalls/fdatasync.S
+++ b/libc/arch-mips64/syscalls/fdatasync.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fdatasync
-    .align 4
-    .ent fdatasync
+#include <private/bionic_asm.h>
 
-fdatasync:
+ENTRY(fdatasync)
     .set push
     .set noreorder
     li v0, __NR_fdatasync
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fdatasync
+END(fdatasync)
diff --git a/libc/arch-mips64/syscalls/fgetxattr.S b/libc/arch-mips64/syscalls/fgetxattr.S
index 0cd6ad7..5b9c8ed 100644
--- a/libc/arch-mips64/syscalls/fgetxattr.S
+++ b/libc/arch-mips64/syscalls/fgetxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fgetxattr
-    .align 4
-    .ent fgetxattr
+#include <private/bionic_asm.h>
 
-fgetxattr:
+ENTRY(fgetxattr)
     .set push
     .set noreorder
     li v0, __NR_fgetxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fgetxattr
+END(fgetxattr)
diff --git a/libc/arch-mips64/syscalls/flistxattr.S b/libc/arch-mips64/syscalls/flistxattr.S
index 2e8961b..c0bf93c 100644
--- a/libc/arch-mips64/syscalls/flistxattr.S
+++ b/libc/arch-mips64/syscalls/flistxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl flistxattr
-    .align 4
-    .ent flistxattr
+#include <private/bionic_asm.h>
 
-flistxattr:
+ENTRY(flistxattr)
     .set push
     .set noreorder
     li v0, __NR_flistxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end flistxattr
+END(flistxattr)
diff --git a/libc/arch-mips64/syscalls/flock.S b/libc/arch-mips64/syscalls/flock.S
index 93051d3..b63f6fc 100644
--- a/libc/arch-mips64/syscalls/flock.S
+++ b/libc/arch-mips64/syscalls/flock.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl flock
-    .align 4
-    .ent flock
+#include <private/bionic_asm.h>
 
-flock:
+ENTRY(flock)
     .set push
     .set noreorder
     li v0, __NR_flock
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end flock
+END(flock)
diff --git a/libc/arch-mips64/syscalls/fremovexattr.S b/libc/arch-mips64/syscalls/fremovexattr.S
index 6ef8c12..be20d00 100644
--- a/libc/arch-mips64/syscalls/fremovexattr.S
+++ b/libc/arch-mips64/syscalls/fremovexattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fremovexattr
-    .align 4
-    .ent fremovexattr
+#include <private/bionic_asm.h>
 
-fremovexattr:
+ENTRY(fremovexattr)
     .set push
     .set noreorder
     li v0, __NR_fremovexattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fremovexattr
+END(fremovexattr)
diff --git a/libc/arch-mips64/syscalls/fsetxattr.S b/libc/arch-mips64/syscalls/fsetxattr.S
index 89e0de7..92198ce 100644
--- a/libc/arch-mips64/syscalls/fsetxattr.S
+++ b/libc/arch-mips64/syscalls/fsetxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fsetxattr
-    .align 4
-    .ent fsetxattr
+#include <private/bionic_asm.h>
 
-fsetxattr:
+ENTRY(fsetxattr)
     .set push
     .set noreorder
     li v0, __NR_fsetxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fsetxattr
+END(fsetxattr)
diff --git a/libc/arch-mips64/syscalls/fstat64.S b/libc/arch-mips64/syscalls/fstat64.S
index aad3c21..078e3dd 100644
--- a/libc/arch-mips64/syscalls/fstat64.S
+++ b/libc/arch-mips64/syscalls/fstat64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fstat64
-    .align 4
-    .ent fstat64
+#include <private/bionic_asm.h>
 
-fstat64:
+ENTRY(fstat64)
     .set push
     .set noreorder
     li v0, __NR_fstat
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end fstat64
+END(fstat64)
 
     .globl fstat
     .equ fstat, fstat64
diff --git a/libc/arch-mips64/syscalls/fstatat64.S b/libc/arch-mips64/syscalls/fstatat64.S
index 828439a..cc38de1 100644
--- a/libc/arch-mips64/syscalls/fstatat64.S
+++ b/libc/arch-mips64/syscalls/fstatat64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fstatat64
-    .align 4
-    .ent fstatat64
+#include <private/bionic_asm.h>
 
-fstatat64:
+ENTRY(fstatat64)
     .set push
     .set noreorder
     li v0, __NR_newfstatat
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end fstatat64
+END(fstatat64)
 
     .globl fstatat
     .equ fstatat, fstatat64
diff --git a/libc/arch-mips64/syscalls/fstatfs64.S b/libc/arch-mips64/syscalls/fstatfs64.S
index 09380b2..3474bc2 100644
--- a/libc/arch-mips64/syscalls/fstatfs64.S
+++ b/libc/arch-mips64/syscalls/fstatfs64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fstatfs64
-    .align 4
-    .ent fstatfs64
+#include <private/bionic_asm.h>
 
-fstatfs64:
+ENTRY(fstatfs64)
     .set push
     .set noreorder
     li v0, __NR_fstatfs
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end fstatfs64
+END(fstatfs64)
 
     .globl fstatfs
     .equ fstatfs, fstatfs64
diff --git a/libc/arch-mips64/syscalls/fsync.S b/libc/arch-mips64/syscalls/fsync.S
index 08f77f0..3543fef 100644
--- a/libc/arch-mips64/syscalls/fsync.S
+++ b/libc/arch-mips64/syscalls/fsync.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl fsync
-    .align 4
-    .ent fsync
+#include <private/bionic_asm.h>
 
-fsync:
+ENTRY(fsync)
     .set push
     .set noreorder
     li v0, __NR_fsync
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end fsync
+END(fsync)
diff --git a/libc/arch-mips64/syscalls/ftruncate.S b/libc/arch-mips64/syscalls/ftruncate.S
index 3afe26a..cd97b87 100644
--- a/libc/arch-mips64/syscalls/ftruncate.S
+++ b/libc/arch-mips64/syscalls/ftruncate.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl ftruncate
-    .align 4
-    .ent ftruncate
+#include <private/bionic_asm.h>
 
-ftruncate:
+ENTRY(ftruncate)
     .set push
     .set noreorder
     li v0, __NR_ftruncate
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end ftruncate
+END(ftruncate)
 
     .globl ftruncate64
     .equ ftruncate64, ftruncate
diff --git a/libc/arch-mips64/syscalls/futex.S b/libc/arch-mips64/syscalls/futex.S
index edbacba..dc7dcc6 100644
--- a/libc/arch-mips64/syscalls/futex.S
+++ b/libc/arch-mips64/syscalls/futex.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl futex
-    .align 4
-    .ent futex
+#include <private/bionic_asm.h>
 
-futex:
+ENTRY(futex)
     .set push
     .set noreorder
     li v0, __NR_futex
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end futex
+END(futex)
diff --git a/libc/arch-mips64/syscalls/getegid.S b/libc/arch-mips64/syscalls/getegid.S
index d014386..d6b3d7f 100644
--- a/libc/arch-mips64/syscalls/getegid.S
+++ b/libc/arch-mips64/syscalls/getegid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getegid
-    .align 4
-    .ent getegid
+#include <private/bionic_asm.h>
 
-getegid:
+ENTRY(getegid)
     .set push
     .set noreorder
     li v0, __NR_getegid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getegid
+END(getegid)
diff --git a/libc/arch-mips64/syscalls/geteuid.S b/libc/arch-mips64/syscalls/geteuid.S
index ec63f6c..a1d9713 100644
--- a/libc/arch-mips64/syscalls/geteuid.S
+++ b/libc/arch-mips64/syscalls/geteuid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl geteuid
-    .align 4
-    .ent geteuid
+#include <private/bionic_asm.h>
 
-geteuid:
+ENTRY(geteuid)
     .set push
     .set noreorder
     li v0, __NR_geteuid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end geteuid
+END(geteuid)
diff --git a/libc/arch-mips64/syscalls/getgid.S b/libc/arch-mips64/syscalls/getgid.S
index 531d364..c89d709 100644
--- a/libc/arch-mips64/syscalls/getgid.S
+++ b/libc/arch-mips64/syscalls/getgid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getgid
-    .align 4
-    .ent getgid
+#include <private/bionic_asm.h>
 
-getgid:
+ENTRY(getgid)
     .set push
     .set noreorder
     li v0, __NR_getgid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getgid
+END(getgid)
diff --git a/libc/arch-mips64/syscalls/getgroups.S b/libc/arch-mips64/syscalls/getgroups.S
index b7fcef6..8d9cddb 100644
--- a/libc/arch-mips64/syscalls/getgroups.S
+++ b/libc/arch-mips64/syscalls/getgroups.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getgroups
-    .align 4
-    .ent getgroups
+#include <private/bionic_asm.h>
 
-getgroups:
+ENTRY(getgroups)
     .set push
     .set noreorder
     li v0, __NR_getgroups
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getgroups
+END(getgroups)
diff --git a/libc/arch-mips64/syscalls/getitimer.S b/libc/arch-mips64/syscalls/getitimer.S
index 4f9bc63..12dad03 100644
--- a/libc/arch-mips64/syscalls/getitimer.S
+++ b/libc/arch-mips64/syscalls/getitimer.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getitimer
-    .align 4
-    .ent getitimer
+#include <private/bionic_asm.h>
 
-getitimer:
+ENTRY(getitimer)
     .set push
     .set noreorder
     li v0, __NR_getitimer
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getitimer
+END(getitimer)
diff --git a/libc/arch-mips64/syscalls/getpeername.S b/libc/arch-mips64/syscalls/getpeername.S
index 695fe6a..278428a 100644
--- a/libc/arch-mips64/syscalls/getpeername.S
+++ b/libc/arch-mips64/syscalls/getpeername.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getpeername
-    .align 4
-    .ent getpeername
+#include <private/bionic_asm.h>
 
-getpeername:
+ENTRY(getpeername)
     .set push
     .set noreorder
     li v0, __NR_getpeername
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getpeername
+END(getpeername)
diff --git a/libc/arch-mips64/syscalls/getpgid.S b/libc/arch-mips64/syscalls/getpgid.S
index 46787d6..56551ef 100644
--- a/libc/arch-mips64/syscalls/getpgid.S
+++ b/libc/arch-mips64/syscalls/getpgid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getpgid
-    .align 4
-    .ent getpgid
+#include <private/bionic_asm.h>
 
-getpgid:
+ENTRY(getpgid)
     .set push
     .set noreorder
     li v0, __NR_getpgid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getpgid
+END(getpgid)
diff --git a/libc/arch-mips64/syscalls/getpid.S b/libc/arch-mips64/syscalls/getpid.S
index 4f3f58f..3b457b5 100644
--- a/libc/arch-mips64/syscalls/getpid.S
+++ b/libc/arch-mips64/syscalls/getpid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getpid
-    .align 4
-    .ent getpid
+#include <private/bionic_asm.h>
 
-getpid:
+ENTRY(getpid)
     .set push
     .set noreorder
     li v0, __NR_getpid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getpid
+END(getpid)
diff --git a/libc/arch-mips64/syscalls/getppid.S b/libc/arch-mips64/syscalls/getppid.S
index 0bcab00..97066f8 100644
--- a/libc/arch-mips64/syscalls/getppid.S
+++ b/libc/arch-mips64/syscalls/getppid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getppid
-    .align 4
-    .ent getppid
+#include <private/bionic_asm.h>
 
-getppid:
+ENTRY(getppid)
     .set push
     .set noreorder
     li v0, __NR_getppid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getppid
+END(getppid)
diff --git a/libc/arch-mips64/syscalls/getresgid.S b/libc/arch-mips64/syscalls/getresgid.S
index 48e605b..f07fc11 100644
--- a/libc/arch-mips64/syscalls/getresgid.S
+++ b/libc/arch-mips64/syscalls/getresgid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getresgid
-    .align 4
-    .ent getresgid
+#include <private/bionic_asm.h>
 
-getresgid:
+ENTRY(getresgid)
     .set push
     .set noreorder
     li v0, __NR_getresgid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getresgid
+END(getresgid)
diff --git a/libc/arch-mips64/syscalls/getresuid.S b/libc/arch-mips64/syscalls/getresuid.S
index 79987d6..4f1ba86 100644
--- a/libc/arch-mips64/syscalls/getresuid.S
+++ b/libc/arch-mips64/syscalls/getresuid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getresuid
-    .align 4
-    .ent getresuid
+#include <private/bionic_asm.h>
 
-getresuid:
+ENTRY(getresuid)
     .set push
     .set noreorder
     li v0, __NR_getresuid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getresuid
+END(getresuid)
diff --git a/libc/arch-mips64/syscalls/getrlimit.S b/libc/arch-mips64/syscalls/getrlimit.S
index d19eaeb..f825db9 100644
--- a/libc/arch-mips64/syscalls/getrlimit.S
+++ b/libc/arch-mips64/syscalls/getrlimit.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getrlimit
-    .align 4
-    .ent getrlimit
+#include <private/bionic_asm.h>
 
-getrlimit:
+ENTRY(getrlimit)
     .set push
     .set noreorder
     li v0, __NR_getrlimit
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end getrlimit
+END(getrlimit)
 
     .globl getrlimit64
     .equ getrlimit64, getrlimit
diff --git a/libc/arch-mips64/syscalls/getrusage.S b/libc/arch-mips64/syscalls/getrusage.S
index dd57c38..49f3c42 100644
--- a/libc/arch-mips64/syscalls/getrusage.S
+++ b/libc/arch-mips64/syscalls/getrusage.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getrusage
-    .align 4
-    .ent getrusage
+#include <private/bionic_asm.h>
 
-getrusage:
+ENTRY(getrusage)
     .set push
     .set noreorder
     li v0, __NR_getrusage
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getrusage
+END(getrusage)
diff --git a/libc/arch-mips64/syscalls/getsid.S b/libc/arch-mips64/syscalls/getsid.S
index 5fb9e1b..6fa362c 100644
--- a/libc/arch-mips64/syscalls/getsid.S
+++ b/libc/arch-mips64/syscalls/getsid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getsid
-    .align 4
-    .ent getsid
+#include <private/bionic_asm.h>
 
-getsid:
+ENTRY(getsid)
     .set push
     .set noreorder
     li v0, __NR_getsid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getsid
+END(getsid)
diff --git a/libc/arch-mips64/syscalls/getsockname.S b/libc/arch-mips64/syscalls/getsockname.S
index 44026bf..5e16aff 100644
--- a/libc/arch-mips64/syscalls/getsockname.S
+++ b/libc/arch-mips64/syscalls/getsockname.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getsockname
-    .align 4
-    .ent getsockname
+#include <private/bionic_asm.h>
 
-getsockname:
+ENTRY(getsockname)
     .set push
     .set noreorder
     li v0, __NR_getsockname
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getsockname
+END(getsockname)
diff --git a/libc/arch-mips64/syscalls/getsockopt.S b/libc/arch-mips64/syscalls/getsockopt.S
index 8493faa..fab05b1 100644
--- a/libc/arch-mips64/syscalls/getsockopt.S
+++ b/libc/arch-mips64/syscalls/getsockopt.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getsockopt
-    .align 4
-    .ent getsockopt
+#include <private/bionic_asm.h>
 
-getsockopt:
+ENTRY(getsockopt)
     .set push
     .set noreorder
     li v0, __NR_getsockopt
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getsockopt
+END(getsockopt)
diff --git a/libc/arch-mips64/syscalls/gettid.S b/libc/arch-mips64/syscalls/gettid.S
index e03bb4e..30c30c8 100644
--- a/libc/arch-mips64/syscalls/gettid.S
+++ b/libc/arch-mips64/syscalls/gettid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl gettid
-    .align 4
-    .ent gettid
+#include <private/bionic_asm.h>
 
-gettid:
+ENTRY(gettid)
     .set push
     .set noreorder
     li v0, __NR_gettid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end gettid
+END(gettid)
diff --git a/libc/arch-mips64/syscalls/gettimeofday.S b/libc/arch-mips64/syscalls/gettimeofday.S
index e1e5c04..07407a4 100644
--- a/libc/arch-mips64/syscalls/gettimeofday.S
+++ b/libc/arch-mips64/syscalls/gettimeofday.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl gettimeofday
-    .align 4
-    .ent gettimeofday
+#include <private/bionic_asm.h>
 
-gettimeofday:
+ENTRY(gettimeofday)
     .set push
     .set noreorder
     li v0, __NR_gettimeofday
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end gettimeofday
+END(gettimeofday)
diff --git a/libc/arch-mips64/syscalls/getuid.S b/libc/arch-mips64/syscalls/getuid.S
index e48f4a6..87c16e1 100644
--- a/libc/arch-mips64/syscalls/getuid.S
+++ b/libc/arch-mips64/syscalls/getuid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getuid
-    .align 4
-    .ent getuid
+#include <private/bionic_asm.h>
 
-getuid:
+ENTRY(getuid)
     .set push
     .set noreorder
     li v0, __NR_getuid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getuid
+END(getuid)
diff --git a/libc/arch-mips64/syscalls/getxattr.S b/libc/arch-mips64/syscalls/getxattr.S
index b46e4d9..b42ca1e 100644
--- a/libc/arch-mips64/syscalls/getxattr.S
+++ b/libc/arch-mips64/syscalls/getxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl getxattr
-    .align 4
-    .ent getxattr
+#include <private/bionic_asm.h>
 
-getxattr:
+ENTRY(getxattr)
     .set push
     .set noreorder
     li v0, __NR_getxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end getxattr
+END(getxattr)
diff --git a/libc/arch-mips64/syscalls/init_module.S b/libc/arch-mips64/syscalls/init_module.S
index c5b2bcf..90fb6b1 100644
--- a/libc/arch-mips64/syscalls/init_module.S
+++ b/libc/arch-mips64/syscalls/init_module.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl init_module
-    .align 4
-    .ent init_module
+#include <private/bionic_asm.h>
 
-init_module:
+ENTRY(init_module)
     .set push
     .set noreorder
     li v0, __NR_init_module
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end init_module
+END(init_module)
diff --git a/libc/arch-mips64/syscalls/inotify_add_watch.S b/libc/arch-mips64/syscalls/inotify_add_watch.S
index c4c8dbf..17db414 100644
--- a/libc/arch-mips64/syscalls/inotify_add_watch.S
+++ b/libc/arch-mips64/syscalls/inotify_add_watch.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl inotify_add_watch
-    .align 4
-    .ent inotify_add_watch
+#include <private/bionic_asm.h>
 
-inotify_add_watch:
+ENTRY(inotify_add_watch)
     .set push
     .set noreorder
     li v0, __NR_inotify_add_watch
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end inotify_add_watch
+END(inotify_add_watch)
diff --git a/libc/arch-mips64/syscalls/inotify_init1.S b/libc/arch-mips64/syscalls/inotify_init1.S
index b0c7dcc..356dd2d 100644
--- a/libc/arch-mips64/syscalls/inotify_init1.S
+++ b/libc/arch-mips64/syscalls/inotify_init1.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl inotify_init1
-    .align 4
-    .ent inotify_init1
+#include <private/bionic_asm.h>
 
-inotify_init1:
+ENTRY(inotify_init1)
     .set push
     .set noreorder
     li v0, __NR_inotify_init1
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end inotify_init1
+END(inotify_init1)
diff --git a/libc/arch-mips64/syscalls/inotify_rm_watch.S b/libc/arch-mips64/syscalls/inotify_rm_watch.S
index 4b6078e..4096ca3 100644
--- a/libc/arch-mips64/syscalls/inotify_rm_watch.S
+++ b/libc/arch-mips64/syscalls/inotify_rm_watch.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl inotify_rm_watch
-    .align 4
-    .ent inotify_rm_watch
+#include <private/bionic_asm.h>
 
-inotify_rm_watch:
+ENTRY(inotify_rm_watch)
     .set push
     .set noreorder
     li v0, __NR_inotify_rm_watch
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end inotify_rm_watch
+END(inotify_rm_watch)
diff --git a/libc/arch-mips64/syscalls/ioprio_get.S b/libc/arch-mips64/syscalls/ioprio_get.S
index ebb4375..711890c 100644
--- a/libc/arch-mips64/syscalls/ioprio_get.S
+++ b/libc/arch-mips64/syscalls/ioprio_get.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl ioprio_get
-    .align 4
-    .ent ioprio_get
+#include <private/bionic_asm.h>
 
-ioprio_get:
+ENTRY(ioprio_get)
     .set push
     .set noreorder
     li v0, __NR_ioprio_get
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end ioprio_get
+END(ioprio_get)
diff --git a/libc/arch-mips64/syscalls/ioprio_set.S b/libc/arch-mips64/syscalls/ioprio_set.S
index 44daba9..738403a 100644
--- a/libc/arch-mips64/syscalls/ioprio_set.S
+++ b/libc/arch-mips64/syscalls/ioprio_set.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl ioprio_set
-    .align 4
-    .ent ioprio_set
+#include <private/bionic_asm.h>
 
-ioprio_set:
+ENTRY(ioprio_set)
     .set push
     .set noreorder
     li v0, __NR_ioprio_set
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end ioprio_set
+END(ioprio_set)
diff --git a/libc/arch-mips64/syscalls/kill.S b/libc/arch-mips64/syscalls/kill.S
index 2e4aa42..2d8b452 100644
--- a/libc/arch-mips64/syscalls/kill.S
+++ b/libc/arch-mips64/syscalls/kill.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl kill
-    .align 4
-    .ent kill
+#include <private/bionic_asm.h>
 
-kill:
+ENTRY(kill)
     .set push
     .set noreorder
     li v0, __NR_kill
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end kill
+END(kill)
diff --git a/libc/arch-mips64/syscalls/klogctl.S b/libc/arch-mips64/syscalls/klogctl.S
index 1c10f95..2f9ca6a 100644
--- a/libc/arch-mips64/syscalls/klogctl.S
+++ b/libc/arch-mips64/syscalls/klogctl.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl klogctl
-    .align 4
-    .ent klogctl
+#include <private/bionic_asm.h>
 
-klogctl:
+ENTRY(klogctl)
     .set push
     .set noreorder
     li v0, __NR_syslog
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end klogctl
+END(klogctl)
diff --git a/libc/arch-mips64/syscalls/lgetxattr.S b/libc/arch-mips64/syscalls/lgetxattr.S
index c402e81..f8e57b3 100644
--- a/libc/arch-mips64/syscalls/lgetxattr.S
+++ b/libc/arch-mips64/syscalls/lgetxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl lgetxattr
-    .align 4
-    .ent lgetxattr
+#include <private/bionic_asm.h>
 
-lgetxattr:
+ENTRY(lgetxattr)
     .set push
     .set noreorder
     li v0, __NR_lgetxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end lgetxattr
+END(lgetxattr)
diff --git a/libc/arch-mips64/syscalls/linkat.S b/libc/arch-mips64/syscalls/linkat.S
index e734144..a866fa6 100644
--- a/libc/arch-mips64/syscalls/linkat.S
+++ b/libc/arch-mips64/syscalls/linkat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl linkat
-    .align 4
-    .ent linkat
+#include <private/bionic_asm.h>
 
-linkat:
+ENTRY(linkat)
     .set push
     .set noreorder
     li v0, __NR_linkat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end linkat
+END(linkat)
diff --git a/libc/arch-mips64/syscalls/listen.S b/libc/arch-mips64/syscalls/listen.S
index 93c1d52..0768c72 100644
--- a/libc/arch-mips64/syscalls/listen.S
+++ b/libc/arch-mips64/syscalls/listen.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl listen
-    .align 4
-    .ent listen
+#include <private/bionic_asm.h>
 
-listen:
+ENTRY(listen)
     .set push
     .set noreorder
     li v0, __NR_listen
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end listen
+END(listen)
diff --git a/libc/arch-mips64/syscalls/listxattr.S b/libc/arch-mips64/syscalls/listxattr.S
index f00402f..f2c00f6 100644
--- a/libc/arch-mips64/syscalls/listxattr.S
+++ b/libc/arch-mips64/syscalls/listxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl listxattr
-    .align 4
-    .ent listxattr
+#include <private/bionic_asm.h>
 
-listxattr:
+ENTRY(listxattr)
     .set push
     .set noreorder
     li v0, __NR_listxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end listxattr
+END(listxattr)
diff --git a/libc/arch-mips64/syscalls/llistxattr.S b/libc/arch-mips64/syscalls/llistxattr.S
index 2628185..f324e2c 100644
--- a/libc/arch-mips64/syscalls/llistxattr.S
+++ b/libc/arch-mips64/syscalls/llistxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl llistxattr
-    .align 4
-    .ent llistxattr
+#include <private/bionic_asm.h>
 
-llistxattr:
+ENTRY(llistxattr)
     .set push
     .set noreorder
     li v0, __NR_llistxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end llistxattr
+END(llistxattr)
diff --git a/libc/arch-mips64/syscalls/lremovexattr.S b/libc/arch-mips64/syscalls/lremovexattr.S
index ef486cb..e44c9d0 100644
--- a/libc/arch-mips64/syscalls/lremovexattr.S
+++ b/libc/arch-mips64/syscalls/lremovexattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl lremovexattr
-    .align 4
-    .ent lremovexattr
+#include <private/bionic_asm.h>
 
-lremovexattr:
+ENTRY(lremovexattr)
     .set push
     .set noreorder
     li v0, __NR_lremovexattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end lremovexattr
+END(lremovexattr)
diff --git a/libc/arch-mips64/syscalls/lseek.S b/libc/arch-mips64/syscalls/lseek.S
index 4385df5..2858aa8 100644
--- a/libc/arch-mips64/syscalls/lseek.S
+++ b/libc/arch-mips64/syscalls/lseek.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl lseek
-    .align 4
-    .ent lseek
+#include <private/bionic_asm.h>
 
-lseek:
+ENTRY(lseek)
     .set push
     .set noreorder
     li v0, __NR_lseek
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end lseek
+END(lseek)
 
     .globl lseek64
     .equ lseek64, lseek
diff --git a/libc/arch-mips64/syscalls/lsetxattr.S b/libc/arch-mips64/syscalls/lsetxattr.S
index 14a1aae..ed1b4df 100644
--- a/libc/arch-mips64/syscalls/lsetxattr.S
+++ b/libc/arch-mips64/syscalls/lsetxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl lsetxattr
-    .align 4
-    .ent lsetxattr
+#include <private/bionic_asm.h>
 
-lsetxattr:
+ENTRY(lsetxattr)
     .set push
     .set noreorder
     li v0, __NR_lsetxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end lsetxattr
+END(lsetxattr)
diff --git a/libc/arch-mips64/syscalls/madvise.S b/libc/arch-mips64/syscalls/madvise.S
index 8ca4124..fe6a828 100644
--- a/libc/arch-mips64/syscalls/madvise.S
+++ b/libc/arch-mips64/syscalls/madvise.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl madvise
-    .align 4
-    .ent madvise
+#include <private/bionic_asm.h>
 
-madvise:
+ENTRY(madvise)
     .set push
     .set noreorder
     li v0, __NR_madvise
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end madvise
+END(madvise)
diff --git a/libc/arch-mips64/syscalls/mincore.S b/libc/arch-mips64/syscalls/mincore.S
index 9dbd21c..1e0b544 100644
--- a/libc/arch-mips64/syscalls/mincore.S
+++ b/libc/arch-mips64/syscalls/mincore.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mincore
-    .align 4
-    .ent mincore
+#include <private/bionic_asm.h>
 
-mincore:
+ENTRY(mincore)
     .set push
     .set noreorder
     li v0, __NR_mincore
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mincore
+END(mincore)
diff --git a/libc/arch-mips64/syscalls/mkdirat.S b/libc/arch-mips64/syscalls/mkdirat.S
index e652b23..b1c94e1 100644
--- a/libc/arch-mips64/syscalls/mkdirat.S
+++ b/libc/arch-mips64/syscalls/mkdirat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mkdirat
-    .align 4
-    .ent mkdirat
+#include <private/bionic_asm.h>
 
-mkdirat:
+ENTRY(mkdirat)
     .set push
     .set noreorder
     li v0, __NR_mkdirat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mkdirat
+END(mkdirat)
diff --git a/libc/arch-mips64/syscalls/mknodat.S b/libc/arch-mips64/syscalls/mknodat.S
index 1cedbb4..edbd3b6 100644
--- a/libc/arch-mips64/syscalls/mknodat.S
+++ b/libc/arch-mips64/syscalls/mknodat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mknodat
-    .align 4
-    .ent mknodat
+#include <private/bionic_asm.h>
 
-mknodat:
+ENTRY(mknodat)
     .set push
     .set noreorder
     li v0, __NR_mknodat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mknodat
+END(mknodat)
diff --git a/libc/arch-mips64/syscalls/mlock.S b/libc/arch-mips64/syscalls/mlock.S
index 18ab4ba..ae599cd 100644
--- a/libc/arch-mips64/syscalls/mlock.S
+++ b/libc/arch-mips64/syscalls/mlock.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mlock
-    .align 4
-    .ent mlock
+#include <private/bionic_asm.h>
 
-mlock:
+ENTRY(mlock)
     .set push
     .set noreorder
     li v0, __NR_mlock
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mlock
+END(mlock)
diff --git a/libc/arch-mips64/syscalls/mlockall.S b/libc/arch-mips64/syscalls/mlockall.S
index 50fb23c..b214758 100644
--- a/libc/arch-mips64/syscalls/mlockall.S
+++ b/libc/arch-mips64/syscalls/mlockall.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mlockall
-    .align 4
-    .ent mlockall
+#include <private/bionic_asm.h>
 
-mlockall:
+ENTRY(mlockall)
     .set push
     .set noreorder
     li v0, __NR_mlockall
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mlockall
+END(mlockall)
diff --git a/libc/arch-mips64/syscalls/mmap.S b/libc/arch-mips64/syscalls/mmap.S
index 682058e..ba6d4fa 100644
--- a/libc/arch-mips64/syscalls/mmap.S
+++ b/libc/arch-mips64/syscalls/mmap.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mmap
-    .align 4
-    .ent mmap
+#include <private/bionic_asm.h>
 
-mmap:
+ENTRY(mmap)
     .set push
     .set noreorder
     li v0, __NR_mmap
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end mmap
+END(mmap)
 
     .globl mmap64
     .equ mmap64, mmap
diff --git a/libc/arch-mips64/syscalls/mount.S b/libc/arch-mips64/syscalls/mount.S
index 595585e..71e08a7 100644
--- a/libc/arch-mips64/syscalls/mount.S
+++ b/libc/arch-mips64/syscalls/mount.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mount
-    .align 4
-    .ent mount
+#include <private/bionic_asm.h>
 
-mount:
+ENTRY(mount)
     .set push
     .set noreorder
     li v0, __NR_mount
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mount
+END(mount)
diff --git a/libc/arch-mips64/syscalls/mprotect.S b/libc/arch-mips64/syscalls/mprotect.S
index 77d9207..66ffa1a 100644
--- a/libc/arch-mips64/syscalls/mprotect.S
+++ b/libc/arch-mips64/syscalls/mprotect.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mprotect
-    .align 4
-    .ent mprotect
+#include <private/bionic_asm.h>
 
-mprotect:
+ENTRY(mprotect)
     .set push
     .set noreorder
     li v0, __NR_mprotect
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mprotect
+END(mprotect)
diff --git a/libc/arch-mips64/syscalls/mremap.S b/libc/arch-mips64/syscalls/mremap.S
index 33be57f..c73320f 100644
--- a/libc/arch-mips64/syscalls/mremap.S
+++ b/libc/arch-mips64/syscalls/mremap.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl mremap
-    .align 4
-    .ent mremap
+#include <private/bionic_asm.h>
 
-mremap:
+ENTRY(mremap)
     .set push
     .set noreorder
     li v0, __NR_mremap
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end mremap
+END(mremap)
diff --git a/libc/arch-mips64/syscalls/msync.S b/libc/arch-mips64/syscalls/msync.S
index a5e29f6..a97cba8 100644
--- a/libc/arch-mips64/syscalls/msync.S
+++ b/libc/arch-mips64/syscalls/msync.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl msync
-    .align 4
-    .ent msync
+#include <private/bionic_asm.h>
 
-msync:
+ENTRY(msync)
     .set push
     .set noreorder
     li v0, __NR_msync
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end msync
+END(msync)
diff --git a/libc/arch-mips64/syscalls/munlock.S b/libc/arch-mips64/syscalls/munlock.S
index 4d9000a..f5919ae 100644
--- a/libc/arch-mips64/syscalls/munlock.S
+++ b/libc/arch-mips64/syscalls/munlock.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl munlock
-    .align 4
-    .ent munlock
+#include <private/bionic_asm.h>
 
-munlock:
+ENTRY(munlock)
     .set push
     .set noreorder
     li v0, __NR_munlock
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end munlock
+END(munlock)
diff --git a/libc/arch-mips64/syscalls/munlockall.S b/libc/arch-mips64/syscalls/munlockall.S
index f8a1ff4..39e717c 100644
--- a/libc/arch-mips64/syscalls/munlockall.S
+++ b/libc/arch-mips64/syscalls/munlockall.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl munlockall
-    .align 4
-    .ent munlockall
+#include <private/bionic_asm.h>
 
-munlockall:
+ENTRY(munlockall)
     .set push
     .set noreorder
     li v0, __NR_munlockall
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end munlockall
+END(munlockall)
diff --git a/libc/arch-mips64/syscalls/munmap.S b/libc/arch-mips64/syscalls/munmap.S
index a7e65a7..c1c9b01 100644
--- a/libc/arch-mips64/syscalls/munmap.S
+++ b/libc/arch-mips64/syscalls/munmap.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl munmap
-    .align 4
-    .ent munmap
+#include <private/bionic_asm.h>
 
-munmap:
+ENTRY(munmap)
     .set push
     .set noreorder
     li v0, __NR_munmap
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end munmap
+END(munmap)
diff --git a/libc/arch-mips64/syscalls/nanosleep.S b/libc/arch-mips64/syscalls/nanosleep.S
index a3838de..6bfd73e 100644
--- a/libc/arch-mips64/syscalls/nanosleep.S
+++ b/libc/arch-mips64/syscalls/nanosleep.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl nanosleep
-    .align 4
-    .ent nanosleep
+#include <private/bionic_asm.h>
 
-nanosleep:
+ENTRY(nanosleep)
     .set push
     .set noreorder
     li v0, __NR_nanosleep
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end nanosleep
+END(nanosleep)
diff --git a/libc/arch-mips64/syscalls/perf_event_open.S b/libc/arch-mips64/syscalls/perf_event_open.S
index 14465fb..d796a16 100644
--- a/libc/arch-mips64/syscalls/perf_event_open.S
+++ b/libc/arch-mips64/syscalls/perf_event_open.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl perf_event_open
-    .align 4
-    .ent perf_event_open
+#include <private/bionic_asm.h>
 
-perf_event_open:
+ENTRY(perf_event_open)
     .set push
     .set noreorder
     li v0, __NR_perf_event_open
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end perf_event_open
+END(perf_event_open)
diff --git a/libc/arch-mips64/syscalls/personality.S b/libc/arch-mips64/syscalls/personality.S
index af39ee6..e234636 100644
--- a/libc/arch-mips64/syscalls/personality.S
+++ b/libc/arch-mips64/syscalls/personality.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl personality
-    .align 4
-    .ent personality
+#include <private/bionic_asm.h>
 
-personality:
+ENTRY(personality)
     .set push
     .set noreorder
     li v0, __NR_personality
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end personality
+END(personality)
diff --git a/libc/arch-mips64/syscalls/pipe2.S b/libc/arch-mips64/syscalls/pipe2.S
index 4e06258..52d5baa 100644
--- a/libc/arch-mips64/syscalls/pipe2.S
+++ b/libc/arch-mips64/syscalls/pipe2.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl pipe2
-    .align 4
-    .ent pipe2
+#include <private/bionic_asm.h>
 
-pipe2:
+ENTRY(pipe2)
     .set push
     .set noreorder
     li v0, __NR_pipe2
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end pipe2
+END(pipe2)
diff --git a/libc/arch-mips64/syscalls/prctl.S b/libc/arch-mips64/syscalls/prctl.S
index 122a28e..01d422e 100644
--- a/libc/arch-mips64/syscalls/prctl.S
+++ b/libc/arch-mips64/syscalls/prctl.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl prctl
-    .align 4
-    .ent prctl
+#include <private/bionic_asm.h>
 
-prctl:
+ENTRY(prctl)
     .set push
     .set noreorder
     li v0, __NR_prctl
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end prctl
+END(prctl)
diff --git a/libc/arch-mips64/syscalls/pread64.S b/libc/arch-mips64/syscalls/pread64.S
index a97a1d4..5ab8389 100644
--- a/libc/arch-mips64/syscalls/pread64.S
+++ b/libc/arch-mips64/syscalls/pread64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl pread64
-    .align 4
-    .ent pread64
+#include <private/bionic_asm.h>
 
-pread64:
+ENTRY(pread64)
     .set push
     .set noreorder
     li v0, __NR_pread64
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end pread64
+END(pread64)
 
     .globl pread
     .equ pread, pread64
diff --git a/libc/arch-mips64/syscalls/prlimit64.S b/libc/arch-mips64/syscalls/prlimit64.S
index e611bd0..e52ca92 100644
--- a/libc/arch-mips64/syscalls/prlimit64.S
+++ b/libc/arch-mips64/syscalls/prlimit64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl prlimit64
-    .align 4
-    .ent prlimit64
+#include <private/bionic_asm.h>
 
-prlimit64:
+ENTRY(prlimit64)
     .set push
     .set noreorder
     li v0, __NR_prlimit64
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end prlimit64
+END(prlimit64)
 
     .globl prlimit
     .equ prlimit, prlimit64
diff --git a/libc/arch-mips64/syscalls/pwrite64.S b/libc/arch-mips64/syscalls/pwrite64.S
index 08af91b..8d7a8b5 100644
--- a/libc/arch-mips64/syscalls/pwrite64.S
+++ b/libc/arch-mips64/syscalls/pwrite64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl pwrite64
-    .align 4
-    .ent pwrite64
+#include <private/bionic_asm.h>
 
-pwrite64:
+ENTRY(pwrite64)
     .set push
     .set noreorder
     li v0, __NR_pwrite64
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end pwrite64
+END(pwrite64)
 
     .globl pwrite
     .equ pwrite, pwrite64
diff --git a/libc/arch-mips64/syscalls/read.S b/libc/arch-mips64/syscalls/read.S
index 4d8c51d..3f805ca 100644
--- a/libc/arch-mips64/syscalls/read.S
+++ b/libc/arch-mips64/syscalls/read.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl read
-    .align 4
-    .ent read
+#include <private/bionic_asm.h>
 
-read:
+ENTRY(read)
     .set push
     .set noreorder
     li v0, __NR_read
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end read
+END(read)
diff --git a/libc/arch-mips64/syscalls/readahead.S b/libc/arch-mips64/syscalls/readahead.S
index 5ab1dcb..8f5c8c6 100644
--- a/libc/arch-mips64/syscalls/readahead.S
+++ b/libc/arch-mips64/syscalls/readahead.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl readahead
-    .align 4
-    .ent readahead
+#include <private/bionic_asm.h>
 
-readahead:
+ENTRY(readahead)
     .set push
     .set noreorder
     li v0, __NR_readahead
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end readahead
+END(readahead)
diff --git a/libc/arch-mips64/syscalls/readlinkat.S b/libc/arch-mips64/syscalls/readlinkat.S
index 8e91dcf..1381c22 100644
--- a/libc/arch-mips64/syscalls/readlinkat.S
+++ b/libc/arch-mips64/syscalls/readlinkat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl readlinkat
-    .align 4
-    .ent readlinkat
+#include <private/bionic_asm.h>
 
-readlinkat:
+ENTRY(readlinkat)
     .set push
     .set noreorder
     li v0, __NR_readlinkat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end readlinkat
+END(readlinkat)
diff --git a/libc/arch-mips64/syscalls/readv.S b/libc/arch-mips64/syscalls/readv.S
index e248942..9c7afd5 100644
--- a/libc/arch-mips64/syscalls/readv.S
+++ b/libc/arch-mips64/syscalls/readv.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl readv
-    .align 4
-    .ent readv
+#include <private/bionic_asm.h>
 
-readv:
+ENTRY(readv)
     .set push
     .set noreorder
     li v0, __NR_readv
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end readv
+END(readv)
diff --git a/libc/arch-mips64/syscalls/recvfrom.S b/libc/arch-mips64/syscalls/recvfrom.S
index 818dc8e..d3911c6 100644
--- a/libc/arch-mips64/syscalls/recvfrom.S
+++ b/libc/arch-mips64/syscalls/recvfrom.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl recvfrom
-    .align 4
-    .ent recvfrom
+#include <private/bionic_asm.h>
 
-recvfrom:
+ENTRY(recvfrom)
     .set push
     .set noreorder
     li v0, __NR_recvfrom
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end recvfrom
+END(recvfrom)
diff --git a/libc/arch-mips64/syscalls/recvmsg.S b/libc/arch-mips64/syscalls/recvmsg.S
index 06d8826..21ec51d 100644
--- a/libc/arch-mips64/syscalls/recvmsg.S
+++ b/libc/arch-mips64/syscalls/recvmsg.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl recvmsg
-    .align 4
-    .ent recvmsg
+#include <private/bionic_asm.h>
 
-recvmsg:
+ENTRY(recvmsg)
     .set push
     .set noreorder
     li v0, __NR_recvmsg
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end recvmsg
+END(recvmsg)
diff --git a/libc/arch-mips64/syscalls/removexattr.S b/libc/arch-mips64/syscalls/removexattr.S
index 8b0d056..ea31771 100644
--- a/libc/arch-mips64/syscalls/removexattr.S
+++ b/libc/arch-mips64/syscalls/removexattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl removexattr
-    .align 4
-    .ent removexattr
+#include <private/bionic_asm.h>
 
-removexattr:
+ENTRY(removexattr)
     .set push
     .set noreorder
     li v0, __NR_removexattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end removexattr
+END(removexattr)
diff --git a/libc/arch-mips64/syscalls/renameat.S b/libc/arch-mips64/syscalls/renameat.S
index fdf24db..074a6a4 100644
--- a/libc/arch-mips64/syscalls/renameat.S
+++ b/libc/arch-mips64/syscalls/renameat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl renameat
-    .align 4
-    .ent renameat
+#include <private/bionic_asm.h>
 
-renameat:
+ENTRY(renameat)
     .set push
     .set noreorder
     li v0, __NR_renameat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end renameat
+END(renameat)
diff --git a/libc/arch-mips64/syscalls/sched_get_priority_max.S b/libc/arch-mips64/syscalls/sched_get_priority_max.S
index c84ab98..1b67bbf 100644
--- a/libc/arch-mips64/syscalls/sched_get_priority_max.S
+++ b/libc/arch-mips64/syscalls/sched_get_priority_max.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_get_priority_max
-    .align 4
-    .ent sched_get_priority_max
+#include <private/bionic_asm.h>
 
-sched_get_priority_max:
+ENTRY(sched_get_priority_max)
     .set push
     .set noreorder
     li v0, __NR_sched_get_priority_max
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_get_priority_max
+END(sched_get_priority_max)
diff --git a/libc/arch-mips64/syscalls/sched_get_priority_min.S b/libc/arch-mips64/syscalls/sched_get_priority_min.S
index d9ab4ec..2d68752 100644
--- a/libc/arch-mips64/syscalls/sched_get_priority_min.S
+++ b/libc/arch-mips64/syscalls/sched_get_priority_min.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_get_priority_min
-    .align 4
-    .ent sched_get_priority_min
+#include <private/bionic_asm.h>
 
-sched_get_priority_min:
+ENTRY(sched_get_priority_min)
     .set push
     .set noreorder
     li v0, __NR_sched_get_priority_min
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_get_priority_min
+END(sched_get_priority_min)
diff --git a/libc/arch-mips64/syscalls/sched_getparam.S b/libc/arch-mips64/syscalls/sched_getparam.S
index 9f40fe4..d0b2069 100644
--- a/libc/arch-mips64/syscalls/sched_getparam.S
+++ b/libc/arch-mips64/syscalls/sched_getparam.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_getparam
-    .align 4
-    .ent sched_getparam
+#include <private/bionic_asm.h>
 
-sched_getparam:
+ENTRY(sched_getparam)
     .set push
     .set noreorder
     li v0, __NR_sched_getparam
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_getparam
+END(sched_getparam)
diff --git a/libc/arch-mips64/syscalls/sched_getscheduler.S b/libc/arch-mips64/syscalls/sched_getscheduler.S
index e263f61..f25bde5 100644
--- a/libc/arch-mips64/syscalls/sched_getscheduler.S
+++ b/libc/arch-mips64/syscalls/sched_getscheduler.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_getscheduler
-    .align 4
-    .ent sched_getscheduler
+#include <private/bionic_asm.h>
 
-sched_getscheduler:
+ENTRY(sched_getscheduler)
     .set push
     .set noreorder
     li v0, __NR_sched_getscheduler
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_getscheduler
+END(sched_getscheduler)
diff --git a/libc/arch-mips64/syscalls/sched_rr_get_interval.S b/libc/arch-mips64/syscalls/sched_rr_get_interval.S
index a3bba28..48233f8 100644
--- a/libc/arch-mips64/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-mips64/syscalls/sched_rr_get_interval.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_rr_get_interval
-    .align 4
-    .ent sched_rr_get_interval
+#include <private/bionic_asm.h>
 
-sched_rr_get_interval:
+ENTRY(sched_rr_get_interval)
     .set push
     .set noreorder
     li v0, __NR_sched_rr_get_interval
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_rr_get_interval
+END(sched_rr_get_interval)
diff --git a/libc/arch-mips64/syscalls/sched_setaffinity.S b/libc/arch-mips64/syscalls/sched_setaffinity.S
index 35bfb30..e604863 100644
--- a/libc/arch-mips64/syscalls/sched_setaffinity.S
+++ b/libc/arch-mips64/syscalls/sched_setaffinity.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_setaffinity
-    .align 4
-    .ent sched_setaffinity
+#include <private/bionic_asm.h>
 
-sched_setaffinity:
+ENTRY(sched_setaffinity)
     .set push
     .set noreorder
     li v0, __NR_sched_setaffinity
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_setaffinity
+END(sched_setaffinity)
diff --git a/libc/arch-mips64/syscalls/sched_setparam.S b/libc/arch-mips64/syscalls/sched_setparam.S
index 714fcc9..b02439f 100644
--- a/libc/arch-mips64/syscalls/sched_setparam.S
+++ b/libc/arch-mips64/syscalls/sched_setparam.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_setparam
-    .align 4
-    .ent sched_setparam
+#include <private/bionic_asm.h>
 
-sched_setparam:
+ENTRY(sched_setparam)
     .set push
     .set noreorder
     li v0, __NR_sched_setparam
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_setparam
+END(sched_setparam)
diff --git a/libc/arch-mips64/syscalls/sched_setscheduler.S b/libc/arch-mips64/syscalls/sched_setscheduler.S
index 4fe5783..dda1ce5 100644
--- a/libc/arch-mips64/syscalls/sched_setscheduler.S
+++ b/libc/arch-mips64/syscalls/sched_setscheduler.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_setscheduler
-    .align 4
-    .ent sched_setscheduler
+#include <private/bionic_asm.h>
 
-sched_setscheduler:
+ENTRY(sched_setscheduler)
     .set push
     .set noreorder
     li v0, __NR_sched_setscheduler
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_setscheduler
+END(sched_setscheduler)
diff --git a/libc/arch-mips64/syscalls/sched_yield.S b/libc/arch-mips64/syscalls/sched_yield.S
index b2542a3..509b029 100644
--- a/libc/arch-mips64/syscalls/sched_yield.S
+++ b/libc/arch-mips64/syscalls/sched_yield.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sched_yield
-    .align 4
-    .ent sched_yield
+#include <private/bionic_asm.h>
 
-sched_yield:
+ENTRY(sched_yield)
     .set push
     .set noreorder
     li v0, __NR_sched_yield
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sched_yield
+END(sched_yield)
diff --git a/libc/arch-mips64/syscalls/sendfile.S b/libc/arch-mips64/syscalls/sendfile.S
index bce8d58..684a83a 100644
--- a/libc/arch-mips64/syscalls/sendfile.S
+++ b/libc/arch-mips64/syscalls/sendfile.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sendfile
-    .align 4
-    .ent sendfile
+#include <private/bionic_asm.h>
 
-sendfile:
+ENTRY(sendfile)
     .set push
     .set noreorder
     li v0, __NR_sendfile
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end sendfile
+END(sendfile)
 
     .globl sendfile64
     .equ sendfile64, sendfile
diff --git a/libc/arch-mips64/syscalls/sendmsg.S b/libc/arch-mips64/syscalls/sendmsg.S
index 72227f7..6983f9a 100644
--- a/libc/arch-mips64/syscalls/sendmsg.S
+++ b/libc/arch-mips64/syscalls/sendmsg.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sendmsg
-    .align 4
-    .ent sendmsg
+#include <private/bionic_asm.h>
 
-sendmsg:
+ENTRY(sendmsg)
     .set push
     .set noreorder
     li v0, __NR_sendmsg
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sendmsg
+END(sendmsg)
diff --git a/libc/arch-mips64/syscalls/sendto.S b/libc/arch-mips64/syscalls/sendto.S
index dbb4c56..cfe774d 100644
--- a/libc/arch-mips64/syscalls/sendto.S
+++ b/libc/arch-mips64/syscalls/sendto.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sendto
-    .align 4
-    .ent sendto
+#include <private/bionic_asm.h>
 
-sendto:
+ENTRY(sendto)
     .set push
     .set noreorder
     li v0, __NR_sendto
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sendto
+END(sendto)
diff --git a/libc/arch-mips64/syscalls/setgid.S b/libc/arch-mips64/syscalls/setgid.S
index 3d9b5d4..cc8d3ab 100644
--- a/libc/arch-mips64/syscalls/setgid.S
+++ b/libc/arch-mips64/syscalls/setgid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setgid
-    .align 4
-    .ent setgid
+#include <private/bionic_asm.h>
 
-setgid:
+ENTRY(setgid)
     .set push
     .set noreorder
     li v0, __NR_setgid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setgid
+END(setgid)
diff --git a/libc/arch-mips64/syscalls/setgroups.S b/libc/arch-mips64/syscalls/setgroups.S
index c4dc713..63f2329 100644
--- a/libc/arch-mips64/syscalls/setgroups.S
+++ b/libc/arch-mips64/syscalls/setgroups.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setgroups
-    .align 4
-    .ent setgroups
+#include <private/bionic_asm.h>
 
-setgroups:
+ENTRY(setgroups)
     .set push
     .set noreorder
     li v0, __NR_setgroups
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setgroups
+END(setgroups)
diff --git a/libc/arch-mips64/syscalls/setitimer.S b/libc/arch-mips64/syscalls/setitimer.S
index b1969d0..9ee02dc 100644
--- a/libc/arch-mips64/syscalls/setitimer.S
+++ b/libc/arch-mips64/syscalls/setitimer.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setitimer
-    .align 4
-    .ent setitimer
+#include <private/bionic_asm.h>
 
-setitimer:
+ENTRY(setitimer)
     .set push
     .set noreorder
     li v0, __NR_setitimer
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setitimer
+END(setitimer)
diff --git a/libc/arch-mips64/syscalls/setns.S b/libc/arch-mips64/syscalls/setns.S
index 3073aad..191a1a0 100644
--- a/libc/arch-mips64/syscalls/setns.S
+++ b/libc/arch-mips64/syscalls/setns.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setns
-    .align 4
-    .ent setns
+#include <private/bionic_asm.h>
 
-setns:
+ENTRY(setns)
     .set push
     .set noreorder
     li v0, __NR_setns
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setns
+END(setns)
diff --git a/libc/arch-mips64/syscalls/setpgid.S b/libc/arch-mips64/syscalls/setpgid.S
index 171ed17..8972160 100644
--- a/libc/arch-mips64/syscalls/setpgid.S
+++ b/libc/arch-mips64/syscalls/setpgid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setpgid
-    .align 4
-    .ent setpgid
+#include <private/bionic_asm.h>
 
-setpgid:
+ENTRY(setpgid)
     .set push
     .set noreorder
     li v0, __NR_setpgid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setpgid
+END(setpgid)
diff --git a/libc/arch-mips64/syscalls/setpriority.S b/libc/arch-mips64/syscalls/setpriority.S
index a73c155..dce3a76 100644
--- a/libc/arch-mips64/syscalls/setpriority.S
+++ b/libc/arch-mips64/syscalls/setpriority.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setpriority
-    .align 4
-    .ent setpriority
+#include <private/bionic_asm.h>
 
-setpriority:
+ENTRY(setpriority)
     .set push
     .set noreorder
     li v0, __NR_setpriority
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setpriority
+END(setpriority)
diff --git a/libc/arch-mips64/syscalls/setregid.S b/libc/arch-mips64/syscalls/setregid.S
index 14217ba..d677b32 100644
--- a/libc/arch-mips64/syscalls/setregid.S
+++ b/libc/arch-mips64/syscalls/setregid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setregid
-    .align 4
-    .ent setregid
+#include <private/bionic_asm.h>
 
-setregid:
+ENTRY(setregid)
     .set push
     .set noreorder
     li v0, __NR_setregid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setregid
+END(setregid)
diff --git a/libc/arch-mips64/syscalls/setresgid.S b/libc/arch-mips64/syscalls/setresgid.S
index 9e35dde..312eb3a 100644
--- a/libc/arch-mips64/syscalls/setresgid.S
+++ b/libc/arch-mips64/syscalls/setresgid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setresgid
-    .align 4
-    .ent setresgid
+#include <private/bionic_asm.h>
 
-setresgid:
+ENTRY(setresgid)
     .set push
     .set noreorder
     li v0, __NR_setresgid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setresgid
+END(setresgid)
diff --git a/libc/arch-mips64/syscalls/setresuid.S b/libc/arch-mips64/syscalls/setresuid.S
index fdd28a9..4da79d0 100644
--- a/libc/arch-mips64/syscalls/setresuid.S
+++ b/libc/arch-mips64/syscalls/setresuid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setresuid
-    .align 4
-    .ent setresuid
+#include <private/bionic_asm.h>
 
-setresuid:
+ENTRY(setresuid)
     .set push
     .set noreorder
     li v0, __NR_setresuid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setresuid
+END(setresuid)
diff --git a/libc/arch-mips64/syscalls/setreuid.S b/libc/arch-mips64/syscalls/setreuid.S
index db50c6c..33f6fce 100644
--- a/libc/arch-mips64/syscalls/setreuid.S
+++ b/libc/arch-mips64/syscalls/setreuid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setreuid
-    .align 4
-    .ent setreuid
+#include <private/bionic_asm.h>
 
-setreuid:
+ENTRY(setreuid)
     .set push
     .set noreorder
     li v0, __NR_setreuid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setreuid
+END(setreuid)
diff --git a/libc/arch-mips64/syscalls/setrlimit.S b/libc/arch-mips64/syscalls/setrlimit.S
index 9ed0024..3060298 100644
--- a/libc/arch-mips64/syscalls/setrlimit.S
+++ b/libc/arch-mips64/syscalls/setrlimit.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setrlimit
-    .align 4
-    .ent setrlimit
+#include <private/bionic_asm.h>
 
-setrlimit:
+ENTRY(setrlimit)
     .set push
     .set noreorder
     li v0, __NR_setrlimit
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end setrlimit
+END(setrlimit)
 
     .globl setrlimit64
     .equ setrlimit64, setrlimit
diff --git a/libc/arch-mips64/syscalls/setsid.S b/libc/arch-mips64/syscalls/setsid.S
index b1b340f..c8d1ad5 100644
--- a/libc/arch-mips64/syscalls/setsid.S
+++ b/libc/arch-mips64/syscalls/setsid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setsid
-    .align 4
-    .ent setsid
+#include <private/bionic_asm.h>
 
-setsid:
+ENTRY(setsid)
     .set push
     .set noreorder
     li v0, __NR_setsid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setsid
+END(setsid)
diff --git a/libc/arch-mips64/syscalls/setsockopt.S b/libc/arch-mips64/syscalls/setsockopt.S
index 55cce5f..b40aad1 100644
--- a/libc/arch-mips64/syscalls/setsockopt.S
+++ b/libc/arch-mips64/syscalls/setsockopt.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setsockopt
-    .align 4
-    .ent setsockopt
+#include <private/bionic_asm.h>
 
-setsockopt:
+ENTRY(setsockopt)
     .set push
     .set noreorder
     li v0, __NR_setsockopt
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setsockopt
+END(setsockopt)
diff --git a/libc/arch-mips64/syscalls/settimeofday.S b/libc/arch-mips64/syscalls/settimeofday.S
index 72802e2..2e333f8 100644
--- a/libc/arch-mips64/syscalls/settimeofday.S
+++ b/libc/arch-mips64/syscalls/settimeofday.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl settimeofday
-    .align 4
-    .ent settimeofday
+#include <private/bionic_asm.h>
 
-settimeofday:
+ENTRY(settimeofday)
     .set push
     .set noreorder
     li v0, __NR_settimeofday
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end settimeofday
+END(settimeofday)
diff --git a/libc/arch-mips64/syscalls/setuid.S b/libc/arch-mips64/syscalls/setuid.S
index d8edd22..fb8125e 100644
--- a/libc/arch-mips64/syscalls/setuid.S
+++ b/libc/arch-mips64/syscalls/setuid.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setuid
-    .align 4
-    .ent setuid
+#include <private/bionic_asm.h>
 
-setuid:
+ENTRY(setuid)
     .set push
     .set noreorder
     li v0, __NR_setuid
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setuid
+END(setuid)
diff --git a/libc/arch-mips64/syscalls/setxattr.S b/libc/arch-mips64/syscalls/setxattr.S
index 9ccc378..04e746d 100644
--- a/libc/arch-mips64/syscalls/setxattr.S
+++ b/libc/arch-mips64/syscalls/setxattr.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl setxattr
-    .align 4
-    .ent setxattr
+#include <private/bionic_asm.h>
 
-setxattr:
+ENTRY(setxattr)
     .set push
     .set noreorder
     li v0, __NR_setxattr
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end setxattr
+END(setxattr)
diff --git a/libc/arch-mips64/syscalls/shutdown.S b/libc/arch-mips64/syscalls/shutdown.S
index 335ed41..59f437a 100644
--- a/libc/arch-mips64/syscalls/shutdown.S
+++ b/libc/arch-mips64/syscalls/shutdown.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl shutdown
-    .align 4
-    .ent shutdown
+#include <private/bionic_asm.h>
 
-shutdown:
+ENTRY(shutdown)
     .set push
     .set noreorder
     li v0, __NR_shutdown
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end shutdown
+END(shutdown)
diff --git a/libc/arch-mips64/syscalls/sigaltstack.S b/libc/arch-mips64/syscalls/sigaltstack.S
index 3458b11..0fbd3a1 100644
--- a/libc/arch-mips64/syscalls/sigaltstack.S
+++ b/libc/arch-mips64/syscalls/sigaltstack.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sigaltstack
-    .align 4
-    .ent sigaltstack
+#include <private/bionic_asm.h>
 
-sigaltstack:
+ENTRY(sigaltstack)
     .set push
     .set noreorder
     li v0, __NR_sigaltstack
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sigaltstack
+END(sigaltstack)
diff --git a/libc/arch-mips64/syscalls/signalfd4.S b/libc/arch-mips64/syscalls/signalfd4.S
index ef1d1e5..594c73d 100644
--- a/libc/arch-mips64/syscalls/signalfd4.S
+++ b/libc/arch-mips64/syscalls/signalfd4.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl signalfd4
-    .align 4
-    .ent signalfd4
+#include <private/bionic_asm.h>
 
-signalfd4:
+ENTRY(signalfd4)
     .set push
     .set noreorder
     li v0, __NR_signalfd4
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end signalfd4
+END(signalfd4)
diff --git a/libc/arch-mips64/syscalls/socket.S b/libc/arch-mips64/syscalls/socket.S
index 6b042c2..2020e2e 100644
--- a/libc/arch-mips64/syscalls/socket.S
+++ b/libc/arch-mips64/syscalls/socket.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl socket
-    .align 4
-    .ent socket
+#include <private/bionic_asm.h>
 
-socket:
+ENTRY(socket)
     .set push
     .set noreorder
     li v0, __NR_socket
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end socket
+END(socket)
diff --git a/libc/arch-mips64/syscalls/socketpair.S b/libc/arch-mips64/syscalls/socketpair.S
index b4ca8f4..fa684d1 100644
--- a/libc/arch-mips64/syscalls/socketpair.S
+++ b/libc/arch-mips64/syscalls/socketpair.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl socketpair
-    .align 4
-    .ent socketpair
+#include <private/bionic_asm.h>
 
-socketpair:
+ENTRY(socketpair)
     .set push
     .set noreorder
     li v0, __NR_socketpair
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end socketpair
+END(socketpair)
diff --git a/libc/arch-mips64/syscalls/statfs64.S b/libc/arch-mips64/syscalls/statfs64.S
index accd715..e835e41 100644
--- a/libc/arch-mips64/syscalls/statfs64.S
+++ b/libc/arch-mips64/syscalls/statfs64.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl statfs64
-    .align 4
-    .ent statfs64
+#include <private/bionic_asm.h>
 
-statfs64:
+ENTRY(statfs64)
     .set push
     .set noreorder
     li v0, __NR_statfs
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end statfs64
+END(statfs64)
 
     .globl statfs
     .equ statfs, statfs64
diff --git a/libc/arch-mips64/syscalls/swapoff.S b/libc/arch-mips64/syscalls/swapoff.S
index 8041188..dfaf185 100644
--- a/libc/arch-mips64/syscalls/swapoff.S
+++ b/libc/arch-mips64/syscalls/swapoff.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl swapoff
-    .align 4
-    .ent swapoff
+#include <private/bionic_asm.h>
 
-swapoff:
+ENTRY(swapoff)
     .set push
     .set noreorder
     li v0, __NR_swapoff
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end swapoff
+END(swapoff)
diff --git a/libc/arch-mips64/syscalls/swapon.S b/libc/arch-mips64/syscalls/swapon.S
index 5c24d7c..8e844c4 100644
--- a/libc/arch-mips64/syscalls/swapon.S
+++ b/libc/arch-mips64/syscalls/swapon.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl swapon
-    .align 4
-    .ent swapon
+#include <private/bionic_asm.h>
 
-swapon:
+ENTRY(swapon)
     .set push
     .set noreorder
     li v0, __NR_swapon
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end swapon
+END(swapon)
diff --git a/libc/arch-mips64/syscalls/symlinkat.S b/libc/arch-mips64/syscalls/symlinkat.S
index ce86d86..e43d597 100644
--- a/libc/arch-mips64/syscalls/symlinkat.S
+++ b/libc/arch-mips64/syscalls/symlinkat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl symlinkat
-    .align 4
-    .ent symlinkat
+#include <private/bionic_asm.h>
 
-symlinkat:
+ENTRY(symlinkat)
     .set push
     .set noreorder
     li v0, __NR_symlinkat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end symlinkat
+END(symlinkat)
diff --git a/libc/arch-mips64/syscalls/sync.S b/libc/arch-mips64/syscalls/sync.S
index e0787bd..ec342a3 100644
--- a/libc/arch-mips64/syscalls/sync.S
+++ b/libc/arch-mips64/syscalls/sync.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sync
-    .align 4
-    .ent sync
+#include <private/bionic_asm.h>
 
-sync:
+ENTRY(sync)
     .set push
     .set noreorder
     li v0, __NR_sync
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sync
+END(sync)
diff --git a/libc/arch-mips64/syscalls/sysinfo.S b/libc/arch-mips64/syscalls/sysinfo.S
index 19ad141..16486fd 100644
--- a/libc/arch-mips64/syscalls/sysinfo.S
+++ b/libc/arch-mips64/syscalls/sysinfo.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl sysinfo
-    .align 4
-    .ent sysinfo
+#include <private/bionic_asm.h>
 
-sysinfo:
+ENTRY(sysinfo)
     .set push
     .set noreorder
     li v0, __NR_sysinfo
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end sysinfo
+END(sysinfo)
diff --git a/libc/arch-mips64/syscalls/tgkill.S b/libc/arch-mips64/syscalls/tgkill.S
index 1a8fe79..d98d9ae 100644
--- a/libc/arch-mips64/syscalls/tgkill.S
+++ b/libc/arch-mips64/syscalls/tgkill.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl tgkill
-    .align 4
-    .ent tgkill
+#include <private/bionic_asm.h>
 
-tgkill:
+ENTRY(tgkill)
     .set push
     .set noreorder
     li v0, __NR_tgkill
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end tgkill
+END(tgkill)
diff --git a/libc/arch-mips64/syscalls/timerfd_create.S b/libc/arch-mips64/syscalls/timerfd_create.S
index 63e8b00..ab8e9e0 100644
--- a/libc/arch-mips64/syscalls/timerfd_create.S
+++ b/libc/arch-mips64/syscalls/timerfd_create.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl timerfd_create
-    .align 4
-    .ent timerfd_create
+#include <private/bionic_asm.h>
 
-timerfd_create:
+ENTRY(timerfd_create)
     .set push
     .set noreorder
     li v0, __NR_timerfd_create
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end timerfd_create
+END(timerfd_create)
diff --git a/libc/arch-mips64/syscalls/timerfd_gettime.S b/libc/arch-mips64/syscalls/timerfd_gettime.S
index 2afe6f1..2ec7b9c 100644
--- a/libc/arch-mips64/syscalls/timerfd_gettime.S
+++ b/libc/arch-mips64/syscalls/timerfd_gettime.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl timerfd_gettime
-    .align 4
-    .ent timerfd_gettime
+#include <private/bionic_asm.h>
 
-timerfd_gettime:
+ENTRY(timerfd_gettime)
     .set push
     .set noreorder
     li v0, __NR_timerfd_gettime
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end timerfd_gettime
+END(timerfd_gettime)
diff --git a/libc/arch-mips64/syscalls/timerfd_settime.S b/libc/arch-mips64/syscalls/timerfd_settime.S
index 40ce07d..0aec09f 100644
--- a/libc/arch-mips64/syscalls/timerfd_settime.S
+++ b/libc/arch-mips64/syscalls/timerfd_settime.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl timerfd_settime
-    .align 4
-    .ent timerfd_settime
+#include <private/bionic_asm.h>
 
-timerfd_settime:
+ENTRY(timerfd_settime)
     .set push
     .set noreorder
     li v0, __NR_timerfd_settime
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end timerfd_settime
+END(timerfd_settime)
diff --git a/libc/arch-mips64/syscalls/times.S b/libc/arch-mips64/syscalls/times.S
index ccbdbf4..2457e0c 100644
--- a/libc/arch-mips64/syscalls/times.S
+++ b/libc/arch-mips64/syscalls/times.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl times
-    .align 4
-    .ent times
+#include <private/bionic_asm.h>
 
-times:
+ENTRY(times)
     .set push
     .set noreorder
     li v0, __NR_times
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end times
+END(times)
diff --git a/libc/arch-mips64/syscalls/tkill.S b/libc/arch-mips64/syscalls/tkill.S
index 8caa695..14d6903 100644
--- a/libc/arch-mips64/syscalls/tkill.S
+++ b/libc/arch-mips64/syscalls/tkill.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl tkill
-    .align 4
-    .ent tkill
+#include <private/bionic_asm.h>
 
-tkill:
+ENTRY(tkill)
     .set push
     .set noreorder
     li v0, __NR_tkill
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end tkill
+END(tkill)
diff --git a/libc/arch-mips64/syscalls/truncate.S b/libc/arch-mips64/syscalls/truncate.S
index a79cdcd..a0cbe51 100644
--- a/libc/arch-mips64/syscalls/truncate.S
+++ b/libc/arch-mips64/syscalls/truncate.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl truncate
-    .align 4
-    .ent truncate
+#include <private/bionic_asm.h>
 
-truncate:
+ENTRY(truncate)
     .set push
     .set noreorder
     li v0, __NR_truncate
@@ -28,7 +22,7 @@
     j t9
     move ra, t0
     .set pop
-    .end truncate
+END(truncate)
 
     .globl truncate64
     .equ truncate64, truncate
diff --git a/libc/arch-mips64/syscalls/umask.S b/libc/arch-mips64/syscalls/umask.S
index 168ff9c..33624d2 100644
--- a/libc/arch-mips64/syscalls/umask.S
+++ b/libc/arch-mips64/syscalls/umask.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl umask
-    .align 4
-    .ent umask
+#include <private/bionic_asm.h>
 
-umask:
+ENTRY(umask)
     .set push
     .set noreorder
     li v0, __NR_umask
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end umask
+END(umask)
diff --git a/libc/arch-mips64/syscalls/umount2.S b/libc/arch-mips64/syscalls/umount2.S
index db80fa8..6193459 100644
--- a/libc/arch-mips64/syscalls/umount2.S
+++ b/libc/arch-mips64/syscalls/umount2.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl umount2
-    .align 4
-    .ent umount2
+#include <private/bionic_asm.h>
 
-umount2:
+ENTRY(umount2)
     .set push
     .set noreorder
     li v0, __NR_umount2
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end umount2
+END(umount2)
diff --git a/libc/arch-mips64/syscalls/uname.S b/libc/arch-mips64/syscalls/uname.S
index 417ecb0..df50f45 100644
--- a/libc/arch-mips64/syscalls/uname.S
+++ b/libc/arch-mips64/syscalls/uname.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl uname
-    .align 4
-    .ent uname
+#include <private/bionic_asm.h>
 
-uname:
+ENTRY(uname)
     .set push
     .set noreorder
     li v0, __NR_uname
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end uname
+END(uname)
diff --git a/libc/arch-mips64/syscalls/unlinkat.S b/libc/arch-mips64/syscalls/unlinkat.S
index e533bc3..29d4442 100644
--- a/libc/arch-mips64/syscalls/unlinkat.S
+++ b/libc/arch-mips64/syscalls/unlinkat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl unlinkat
-    .align 4
-    .ent unlinkat
+#include <private/bionic_asm.h>
 
-unlinkat:
+ENTRY(unlinkat)
     .set push
     .set noreorder
     li v0, __NR_unlinkat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end unlinkat
+END(unlinkat)
diff --git a/libc/arch-mips64/syscalls/unshare.S b/libc/arch-mips64/syscalls/unshare.S
index 4a19745..6d8fbf3 100644
--- a/libc/arch-mips64/syscalls/unshare.S
+++ b/libc/arch-mips64/syscalls/unshare.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl unshare
-    .align 4
-    .ent unshare
+#include <private/bionic_asm.h>
 
-unshare:
+ENTRY(unshare)
     .set push
     .set noreorder
     li v0, __NR_unshare
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end unshare
+END(unshare)
diff --git a/libc/arch-mips64/syscalls/utimensat.S b/libc/arch-mips64/syscalls/utimensat.S
index 1cde60d..654b8a4 100644
--- a/libc/arch-mips64/syscalls/utimensat.S
+++ b/libc/arch-mips64/syscalls/utimensat.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl utimensat
-    .align 4
-    .ent utimensat
+#include <private/bionic_asm.h>
 
-utimensat:
+ENTRY(utimensat)
     .set push
     .set noreorder
     li v0, __NR_utimensat
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end utimensat
+END(utimensat)
diff --git a/libc/arch-mips64/syscalls/wait4.S b/libc/arch-mips64/syscalls/wait4.S
index 14abeeb..e3755b5 100644
--- a/libc/arch-mips64/syscalls/wait4.S
+++ b/libc/arch-mips64/syscalls/wait4.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl wait4
-    .align 4
-    .ent wait4
+#include <private/bionic_asm.h>
 
-wait4:
+ENTRY(wait4)
     .set push
     .set noreorder
     li v0, __NR_wait4
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end wait4
+END(wait4)
diff --git a/libc/arch-mips64/syscalls/write.S b/libc/arch-mips64/syscalls/write.S
index f58f25d..ce7f702 100644
--- a/libc/arch-mips64/syscalls/write.S
+++ b/libc/arch-mips64/syscalls/write.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl write
-    .align 4
-    .ent write
+#include <private/bionic_asm.h>
 
-write:
+ENTRY(write)
     .set push
     .set noreorder
     li v0, __NR_write
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end write
+END(write)
diff --git a/libc/arch-mips64/syscalls/writev.S b/libc/arch-mips64/syscalls/writev.S
index a716c78..e2c7875 100644
--- a/libc/arch-mips64/syscalls/writev.S
+++ b/libc/arch-mips64/syscalls/writev.S
@@ -1,14 +1,8 @@
 /* Generated by gensyscalls.py. Do not edit. */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl writev
-    .align 4
-    .ent writev
+#include <private/bionic_asm.h>
 
-writev:
+ENTRY(writev)
     .set push
     .set noreorder
     li v0, __NR_writev
@@ -28,4 +22,4 @@
     j t9
     move ra, t0
     .set pop
-    .end writev
+END(writev)
diff --git a/libc/arch-x86/bionic/__bionic_clone.S b/libc/arch-x86/bionic/__bionic_clone.S
index 3823ecc..e6ddaaa 100644
--- a/libc/arch-x86/bionic/__bionic_clone.S
+++ b/libc/arch-x86/bionic/__bionic_clone.S
@@ -1,5 +1,4 @@
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 // pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
 ENTRY(__bionic_clone)
diff --git a/libc/arch-x86/bionic/__get_sp.S b/libc/arch-x86/bionic/__get_sp.S
index 0739d79..31ec6bc 100644
--- a/libc/arch-x86/bionic/__get_sp.S
+++ b/libc/arch-x86/bionic/__get_sp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(__get_sp)
   mov  %esp, %eax
diff --git a/libc/arch-x86/bionic/_setjmp.S b/libc/arch-x86/bionic/_setjmp.S
index 9221138..0b256a2 100644
--- a/libc/arch-x86/bionic/_setjmp.S
+++ b/libc/arch-x86/bionic/_setjmp.S
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * C library -- _setjmp, _longjmp
diff --git a/libc/arch-x86/bionic/setjmp.S b/libc/arch-x86/bionic/setjmp.S
index c0df647..5b94311 100644
--- a/libc/arch-x86/bionic/setjmp.S
+++ b/libc/arch-x86/bionic/setjmp.S
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * C library -- setjmp, longjmp
@@ -47,9 +47,9 @@
 	PIC_PROLOGUE
 	pushl	$0
 #ifdef PIC
-	call	PIC_PLT(_C_LABEL(sigblock))
+	call	PIC_PLT(sigblock)
 #else
-	call	_C_LABEL(sigblock)
+	call	sigblock
 #endif
 	addl	$4,%esp
 	PIC_EPILOGUE
@@ -72,9 +72,9 @@
 	PIC_PROLOGUE
 	pushl	24(%edx)
 #ifdef PIC
-	call	PIC_PLT(_C_LABEL(sigsetmask))
+	call	PIC_PLT(sigsetmask)
 #else
-	call	_C_LABEL(sigsetmask)
+	call	sigsetmask
 #endif
 	addl	$4,%esp
 	PIC_EPILOGUE
diff --git a/libc/arch-x86/bionic/sigsetjmp.S b/libc/arch-x86/bionic/sigsetjmp.S
index 70cc6db..7ef732e 100644
--- a/libc/arch-x86/bionic/sigsetjmp.S
+++ b/libc/arch-x86/bionic/sigsetjmp.S
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(sigsetjmp)
 	movl	4(%esp),%ecx
@@ -43,9 +43,9 @@
 	PIC_PROLOGUE
 	pushl	$0
 #ifdef PIC
-	call	PIC_PLT(_C_LABEL(sigblock))
+	call	PIC_PLT(sigblock)
 #else
-	call	_C_LABEL(sigblock)
+	call	sigblock
 #endif
 	addl	$4,%esp
 	PIC_EPILOGUE
@@ -71,9 +71,9 @@
 	PIC_PROLOGUE
 	pushl	24(%edx)
 #ifdef PIC
-	call	PIC_PLT(_C_LABEL(sigsetmask))
+	call	PIC_PLT(sigsetmask)
 #else
-	call	_C_LABEL(sigsetmask)
+	call	sigsetmask
 #endif
 	addl	$4,%esp
 	PIC_EPILOGUE
diff --git a/libc/arch-x86/include/machine/asm.h b/libc/arch-x86/include/machine/asm.h
index 5ccf78f..913e6c8 100644
--- a/libc/arch-x86/include/machine/asm.h
+++ b/libc/arch-x86/include/machine/asm.h
@@ -37,10 +37,6 @@
 #ifndef _I386_ASM_H_
 #define _I386_ASM_H_
 
-#ifdef _KERNEL_OPT
-#include "opt_multiprocessor.h"
-#endif
-
 #ifdef PIC
 #define PIC_PROLOGUE	\
 	pushl	%ebx;	\
@@ -61,27 +57,6 @@
 #define PIC_GOTOFF(x)	x
 #endif
 
-#ifdef __ELF__
-# define _C_LABEL(x)	x
-#else
-# ifdef __STDC__
-#  define _C_LABEL(x)	_ ## x
-# else
-#  define _C_LABEL(x)	_/**/x
-# endif
-#endif
-#define	_ASM_LABEL(x)	x
-
-#define CVAROFF(x, y)		_C_LABEL(x) + y
-
-#ifdef __STDC__
-# define __CONCAT(x,y)	x ## y
-# define __STRING(x)	#x
-#else
-# define __CONCAT(x,y)	x/**/y
-# define __STRING(x)	"x"
-#endif
-
 /* let kernels and others override entrypoint alignment */
 #if !defined(_ALIGN_TEXT) && !defined(_KERNEL)
 # ifdef _STANDALONE
@@ -93,126 +68,4 @@
 # endif
 #endif
 
-#define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
-#define _LABEL(x) \
-	.globl x; x:
-
-#ifdef _KERNEL
-
-#define CPUVAR(off) %fs:__CONCAT(CPU_INFO_,off)
-
-/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */
-#ifdef __ELF__
-#ifdef __STDC__
-#define	IDTVEC(name) \
-	ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
-#define	IDTVEC_END(name) \
-	.size X ## name, . - X ## name
-#else 
-#define	IDTVEC(name) \
-	ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
-#define	IDTVEC_END(name) \
-	.size X/**/name, . - X/**/name
-#endif /* __STDC__ */ 
-#else 
-#ifdef __STDC__
-#define	IDTVEC(name) \
-	ALIGN_TEXT; .globl _X ## name; .type _X ## name,@function; _X ## name: 
-#define	IDTVEC_END(name) \
-	.size _X ## name, . - _X ## name
-#else
-#define	IDTVEC(name) \
-	ALIGN_TEXT; .globl _X/**/name; .type _X/**/name,@function; _X/**/name:
-#define	IDTVEC_END(name) \
-	.size _X/**/name, . - _X/**/name
-#endif /* __STDC__ */
-#endif /* __ELF__ */
-
-#ifdef _STANDALONE
-#define ALIGN_DATA	.align	4
-#define ALIGN_TEXT	.align	4	/* 4-byte boundaries */
-#define SUPERALIGN_TEXT	.align	16	/* 15-byte boundaries */
-#elif defined __ELF__
-#define ALIGN_DATA	.align	4
-#define ALIGN_TEXT	.align	16	/* 16-byte boundaries */
-#define SUPERALIGN_TEXT	.align	16	/* 16-byte boundaries */
-#else
-#define ALIGN_DATA	.align	2
-#define ALIGN_TEXT	.align	4	/* 16-byte boundaries */
-#define SUPERALIGN_TEXT	.align	4	/* 16-byte boundaries */
-#endif /* __ELF__ */
-
-#define _ALIGN_TEXT ALIGN_TEXT
-
-#ifdef GPROF
-#ifdef __ELF__
-#define	MCOUNT_ASM	call	_C_LABEL(__mcount)
-#else /* __ELF__ */
-#define	MCOUNT_ASM	call	_C_LABEL(mcount)
-#endif /* __ELF__ */
-#else /* GPROF */
-#define	MCOUNT_ASM	/* nothing */
-#endif /* GPROF */
-
-#endif /* _KERNEL */
-
-
-
-#ifdef GPROF
-# ifdef __ELF__
-#  define _PROF_PROLOGUE	\
-	pushl %ebp; movl %esp,%ebp; call PIC_PLT(__mcount); popl %ebp
-# else 
-#  define _PROF_PROLOGUE	\
-	pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
-# endif
-#else
-# define _PROF_PROLOGUE
-#endif
-
-#define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
-#define	NENTRY(y)	_ENTRY(_C_LABEL(y))
-#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
-#define	LABEL(y)	_LABEL(_C_LABEL(y))
-#define	END(y)		.cfi_endproc; .size y, . - y
-
-#define	ASMSTR		.asciz
-
-#ifdef __ELF__
-#define RCSID(x)	.pushsection ".ident"; .asciz x; .popsection
-#else
-#define RCSID(x)	.text; .asciz x
-#endif
-
-#ifdef NO_KERNEL_RCSIDS
-#define	__KERNEL_RCSID(_n, _s)	/* nothing */
-#else
-#define	__KERNEL_RCSID(_n, _s)	RCSID(_s)
-#endif
-
-#ifdef __ELF__
-#define	WEAK_ALIAS(alias,sym)						\
-	.weak alias;							\
-	alias = sym
-#endif
-/*
- * STRONG_ALIAS: create a strong alias.
- */
-#define STRONG_ALIAS(alias,sym)						\
-	.globl alias;							\
-	alias = sym
-
-#ifdef __STDC__
-#define	WARN_REFERENCES(sym,msg)					\
-	.pushsection .gnu.warning. ## sym;				\
-	.ascii msg;							\
-	.popsection
-#else
-#define	WARN_REFERENCES(sym,msg)					\
-	.pushsection .gnu.warning./**/sym;				\
-	.ascii msg;							\
-	.popsection
-#endif /* __STDC__ */
-
 #endif /* !_I386_ASM_H_ */
diff --git a/libc/arch-x86/string/bcopy.S b/libc/arch-x86/string/bcopy.S
index 40df1d0..f425c58 100644
--- a/libc/arch-x86/string/bcopy.S
+++ b/libc/arch-x86/string/bcopy.S
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 	/*
 	 * (ov)bcopy (src,dst,cnt)
diff --git a/libc/arch-x86/string/memcmp.S b/libc/arch-x86/string/memcmp.S
index 3b50530..ef36b4f 100644
--- a/libc/arch-x86/string/memcmp.S
+++ b/libc/arch-x86/string/memcmp.S
@@ -4,7 +4,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(memcmp)
 	pushl	%edi
diff --git a/libc/arch-x86/string/strcat.S b/libc/arch-x86/string/strcat.S
index c75f38a..49e8eee 100644
--- a/libc/arch-x86/string/strcat.S
+++ b/libc/arch-x86/string/strcat.S
@@ -4,7 +4,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 #if defined(APIWARN)
 #APP
diff --git a/libc/arch-x86/string/strcmp.S b/libc/arch-x86/string/strcmp.S
index 5d3f4fc..580f4d5 100644
--- a/libc/arch-x86/string/strcmp.S
+++ b/libc/arch-x86/string/strcmp.S
@@ -4,7 +4,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * NOTE: I've unrolled the loop eight times: large enough to make a
diff --git a/libc/arch-x86/string/strncmp.S b/libc/arch-x86/string/strncmp.S
index 6649473..9ba83a1 100644
--- a/libc/arch-x86/string/strncmp.S
+++ b/libc/arch-x86/string/strncmp.S
@@ -4,7 +4,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * NOTE: I've unrolled the loop eight times: large enough to make a
diff --git a/libc/arch-x86/string/swab.S b/libc/arch-x86/string/swab.S
index 2f6cfb2..b44d134 100644
--- a/libc/arch-x86/string/swab.S
+++ b/libc/arch-x86/string/swab.S
@@ -4,7 +4,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 /*
  * On the i486, this code is negligibly faster than the code generated
diff --git a/libc/arch-x86/x86.mk b/libc/arch-x86/x86.mk
index a39fcf2..b024acb 100644
--- a/libc/arch-x86/x86.mk
+++ b/libc/arch-x86/x86.mk
@@ -84,15 +84,7 @@
     arch-x86/string/sse2-wcslen-atom.S \
     arch-x86/string/sse2-wcscmp-atom.S \
 
-# These are used by the static and dynamic versions of the libc
-# respectively.
-libc_arch_static_src_files_x86 :=
 
-libc_arch_dynamic_src_files_x86 :=
-
-
-##########################################
-# crt-related
 libc_crt_target_cflags_x86 := \
     -m32 \
     -I$(LOCAL_PATH)/arch-x86/include
diff --git a/libc/arch-x86_64/bionic/__bionic_clone.S b/libc/arch-x86_64/bionic/__bionic_clone.S
index 7692013..cf98d76 100644
--- a/libc/arch-x86_64/bionic/__bionic_clone.S
+++ b/libc/arch-x86_64/bionic/__bionic_clone.S
@@ -26,8 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 // pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
 ENTRY(__bionic_clone)
diff --git a/libc/arch-x86_64/bionic/__get_sp.S b/libc/arch-x86_64/bionic/__get_sp.S
index 0c693b3..9cc18a9 100644
--- a/libc/arch-x86_64/bionic/__get_sp.S
+++ b/libc/arch-x86_64/bionic/__get_sp.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(__get_sp)
   mov  %rsp, %rax
diff --git a/libc/arch-x86_64/bionic/__rt_sigreturn.S b/libc/arch-x86_64/bionic/__rt_sigreturn.S
index e03bb88..eddceb1 100644
--- a/libc/arch-x86_64/bionic/__rt_sigreturn.S
+++ b/libc/arch-x86_64/bionic/__rt_sigreturn.S
@@ -26,11 +26,9 @@
  * SUCH DAMAGE.
  */
 
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
-ENTRY(__rt_sigreturn)
-  .hidden _C_LABEL(__rt_sigreturn) // TODO: add an ENTRY_PRIVATE macro for x86_64.
+ENTRY_PRIVATE(__rt_sigreturn)
   movl $__NR_rt_sigreturn, %eax
   syscall
 END(__rt_sigreturn)
diff --git a/libc/arch-x86_64/bionic/_setjmp.S b/libc/arch-x86_64/bionic/_setjmp.S
index e9b8dbb..c617030 100644
--- a/libc/arch-x86_64/bionic/_setjmp.S
+++ b/libc/arch-x86_64/bionic/_setjmp.S
@@ -36,8 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
diff --git a/libc/arch-x86_64/bionic/setjmp.S b/libc/arch-x86_64/bionic/setjmp.S
index 4dd9028..c81b573 100644
--- a/libc/arch-x86_64/bionic/setjmp.S
+++ b/libc/arch-x86_64/bionic/setjmp.S
@@ -36,8 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
@@ -54,9 +53,9 @@
 	pushq	%rdi
 	xorq	%rdi,%rdi
 #ifdef __PIC__
-	call	PIC_PLT(_C_LABEL(sigblock))
+	call	PIC_PLT(sigblock)
 #else
-	call	_C_LABEL(sigblock)
+	call	sigblock
 #endif
 	popq	%rdi
 	movq	%rax,(_JB_SIGMASK * 8)(%rdi)
@@ -82,9 +81,9 @@
 	movq	(_JB_SIGMASK * 8)(%rdi),%rdi
 	pushq	%r8
 #ifdef __PIC__
-	call	PIC_PLT(_C_LABEL(sigsetmask))
+	call	PIC_PLT(sigsetmask)
 #else
-	call	_C_LABEL(sigsetmask)
+	call	sigsetmask
 #endif
 	popq	%r8
 	movq	(_JB_RBX * 8)(%r12),%rbx
diff --git a/libc/arch-x86_64/bionic/sigsetjmp.S b/libc/arch-x86_64/bionic/sigsetjmp.S
index 842d6ff..718743f 100644
--- a/libc/arch-x86_64/bionic/sigsetjmp.S
+++ b/libc/arch-x86_64/bionic/sigsetjmp.S
@@ -37,7 +37,7 @@
  */
 
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 #include <machine/setjmp.h>
 
 /*
@@ -58,9 +58,9 @@
 	pushq	%rdi
 	xorq	%rdi,%rdi
 #ifdef __PIC__
-	call	PIC_PLT(_C_LABEL(sigblock))
+	call	PIC_PLT(sigblock)
 #else
-	call	_C_LABEL(sigblock)
+	call	sigblock
 #endif
 	popq	%rdi
 	movq	%rax,(_JB_SIGMASK * 8)(%rdi)
@@ -87,9 +87,9 @@
 
 	movq	(_JB_SIGMASK * 8)(%rdi),%rdi
 #ifdef __PIC__
-	call	PIC_PLT(_C_LABEL(sigsetmask))
+	call	PIC_PLT(sigsetmask)
 #else
-	call	_C_LABEL(sigsetmask)
+	call	sigsetmask
 #endif
 2:	popq	%rax
 	movq	(_JB_RBX * 8)(%r12),%rbx
diff --git a/libc/arch-x86_64/include/machine/asm.h b/libc/arch-x86_64/include/machine/asm.h
index 310b230..0af6dae 100644
--- a/libc/arch-x86_64/include/machine/asm.h
+++ b/libc/arch-x86_64/include/machine/asm.h
@@ -37,8 +37,6 @@
 #ifndef _AMD64_ASM_H_
 #define _AMD64_ASM_H_
 
-#ifdef __x86_64__
-
 #ifdef __PIC__
 #define PIC_PLT(x)	x@PLT
 #define PIC_GOT(x)	x@GOTPCREL(%rip)
@@ -47,19 +45,6 @@
 #define PIC_GOT(x)	x
 #endif
 
-# define _C_LABEL(x)	x
-#define	_ASM_LABEL(x)	x
-
-#define CVAROFF(x,y)		(_C_LABEL(x)+y)(%rip)
-
-#ifdef __STDC__
-# define __CONCAT(x,y)	x ## y
-# define __STRING(x)	#x
-#else
-# define __CONCAT(x,y)	x/**/y
-# define __STRING(x)	"x"
-#endif
-
 /* let kernels and others override entrypoint alignment */
 #ifndef _ALIGN_TEXT
 # ifdef _STANDALONE
@@ -69,78 +54,4 @@
 # endif
 #endif
 
-#define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
-#define _LABEL(x) \
-	.globl x; x:
-
-#ifdef _KERNEL
-/* XXX Can't use __CONCAT() here, as it would be evaluated incorrectly. */
-#ifdef __STDC__
-#define	IDTVEC(name) \
-	ALIGN_TEXT; .globl X ## name; .type X ## name,@function; X ## name:
-#define	IDTVEC_END(name) \
-	.size X ## name, . - X ## name
-#else 
-#define	IDTVEC(name) \
-	ALIGN_TEXT; .globl X/**/name; .type X/**/name,@function; X/**/name:
-#define	IDTVEC_END(name) \
-	.size X/**/name, . - X/**/name
-#endif /* __STDC__ */ 
-#endif /* _KERNEL */
-
-#ifdef __STDC__
-#define CPUVAR(off)	%gs:CPU_INFO_ ## off
-#else
-#define CPUVAR(off)     %gs:CPU_INFO_/**/off
-#endif
-
-
-#ifdef GPROF
-# define _PROF_PROLOGUE	\
-	pushq %rbp; leaq (%rsp),%rbp; call PIC_PLT(__mcount); popq %rbp
-#else
-# define _PROF_PROLOGUE
-#endif
-
-#define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
-#define	NENTRY(y)	_ENTRY(_C_LABEL(y))
-#define	ALTENTRY(x)	NENTRY(x)
-#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
-#define	LABEL(y)	_LABEL(_C_LABEL(y))
-#define	END(y)		.cfi_endproc; .size y, . - y
-
-#define	ASMSTR		.asciz
-
-#define RCSID(x)	.pushsection ".ident"; .asciz x; .popsection
-
-#define	WEAK_ALIAS(alias,sym)						\
-	.weak alias;							\
-	alias = sym
-
-/*
- * STRONG_ALIAS: create a strong alias.
- */
-#define STRONG_ALIAS(alias,sym)						\
-	.globl alias;							\
-	alias = sym
-
-#ifdef __STDC__
-#define	WARN_REFERENCES(sym,msg)					\
-	.pushsection .gnu.warning. ## sym;				\
-	.ascii msg;							\
-	.popsection
-#else
-#define	WARN_REFERENCES(sym,msg)					\
-	.pushsection .gnu.warning./**/sym;				\
-	.ascii msg;							\
-	.popsection
-#endif /* __STDC__ */
-
-#else	/*	__x86_64__	*/
-
-#include <i386/asm.h>
-
-#endif	/*	__x86_64__	*/
-
 #endif /* !_AMD64_ASM_H_ */
diff --git a/libc/arch-x86_64/syscalls/__arch_prctl.S b/libc/arch-x86_64/syscalls/__arch_prctl.S
index e878679..ac5d96e 100644
--- a/libc/arch-x86_64/syscalls/__arch_prctl.S
+++ b/libc/arch-x86_64/syscalls/__arch_prctl.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__arch_prctl)
-.hidden _C_LABEL(__arch_prctl)
+.hidden __arch_prctl
diff --git a/libc/arch-x86_64/syscalls/__brk.S b/libc/arch-x86_64/syscalls/__brk.S
index 18c2997..a69f404 100644
--- a/libc/arch-x86_64/syscalls/__brk.S
+++ b/libc/arch-x86_64/syscalls/__brk.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__brk)
-.hidden _C_LABEL(__brk)
+.hidden __brk
diff --git a/libc/arch-x86_64/syscalls/__epoll_pwait.S b/libc/arch-x86_64/syscalls/__epoll_pwait.S
index ed913b0..306e12e 100644
--- a/libc/arch-x86_64/syscalls/__epoll_pwait.S
+++ b/libc/arch-x86_64/syscalls/__epoll_pwait.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__epoll_pwait)
-.hidden _C_LABEL(__epoll_pwait)
+.hidden __epoll_pwait
diff --git a/libc/arch-x86_64/syscalls/__exit.S b/libc/arch-x86_64/syscalls/__exit.S
index da1f9f8..af3ada4 100644
--- a/libc/arch-x86_64/syscalls/__exit.S
+++ b/libc/arch-x86_64/syscalls/__exit.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__exit)
-.hidden _C_LABEL(__exit)
+.hidden __exit
diff --git a/libc/arch-x86_64/syscalls/__getcpu.S b/libc/arch-x86_64/syscalls/__getcpu.S
index 5a18494..8650db4 100644
--- a/libc/arch-x86_64/syscalls/__getcpu.S
+++ b/libc/arch-x86_64/syscalls/__getcpu.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__getcpu)
-.hidden _C_LABEL(__getcpu)
+.hidden __getcpu
diff --git a/libc/arch-x86_64/syscalls/__getcwd.S b/libc/arch-x86_64/syscalls/__getcwd.S
index c9e9942..c762804 100644
--- a/libc/arch-x86_64/syscalls/__getcwd.S
+++ b/libc/arch-x86_64/syscalls/__getcwd.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__getcwd)
-.hidden _C_LABEL(__getcwd)
+.hidden __getcwd
diff --git a/libc/arch-x86_64/syscalls/__getpriority.S b/libc/arch-x86_64/syscalls/__getpriority.S
index f5230e1..8aaae8f 100644
--- a/libc/arch-x86_64/syscalls/__getpriority.S
+++ b/libc/arch-x86_64/syscalls/__getpriority.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__getpriority)
-.hidden _C_LABEL(__getpriority)
+.hidden __getpriority
diff --git a/libc/arch-x86_64/syscalls/__ioctl.S b/libc/arch-x86_64/syscalls/__ioctl.S
index 8f30eb6..646d819 100644
--- a/libc/arch-x86_64/syscalls/__ioctl.S
+++ b/libc/arch-x86_64/syscalls/__ioctl.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__ioctl)
-.hidden _C_LABEL(__ioctl)
+.hidden __ioctl
diff --git a/libc/arch-x86_64/syscalls/__openat.S b/libc/arch-x86_64/syscalls/__openat.S
index cd6a07f..e065cca 100644
--- a/libc/arch-x86_64/syscalls/__openat.S
+++ b/libc/arch-x86_64/syscalls/__openat.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__openat)
-.hidden _C_LABEL(__openat)
+.hidden __openat
diff --git a/libc/arch-x86_64/syscalls/__ppoll.S b/libc/arch-x86_64/syscalls/__ppoll.S
index dd639ae..6edaa36 100644
--- a/libc/arch-x86_64/syscalls/__ppoll.S
+++ b/libc/arch-x86_64/syscalls/__ppoll.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__ppoll)
-.hidden _C_LABEL(__ppoll)
+.hidden __ppoll
diff --git a/libc/arch-x86_64/syscalls/__pselect6.S b/libc/arch-x86_64/syscalls/__pselect6.S
index c37483a..a2aec7a 100644
--- a/libc/arch-x86_64/syscalls/__pselect6.S
+++ b/libc/arch-x86_64/syscalls/__pselect6.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__pselect6)
-.hidden _C_LABEL(__pselect6)
+.hidden __pselect6
diff --git a/libc/arch-x86_64/syscalls/__ptrace.S b/libc/arch-x86_64/syscalls/__ptrace.S
index be42b91..8ec8ac1 100644
--- a/libc/arch-x86_64/syscalls/__ptrace.S
+++ b/libc/arch-x86_64/syscalls/__ptrace.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__ptrace)
-.hidden _C_LABEL(__ptrace)
+.hidden __ptrace
diff --git a/libc/arch-x86_64/syscalls/__reboot.S b/libc/arch-x86_64/syscalls/__reboot.S
index fc8e58d..9b8ef70 100644
--- a/libc/arch-x86_64/syscalls/__reboot.S
+++ b/libc/arch-x86_64/syscalls/__reboot.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__reboot)
-.hidden _C_LABEL(__reboot)
+.hidden __reboot
diff --git a/libc/arch-x86_64/syscalls/__rt_sigaction.S b/libc/arch-x86_64/syscalls/__rt_sigaction.S
index 70602df..b038f6e 100644
--- a/libc/arch-x86_64/syscalls/__rt_sigaction.S
+++ b/libc/arch-x86_64/syscalls/__rt_sigaction.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__rt_sigaction)
-.hidden _C_LABEL(__rt_sigaction)
+.hidden __rt_sigaction
diff --git a/libc/arch-x86_64/syscalls/__rt_sigpending.S b/libc/arch-x86_64/syscalls/__rt_sigpending.S
index 1caf131..e0c50c1 100644
--- a/libc/arch-x86_64/syscalls/__rt_sigpending.S
+++ b/libc/arch-x86_64/syscalls/__rt_sigpending.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__rt_sigpending)
-.hidden _C_LABEL(__rt_sigpending)
+.hidden __rt_sigpending
diff --git a/libc/arch-x86_64/syscalls/__rt_sigprocmask.S b/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
index d7e44a7..2a0ab5e 100644
--- a/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__rt_sigprocmask)
-.hidden _C_LABEL(__rt_sigprocmask)
+.hidden __rt_sigprocmask
diff --git a/libc/arch-x86_64/syscalls/__rt_sigsuspend.S b/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
index 851b93e..6fa6565 100644
--- a/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
+++ b/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__rt_sigsuspend)
-.hidden _C_LABEL(__rt_sigsuspend)
+.hidden __rt_sigsuspend
diff --git a/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S b/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
index 6962d4a..46ee04b 100644
--- a/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__rt_sigtimedwait)
-.hidden _C_LABEL(__rt_sigtimedwait)
+.hidden __rt_sigtimedwait
diff --git a/libc/arch-x86_64/syscalls/__sched_getaffinity.S b/libc/arch-x86_64/syscalls/__sched_getaffinity.S
index 861f06b..3707226 100644
--- a/libc/arch-x86_64/syscalls/__sched_getaffinity.S
+++ b/libc/arch-x86_64/syscalls/__sched_getaffinity.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__sched_getaffinity)
-.hidden _C_LABEL(__sched_getaffinity)
+.hidden __sched_getaffinity
diff --git a/libc/arch-x86_64/syscalls/__set_tid_address.S b/libc/arch-x86_64/syscalls/__set_tid_address.S
index fe7260f..4a8f153 100644
--- a/libc/arch-x86_64/syscalls/__set_tid_address.S
+++ b/libc/arch-x86_64/syscalls/__set_tid_address.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__set_tid_address)
-.hidden _C_LABEL(__set_tid_address)
+.hidden __set_tid_address
diff --git a/libc/arch-x86_64/syscalls/__syslog.S b/libc/arch-x86_64/syscalls/__syslog.S
index 4e41149..f710025 100644
--- a/libc/arch-x86_64/syscalls/__syslog.S
+++ b/libc/arch-x86_64/syscalls/__syslog.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__syslog)
-.hidden _C_LABEL(__syslog)
+.hidden __syslog
diff --git a/libc/arch-x86_64/syscalls/__timer_create.S b/libc/arch-x86_64/syscalls/__timer_create.S
index 1c5c68e..2f41c88 100644
--- a/libc/arch-x86_64/syscalls/__timer_create.S
+++ b/libc/arch-x86_64/syscalls/__timer_create.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__timer_create)
-.hidden _C_LABEL(__timer_create)
+.hidden __timer_create
diff --git a/libc/arch-x86_64/syscalls/__timer_delete.S b/libc/arch-x86_64/syscalls/__timer_delete.S
index c826757..2009916 100644
--- a/libc/arch-x86_64/syscalls/__timer_delete.S
+++ b/libc/arch-x86_64/syscalls/__timer_delete.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__timer_delete)
-.hidden _C_LABEL(__timer_delete)
+.hidden __timer_delete
diff --git a/libc/arch-x86_64/syscalls/__timer_getoverrun.S b/libc/arch-x86_64/syscalls/__timer_getoverrun.S
index 772b05e..fe71efe 100644
--- a/libc/arch-x86_64/syscalls/__timer_getoverrun.S
+++ b/libc/arch-x86_64/syscalls/__timer_getoverrun.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__timer_getoverrun)
-.hidden _C_LABEL(__timer_getoverrun)
+.hidden __timer_getoverrun
diff --git a/libc/arch-x86_64/syscalls/__timer_gettime.S b/libc/arch-x86_64/syscalls/__timer_gettime.S
index 181069b..44fe2ff 100644
--- a/libc/arch-x86_64/syscalls/__timer_gettime.S
+++ b/libc/arch-x86_64/syscalls/__timer_gettime.S
@@ -14,4 +14,4 @@
 1:
     ret
 END(__timer_gettime)
-.hidden _C_LABEL(__timer_gettime)
+.hidden __timer_gettime
diff --git a/libc/arch-x86_64/syscalls/__timer_settime.S b/libc/arch-x86_64/syscalls/__timer_settime.S
index 11fe04e..1240aa1 100644
--- a/libc/arch-x86_64/syscalls/__timer_settime.S
+++ b/libc/arch-x86_64/syscalls/__timer_settime.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__timer_settime)
-.hidden _C_LABEL(__timer_settime)
+.hidden __timer_settime
diff --git a/libc/arch-x86_64/syscalls/__waitid.S b/libc/arch-x86_64/syscalls/__waitid.S
index 4317d78..0d4fc58 100644
--- a/libc/arch-x86_64/syscalls/__waitid.S
+++ b/libc/arch-x86_64/syscalls/__waitid.S
@@ -15,4 +15,4 @@
 1:
     ret
 END(__waitid)
-.hidden _C_LABEL(__waitid)
+.hidden __waitid
diff --git a/libc/arch-x86_64/x86_64.mk b/libc/arch-x86_64/x86_64.mk
index 5d2b05b..44831a6 100644
--- a/libc/arch-x86_64/x86_64.mk
+++ b/libc/arch-x86_64/x86_64.mk
@@ -53,14 +53,7 @@
     arch-x86_64/bionic/vfork.S \
     string/memcmp16.c \
 
-# These are used by the static and dynamic versions of the libc
-# respectively.
-libc_arch_static_src_files_x86_64 :=
 
-libc_arch_dynamic_src_files_x86_64 :=
-
-##########################################
-# crt-related
 libc_crt_target_cflags_x86_64 += \
     -m64 \
     -I$(LOCAL_PATH)/arch-x86_64/include
diff --git a/libc/netbsd/resolv/res_compat.c b/libc/netbsd/resolv/res_compat.c
deleted file mode 100644
index 19a1d5f..0000000
--- a/libc/netbsd/resolv/res_compat.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*	$NetBSD: res_compat.c,v 1.1 2004/06/09 18:07:03 christos Exp $	*/
-
-/*-
- * Copyright (c) 2004 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: res_compat.c,v 1.1 2004/06/09 18:07:03 christos Exp $");
-#endif
-
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include "arpa_nameser.h"
-#include <netdb.h>
-#include <string.h>
-#define __OLD_RES_STATE
-#ifdef ANDROID_CHANGES
-#include "resolv_private.h"
-#else
-#include "resolv.h"
-#endif
-
-#undef _res
-
-/*
- * Binary Compatibility; this symbol does not appear in a header file
- * Most userland programs use this to set res_options before res_init()
- * is called. There are hooks to res_init() to consult the data in this
- * structure. The hooks are provided indirectly by the two functions below.
- * We depend on the fact the the first 440 [32 bit machines] bytes are
- * shared between the two structures.
- */
-#ifndef __BIND_NOSTATIC
-struct __res_state _res
-#if defined(__BIND_RES_TEXT)
-	= { RES_TIMEOUT, }      /* Motorola, et al. */
-# endif
-;
-
-void *__res_get_old_state(void);
-void __res_put_old_state(void *);
-
-void *
-__res_get_old_state(void)
-{
-	return &_res;
-}
-
-void
-__res_put_old_state(void *res)
-{
-	(void)memcpy(&_res, res, sizeof(_res));
-}
-#endif
diff --git a/libc/netbsd/resolv/res_random.c b/libc/netbsd/resolv/res_random.c
deleted file mode 100644
index 4570c4f..0000000
--- a/libc/netbsd/resolv/res_random.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* $OpenBSD: res_random.c,v 1.17 2008/04/13 00:28:35 djm Exp $ */
-
-/*
- * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
- * Copyright 2008 Damien Miller <djm@openbsd.org>
- * Copyright 2008 Android Open Source Project (thread-safety)
- * All rights reserved.
- *
- * Theo de Raadt <deraadt@openbsd.org> came up with the idea of using
- * such a mathematical system to generate more random (yet non-repeating)
- * ids to solve the resolver/named problem.  But Niels designed the
- * actual system based on the constraints.
- *
- * Later modified by Damien Miller to wrap the LCG output in a 15-bit
- * permutation generator based on a Luby-Rackoff block cipher. This
- * ensures the output is non-repeating and preserves the MSB twiddle
- * trick, but makes it more resistant to LCG prediction.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * seed = random 15bit
- * n = prime, g0 = generator to n,
- * j = random so that gcd(j,n-1) == 1
- * g = g0^j mod n will be a generator again.
- *
- * X[0] = random seed.
- * X[n] = a*X[n-1]+b mod m is a Linear Congruential Generator
- * with a = 7^(even random) mod m,
- *      b = random with gcd(b,m) == 1
- *      m = 31104 and a maximal period of m-1.
- *
- * The transaction id is determined by:
- * id[n] = seed xor (g^X[n] mod n)
- *
- * Effectivly the id is restricted to the lower 15 bits, thus
- * yielding two different cycles by toggling the msb on and off.
- * This avoids reuse issues caused by reseeding.
- *
- * The output of this generator is then randomly permuted though a
- * custom 15 bit Luby-Rackoff block cipher.
- */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-#include "resolv_private.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* BIONIC-BEGIN */
-static pthread_mutex_t         _res_random_lock = PTHREAD_MUTEX_INITIALIZER;
-#define  _RES_RANDOM_LOCK()    pthread_mutex_lock(&_res_random_lock)
-#define  _RES_RANDOM_UNLOCK()  pthread_mutex_unlock(&_res_random_lock)
-/* BIONIC-END */
-
-#define RU_OUT  	180	/* Time after wich will be reseeded */
-#define RU_MAX		30000	/* Uniq cycle, avoid blackjack prediction */
-#define RU_GEN		2	/* Starting generator */
-#define RU_N		32749	/* RU_N-1 = 2*2*3*2729 */
-#define RU_AGEN		7	/* determine ru_a as RU_AGEN^(2*rand) */
-#define RU_M		31104	/* RU_M = 2^7*3^5 - don't change */
-#define RU_ROUNDS	11	/* Number of rounds for permute (odd) */
-
-struct prf_ctx {
-	/* PRF lookup table for odd rounds (7 bits input to 8 bits output) */
-	u_char prf7[(RU_ROUNDS / 2) * (1 << 7)];
-
-	/* PRF lookup table for even rounds (8 bits input to 7 bits output) */
-	u_char prf8[((RU_ROUNDS + 1) / 2) * (1 << 8)];
-};
-
-#define PFAC_N 3
-const static u_int16_t pfacts[PFAC_N] = {
-	2,
-	3,
-	2729
-};
-
-static u_int16_t ru_x;
-static u_int16_t ru_seed, ru_seed2;
-static u_int16_t ru_a, ru_b;
-static u_int16_t ru_g;
-static u_int16_t ru_counter = 0;
-static u_int16_t ru_msb = 0;
-static struct prf_ctx *ru_prf = NULL;
-static long ru_reseed;
-
-static u_int16_t pmod(u_int16_t, u_int16_t, u_int16_t);
-static void res_initid(void);
-
-/*
- * Do a fast modular exponation, returned value will be in the range
- * of 0 - (mod-1)
- */
-static u_int16_t
-pmod(u_int16_t gen, u_int16_t exp, u_int16_t mod)
-{
-	u_int16_t s, t, u;
-
-	s = 1;
-	t = gen;
-	u = exp;
-
-	while (u) {
-		if (u & 1)
-			s = (s * t) % mod;
-		u >>= 1;
-		t = (t * t) % mod;
-	}
-	return (s);
-}
-
-/*
- * 15-bit permutation based on Luby-Rackoff block cipher
- */
-u_int
-permute15(u_int in)
-{
-	int i;
-	u_int left, right, tmp;
-
-	if (ru_prf == NULL)
-		return in;
-
-	left = (in >> 8) & 0x7f;
-	right = in & 0xff;
-
-	/*
-	 * Each round swaps the width of left and right. Even rounds have
-	 * a 7-bit left, odd rounds have an 8-bit left.	Since this uses an
-	 * odd number of rounds, left is always 8 bits wide at the end.
-	 */
-	for (i = 0; i < RU_ROUNDS; i++) {
-		if ((i & 1) == 0)
-			tmp = ru_prf->prf8[(i << (8 - 1)) | right] & 0x7f;
-		else
-			tmp = ru_prf->prf7[((i - 1) << (7 - 1)) | right];
-		tmp ^= left;
-		left = right;
-		right = tmp;
-	}
-
-	return (right << 8) | left;
-}
-
-/*
- * Initializes the seed and chooses a suitable generator. Also toggles
- * the msb flag. The msb flag is used to generate two distinct
- * cycles of random numbers and thus avoiding reuse of ids.
- *
- * This function is called from res_randomid() when needed, an
- * application does not have to worry about it.
- */
-static void
-res_initid(void)
-{
-	u_int16_t j, i;
-	u_int32_t tmp;
-	int noprime = 1;
-	struct timeval tv;
-
-	ru_x = arc4random_uniform(RU_M);
-
-	/* 15 bits of random seed */
-	tmp = arc4random();
-	ru_seed = (tmp >> 16) & 0x7FFF;
-	ru_seed2 = tmp & 0x7FFF;
-
-	/* Determine the LCG we use */
-	tmp = arc4random();
-	ru_b = (tmp & 0xfffe) | 1;
-	ru_a = pmod(RU_AGEN, (tmp >> 16) & 0xfffe, RU_M);
-	while (ru_b % 3 == 0)
-		ru_b += 2;
-
-	j = arc4random_uniform(RU_N);
-
-	/*
-	 * Do a fast gcd(j,RU_N-1), so we can find a j with
-	 * gcd(j, RU_N-1) == 1, giving a new generator for
-	 * RU_GEN^j mod RU_N
-	 */
-
-	while (noprime) {
-		for (i = 0; i < PFAC_N; i++)
-			if (j % pfacts[i] == 0)
-				break;
-
-		if (i >= PFAC_N)
-			noprime = 0;
-		else
-			j = (j + 1) % RU_N;
-	}
-
-	ru_g = pmod(RU_GEN, j, RU_N);
-	ru_counter = 0;
-
-	/* Initialise PRF for Luby-Rackoff permutation */
-	if (ru_prf == NULL)
-		ru_prf = malloc(sizeof(*ru_prf));
-	if (ru_prf != NULL)
-		arc4random_buf(ru_prf, sizeof(*ru_prf));
-
-	gettimeofday(&tv, NULL);
-	ru_reseed = tv.tv_sec + RU_OUT;
-	ru_msb = ru_msb == 0x8000 ? 0 : 0x8000;
-}
-
-u_int
-res_randomid(void)
-{
-	struct timeval tv;
-        u_int  result;
-
-        _RES_RANDOM_LOCK()
-	gettimeofday(&tv, NULL);
-	if (ru_counter >= RU_MAX || tv.tv_sec > ru_reseed)
-		res_initid();
-
-	/* Linear Congruential Generator */
-	ru_x = (ru_a * ru_x + ru_b) % RU_M;
-	ru_counter++;
-
-	result = permute15(ru_seed ^ pmod(ru_g, ru_seed2 + ru_x, RU_N)) | ru_msb;
-        _RES_RANDOM_UNLOCK()
-        return result;
-}
-
-#if 0
-int
-main(int argc, char **argv)
-{
-	int i, n;
-	u_int16_t wert;
-
-	res_initid();
-
-	printf("Generator: %u\n", ru_g);
-	printf("Seed: %u\n", ru_seed);
-	printf("Reseed at %ld\n", ru_reseed);
-	printf("Ru_X: %u\n", ru_x);
-	printf("Ru_A: %u\n", ru_a);
-	printf("Ru_B: %u\n", ru_b);
-
-	n = argc > 1 ? atoi(argv[1]) : 60001;
-	for (i=0;i<n;i++) {
-		wert = res_randomid();
-		printf("%u\n", wert);
-	}
-	return 0;
-}
-#endif
-
diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h
index 803ff29..7c2686f 100644
--- a/libc/private/bionic_asm.h
+++ b/libc/private/bionic_asm.h
@@ -29,15 +29,32 @@
 #ifndef _PRIVATE_BIONIC_ASM_H_
 #define _PRIVATE_BIONIC_ASM_H_
 
-#if !defined(__mips__)
-/* <machine/asm.h> causes trouble on mips by including regdefs.h. */
-#include <machine/asm.h>
-#endif
-
 #include <asm/unistd.h> /* For system call numbers. */
 #define MAX_ERRNO 4095  /* For recognizing system call error returns. */
 
-/* TODO: add ENTRY_PRIVATE. */
-/* TODO: add ASM_ALIAS macro. */
+#define __bionic_asm_custom_entry(f)
+#define __bionic_asm_custom_end(f)
+#define __bionic_asm_function_type @function
+
+#include <machine/asm.h>
+
+#define ENTRY(f) \
+    .text; \
+    .globl f; \
+    _ALIGN_TEXT; \
+    .type f, __bionic_asm_function_type; \
+    f: \
+    __bionic_asm_custom_entry(f); \
+    .cfi_startproc \
+
+#define END(f) \
+    .cfi_endproc; \
+    .size f, .-f; \
+    __bionic_asm_custom_end(f) \
+
+/* Like ENTRY, but with hidden visibility. */
+#define ENTRY_PRIVATE(f) \
+    ENTRY(f); \
+    .hidden f \
 
 #endif /* _PRIVATE_BIONIC_ASM_H_ */
diff --git a/libc/tools/genlibgcc_compat.py b/libc/tools/genlibgcc_compat.py
new file mode 100755
index 0000000..f2ff7b0
--- /dev/null
+++ b/libc/tools/genlibgcc_compat.py
@@ -0,0 +1,144 @@
+#!/usr/bin/python
+
+'''
+/* This file generates libgcc_compat.c file that contains dummy
+ * references to libgcc.a functions to force the dynamic linker
+ * to copy their definition into the final libc.so binary.
+ *
+ * They are required to ensure backwards binary compatibility with
+ * libc.so provided by the platform and binaries built with the NDK or
+ * different versions/configurations of toolchains.
+ *
+ * Now, for a more elaborate description of the issue:
+ *
+ * libgcc.a is a compiler-specific library containing various helper
+ * functions used to implement certain operations that are not necessarily
+ * supported by the target CPU. For example, integer division doesn't have a
+ * corresponding CPU instruction on ARMv5, and is instead implemented in the
+ * compiler-generated machine code as a call to an __idiv helper function.
+ *
+ * Normally, one has to place libgcc.a in the link command used to generate
+ * target binaries (shared libraries and executables) after all objects and
+ * static libraries, but before dependent shared libraries, i.e. something
+ * like:
+ *         gcc <options> -o libfoo.so  foo.a libgcc.a -lc -lm
+ *
+ * This ensures that any helper function needed by the code in foo.a is copied
+ * into the final libfoo.so. However, doing so will link a bunch of other __cxa
+ * functions from libgcc.a into each .so and executable, causing 4k+ increase
+ * in every binary. Therefore the Android platform build system has been
+ * using this instead:
+ *
+ *         gcc <options> -o libfoo.so foo.a -lc -lm libgcc.a
+ *
+ * The problem with this is that if one helper function needed by foo.a has
+ * already been copied into libc.so or libm.so, then nothing will be copied
+ * into libfoo.so. Instead, a symbol import definition will be added to it
+ * so libfoo.so can directly call the one in libc.so at runtime.
+ *
+ * When refreshing toolchains for new versions or using different architecture
+ * flags, the set of helper functions copied to libc.so may change, which
+ * resulted in some native shared libraries generated with the NDK or prebuilts
+ * from vendors to fail to load properly.
+ *
+ * The NDK has been fixed after 1.6_r1 to use the correct link command, so
+ * any native shared library generated with it should now be safe from that
+ * problem. On the other hand, existing shared libraries distributed with
+ * applications that were generated with a previous version of the NDK
+ * still need all 1.5/1.6 helper functions in libc.so and libm.so
+ *
+ * After 3.2, the toolchain was updated again, adding __aeabi_f2uiz to the
+ * list of requirements. Technically, this is due to mis-linked NDK libraries
+ * but it is easier to add a single function here than asking several app
+ * developers to fix their build.
+ *
+ * The __aeabi_idiv function is added to the list since cortex-a15 supports
+ * HW idiv instructions so the system libc.so doesn't pull in the reference to
+ * __aeabi_idiv but legacy libraries built against cortex-a9 targets still need
+ * it.
+ *
+ * Final note: some of the functions below should really be in libm.so to
+ *             completely reflect the state of 1.5/1.6 system images. However,
+ *             since libm.so depends on libc.so, it's easier to put all of
+ *             these in libc.so instead, since the dynamic linker will always
+ *             search in libc.so before libm.so for dependencies.
+ */
+'''
+
+import os
+import sys
+import subprocess
+import tempfile
+import re
+
+libgcc_compat_header = "/* Generated by genlibgcc_compat.py */\n" + \
+"""
+#define   COMPAT_FUNCTIONS_LIST \\
+"""
+
+libgcc_compat_footer = """
+
+#define  XX(f)    extern void f(void);
+COMPAT_FUNCTIONS_LIST
+#undef XX
+
+void __bionic_libgcc_compat_hooks(void) {
+#define XX(f)    f();
+COMPAT_FUNCTIONS_LIST
+#undef XX
+}
+"""
+
+class Generator:
+    def process(self):
+        android_build_top_path = os.environ["ANDROID_BUILD_TOP"]
+        build_path =  android_build_top_path + "/bionic/libc"
+        file_name = "libgcc_compat.c"
+        file_path = build_path + "/arch-arm/bionic/" + file_name
+
+        print "* ANDROID_BUILD_TOP=" + android_build_top_path
+
+        # Check TARGET_ARCH
+        arch = subprocess.check_output(["CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core make --no-print-directory -f build/core/config.mk dumpvar-TARGET_ARCH"],
+                    cwd=android_build_top_path, shell=True).strip()
+
+        if arch != 'arm':
+            sys.exit("Error: Invalid TARGET_ARCH='" + arch + "' expecting 'arm'")
+
+        build_output_file_path = tempfile.mkstemp()[1]
+
+        p = subprocess.Popen(["ONE_SHOT_MAKEFILE=bionic/libc/Android.mk make -C " + android_build_top_path
+                    + " -f build/core/main.mk all_modules TARGET_LIBGCC= -j20 -B 2>&1 | tee " + build_output_file_path],
+                    cwd=build_path, shell=True)
+        p.wait()
+
+        print "* Build complete, logfile: " + build_output_file_path
+
+        func_set = set()
+        prog=re.compile("(?<=undefined reference to ')\w+")
+        fd = open(build_output_file_path, 'r')
+        for line in fd:
+            m = prog.search(line)
+            if m:
+                func_set.add(m.group(0))
+
+        fd.close()
+
+        func_list = sorted(func_set)
+
+        print "* Found " + repr(len(func_list)) + " referenced functions: " + repr(func_list)
+
+        if 0 == len(func_list):
+            sys.exit("Error: function list is empty, please check the build log: " + build_output_file_path)
+
+        print "* Generating " + file_path
+        fres = open(file_path, 'w')
+        fres.write(libgcc_compat_header)
+        for func_name in func_list:
+            fres.write("    XX("+func_name+") \\\n")
+        fres.write(libgcc_compat_footer)
+        fres.close()
+
+generator = Generator()
+generator.process()
+
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 6388ee1..8a5f3d2 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -118,29 +118,21 @@
 # MIPS assembler templates for each syscall stub
 #
 
-mips_call = "/* " + warning + " */\n" + \
-"""
-#include <asm/unistd.h>
-    .text
-    .globl %(func)s
-    .align 4
-    .ent %(func)s
-
-%(func)s:
+mips_call = syscall_stub_header + """\
     .set noreorder
-    .cpload $t9
-    li $v0, %(__NR_name)s
+    .cpload t9
+    li v0, %(__NR_name)s
     syscall
-    bnez $a3, 1f
-    move $a0, $v0
-    j $ra
+    bnez a3, 1f
+    move a0, v0
+    j ra
     nop
 1:
-    la $t9,__set_errno
-    j $t9
+    la t9,__set_errno
+    j t9
     nop
     .set reorder
-    .end %(func)s
+END(%(func)s)
 """
 
 
@@ -148,17 +140,7 @@
 # MIPS64 assembler templates for each syscall stub
 #
 
-mips64_call = "/* " + warning + " */\n" + \
-"""
-#include <asm/unistd.h>
-#include <machine/asm.h>
-#include <machine/regdef.h>
-    .text
-    .globl %(func)s
-    .align 4
-    .ent %(func)s
-
-%(func)s:
+mips64_call = syscall_stub_header + """\
     .set push
     .set noreorder
     li v0, %(__NR_name)s
@@ -178,7 +160,7 @@
     j t9
     move ra, t0
     .set pop
-    .end %(func)s
+END(%(func)s)
 """
 
 
@@ -306,7 +288,7 @@
 
     # Use hidden visibility for any functions beginning with underscores.
     if pointer_length == 64 and syscall["func"].startswith("__"):
-        stub += '.hidden _C_LABEL(' + syscall["func"] + ')\n'
+        stub += '.hidden ' + syscall["func"] + '\n'
 
     return stub
 
diff --git a/libc/upstream-netbsd/libc/gen/ftw.c b/libc/upstream-netbsd/lib/libc/gen/ftw.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/ftw.c
rename to libc/upstream-netbsd/lib/libc/gen/ftw.c
diff --git a/libc/upstream-netbsd/libc/gen/nftw.c b/libc/upstream-netbsd/lib/libc/gen/nftw.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/nftw.c
rename to libc/upstream-netbsd/lib/libc/gen/nftw.c
diff --git a/libc/upstream-netbsd/libc/gen/nice.c b/libc/upstream-netbsd/lib/libc/gen/nice.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/nice.c
rename to libc/upstream-netbsd/lib/libc/gen/nice.c
diff --git a/libc/upstream-netbsd/libc/gen/popen.c b/libc/upstream-netbsd/lib/libc/gen/popen.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/popen.c
rename to libc/upstream-netbsd/lib/libc/gen/popen.c
diff --git a/libc/upstream-netbsd/libc/gen/psignal.c b/libc/upstream-netbsd/lib/libc/gen/psignal.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/psignal.c
rename to libc/upstream-netbsd/lib/libc/gen/psignal.c
diff --git a/libc/upstream-netbsd/libc/gen/setjmperr.c b/libc/upstream-netbsd/lib/libc/gen/setjmperr.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/setjmperr.c
rename to libc/upstream-netbsd/lib/libc/gen/setjmperr.c
diff --git a/libc/upstream-netbsd/libc/gen/utime.c b/libc/upstream-netbsd/lib/libc/gen/utime.c
similarity index 100%
rename from libc/upstream-netbsd/libc/gen/utime.c
rename to libc/upstream-netbsd/lib/libc/gen/utime.c
diff --git a/libc/upstream-netbsd/libc/include/isc/assertions.h b/libc/upstream-netbsd/lib/libc/include/isc/assertions.h
similarity index 100%
rename from libc/upstream-netbsd/libc/include/isc/assertions.h
rename to libc/upstream-netbsd/lib/libc/include/isc/assertions.h
diff --git a/libc/upstream-netbsd/libc/include/isc/dst.h b/libc/upstream-netbsd/lib/libc/include/isc/dst.h
similarity index 100%
rename from libc/upstream-netbsd/libc/include/isc/dst.h
rename to libc/upstream-netbsd/lib/libc/include/isc/dst.h
diff --git a/libc/upstream-netbsd/libc/include/isc/eventlib.h b/libc/upstream-netbsd/lib/libc/include/isc/eventlib.h
similarity index 100%
rename from libc/upstream-netbsd/libc/include/isc/eventlib.h
rename to libc/upstream-netbsd/lib/libc/include/isc/eventlib.h
diff --git a/libc/upstream-netbsd/libc/include/isc/heap.h b/libc/upstream-netbsd/lib/libc/include/isc/heap.h
similarity index 100%
rename from libc/upstream-netbsd/libc/include/isc/heap.h
rename to libc/upstream-netbsd/lib/libc/include/isc/heap.h
diff --git a/libc/upstream-netbsd/libc/include/isc/list.h b/libc/upstream-netbsd/lib/libc/include/isc/list.h
similarity index 100%
rename from libc/upstream-netbsd/libc/include/isc/list.h
rename to libc/upstream-netbsd/lib/libc/include/isc/list.h
diff --git a/libc/upstream-netbsd/libc/include/isc/memcluster.h b/libc/upstream-netbsd/lib/libc/include/isc/memcluster.h
similarity index 100%
rename from libc/upstream-netbsd/libc/include/isc/memcluster.h
rename to libc/upstream-netbsd/lib/libc/include/isc/memcluster.h
diff --git a/libc/upstream-netbsd/libc/inet/inet_ntoa.c b/libc/upstream-netbsd/lib/libc/inet/inet_ntoa.c
similarity index 100%
rename from libc/upstream-netbsd/libc/inet/inet_ntoa.c
rename to libc/upstream-netbsd/lib/libc/inet/inet_ntoa.c
diff --git a/libc/upstream-netbsd/libc/inet/inet_ntop.c b/libc/upstream-netbsd/lib/libc/inet/inet_ntop.c
similarity index 100%
rename from libc/upstream-netbsd/libc/inet/inet_ntop.c
rename to libc/upstream-netbsd/lib/libc/inet/inet_ntop.c
diff --git a/libc/upstream-netbsd/libc/inet/inet_pton.c b/libc/upstream-netbsd/lib/libc/inet/inet_pton.c
similarity index 100%
rename from libc/upstream-netbsd/libc/inet/inet_pton.c
rename to libc/upstream-netbsd/lib/libc/inet/inet_pton.c
diff --git a/libc/upstream-netbsd/libc/isc/ev_streams.c b/libc/upstream-netbsd/lib/libc/isc/ev_streams.c
similarity index 100%
rename from libc/upstream-netbsd/libc/isc/ev_streams.c
rename to libc/upstream-netbsd/lib/libc/isc/ev_streams.c
diff --git a/libc/upstream-netbsd/libc/isc/ev_timers.c b/libc/upstream-netbsd/lib/libc/isc/ev_timers.c
similarity index 100%
rename from libc/upstream-netbsd/libc/isc/ev_timers.c
rename to libc/upstream-netbsd/lib/libc/isc/ev_timers.c
diff --git a/libc/upstream-netbsd/libc/isc/eventlib_p.h b/libc/upstream-netbsd/lib/libc/isc/eventlib_p.h
similarity index 100%
rename from libc/upstream-netbsd/libc/isc/eventlib_p.h
rename to libc/upstream-netbsd/lib/libc/isc/eventlib_p.h
diff --git a/libc/upstream-netbsd/libc/regex/cclass.h b/libc/upstream-netbsd/lib/libc/regex/cclass.h
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/cclass.h
rename to libc/upstream-netbsd/lib/libc/regex/cclass.h
diff --git a/libc/upstream-netbsd/libc/regex/cname.h b/libc/upstream-netbsd/lib/libc/regex/cname.h
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/cname.h
rename to libc/upstream-netbsd/lib/libc/regex/cname.h
diff --git a/libc/upstream-netbsd/libc/regex/engine.c b/libc/upstream-netbsd/lib/libc/regex/engine.c
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/engine.c
rename to libc/upstream-netbsd/lib/libc/regex/engine.c
diff --git a/libc/upstream-netbsd/libc/regex/regcomp.c b/libc/upstream-netbsd/lib/libc/regex/regcomp.c
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/regcomp.c
rename to libc/upstream-netbsd/lib/libc/regex/regcomp.c
diff --git a/libc/upstream-netbsd/libc/regex/regerror.c b/libc/upstream-netbsd/lib/libc/regex/regerror.c
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/regerror.c
rename to libc/upstream-netbsd/lib/libc/regex/regerror.c
diff --git a/libc/upstream-netbsd/libc/regex/regex2.h b/libc/upstream-netbsd/lib/libc/regex/regex2.h
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/regex2.h
rename to libc/upstream-netbsd/lib/libc/regex/regex2.h
diff --git a/libc/upstream-netbsd/libc/regex/regexec.c b/libc/upstream-netbsd/lib/libc/regex/regexec.c
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/regexec.c
rename to libc/upstream-netbsd/lib/libc/regex/regexec.c
diff --git a/libc/upstream-netbsd/libc/regex/regfree.c b/libc/upstream-netbsd/lib/libc/regex/regfree.c
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/regfree.c
rename to libc/upstream-netbsd/lib/libc/regex/regfree.c
diff --git a/libc/upstream-netbsd/libc/regex/utils.h b/libc/upstream-netbsd/lib/libc/regex/utils.h
similarity index 100%
rename from libc/upstream-netbsd/libc/regex/utils.h
rename to libc/upstream-netbsd/lib/libc/regex/utils.h
diff --git a/libc/upstream-netbsd/libc/stdio/getdelim.c b/libc/upstream-netbsd/lib/libc/stdio/getdelim.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdio/getdelim.c
rename to libc/upstream-netbsd/lib/libc/stdio/getdelim.c
diff --git a/libc/upstream-netbsd/libc/stdio/getline.c b/libc/upstream-netbsd/lib/libc/stdio/getline.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdio/getline.c
rename to libc/upstream-netbsd/lib/libc/stdio/getline.c
diff --git a/libc/upstream-netbsd/libc/stdlib/_rand48.c b/libc/upstream-netbsd/lib/libc/stdlib/_rand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/_rand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/_rand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/bsearch.c b/libc/upstream-netbsd/lib/libc/stdlib/bsearch.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/bsearch.c
rename to libc/upstream-netbsd/lib/libc/stdlib/bsearch.c
diff --git a/libc/upstream-netbsd/libc/stdlib/div.c b/libc/upstream-netbsd/lib/libc/stdlib/div.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/div.c
rename to libc/upstream-netbsd/lib/libc/stdlib/div.c
diff --git a/libc/upstream-netbsd/libc/stdlib/drand48.c b/libc/upstream-netbsd/lib/libc/stdlib/drand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/drand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/drand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/erand48.c b/libc/upstream-netbsd/lib/libc/stdlib/erand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/erand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/erand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/exit.c b/libc/upstream-netbsd/lib/libc/stdlib/exit.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/exit.c
rename to libc/upstream-netbsd/lib/libc/stdlib/exit.c
diff --git a/libc/upstream-netbsd/libc/stdlib/jrand48.c b/libc/upstream-netbsd/lib/libc/stdlib/jrand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/jrand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/jrand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/ldiv.c b/libc/upstream-netbsd/lib/libc/stdlib/ldiv.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/ldiv.c
rename to libc/upstream-netbsd/lib/libc/stdlib/ldiv.c
diff --git a/libc/upstream-netbsd/libc/stdlib/lldiv.c b/libc/upstream-netbsd/lib/libc/stdlib/lldiv.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/lldiv.c
rename to libc/upstream-netbsd/lib/libc/stdlib/lldiv.c
diff --git a/libc/upstream-netbsd/libc/stdlib/lrand48.c b/libc/upstream-netbsd/lib/libc/stdlib/lrand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/lrand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/lrand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/mrand48.c b/libc/upstream-netbsd/lib/libc/stdlib/mrand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/mrand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/mrand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/nrand48.c b/libc/upstream-netbsd/lib/libc/stdlib/nrand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/nrand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/nrand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/seed48.c b/libc/upstream-netbsd/lib/libc/stdlib/seed48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/seed48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/seed48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/srand48.c b/libc/upstream-netbsd/lib/libc/stdlib/srand48.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/srand48.c
rename to libc/upstream-netbsd/lib/libc/stdlib/srand48.c
diff --git a/libc/upstream-netbsd/libc/stdlib/tdelete.c b/libc/upstream-netbsd/lib/libc/stdlib/tdelete.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/tdelete.c
rename to libc/upstream-netbsd/lib/libc/stdlib/tdelete.c
diff --git a/libc/upstream-netbsd/libc/stdlib/tfind.c b/libc/upstream-netbsd/lib/libc/stdlib/tfind.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/tfind.c
rename to libc/upstream-netbsd/lib/libc/stdlib/tfind.c
diff --git a/libc/upstream-netbsd/libc/stdlib/tsearch.c b/libc/upstream-netbsd/lib/libc/stdlib/tsearch.c
similarity index 100%
rename from libc/upstream-netbsd/libc/stdlib/tsearch.c
rename to libc/upstream-netbsd/lib/libc/stdlib/tsearch.c
diff --git a/libc/upstream-netbsd/libc/string/memccpy.c b/libc/upstream-netbsd/lib/libc/string/memccpy.c
similarity index 100%
rename from libc/upstream-netbsd/libc/string/memccpy.c
rename to libc/upstream-netbsd/lib/libc/string/memccpy.c
diff --git a/libc/upstream-netbsd/libc/string/strcasestr.c b/libc/upstream-netbsd/lib/libc/string/strcasestr.c
similarity index 100%
rename from libc/upstream-netbsd/libc/string/strcasestr.c
rename to libc/upstream-netbsd/lib/libc/string/strcasestr.c
diff --git a/libc/upstream-netbsd/libc/string/strcoll.c b/libc/upstream-netbsd/lib/libc/string/strcoll.c
similarity index 100%
rename from libc/upstream-netbsd/libc/string/strcoll.c
rename to libc/upstream-netbsd/lib/libc/string/strcoll.c
diff --git a/libc/upstream-netbsd/libc/string/strxfrm.c b/libc/upstream-netbsd/lib/libc/string/strxfrm.c
similarity index 100%
rename from libc/upstream-netbsd/libc/string/strxfrm.c
rename to libc/upstream-netbsd/lib/libc/string/strxfrm.c
diff --git a/libc/upstream-netbsd/libc/thread-stub/__isthreaded.c b/libc/upstream-netbsd/lib/libc/thread-stub/__isthreaded.c
similarity index 100%
rename from libc/upstream-netbsd/libc/thread-stub/__isthreaded.c
rename to libc/upstream-netbsd/lib/libc/thread-stub/__isthreaded.c
diff --git a/libc/upstream-netbsd/libc/unistd/killpg.c b/libc/upstream-netbsd/lib/libc/unistd/killpg.c
similarity index 100%
rename from libc/upstream-netbsd/libc/unistd/killpg.c
rename to libc/upstream-netbsd/lib/libc/unistd/killpg.c
diff --git a/linker/arch/arm64/begin.S b/linker/arch/arm64/begin.S
index 55618b7..c96ede7 100644
--- a/linker/arch/arm64/begin.S
+++ b/linker/arch/arm64/begin.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(_start)
   mov x0, sp
diff --git a/linker/arch/mips64/begin.S b/linker/arch/mips64/begin.S
index 9a85925..9e741c0 100644
--- a/linker/arch/mips64/begin.S
+++ b/linker/arch/mips64/begin.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 #if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32)
 #define ELF_DYNSZ       8
diff --git a/linker/arch/x86_64/begin.S b/linker/arch/x86_64/begin.S
index 9ecad1a..aff4660 100644
--- a/linker/arch/x86_64/begin.S
+++ b/linker/arch/x86_64/begin.S
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
 
 ENTRY(_start)
   /* Pass elfdata to __linker_init. */
diff --git a/linker/linker.cpp b/linker/linker.cpp
index ead9bd4..156864c 100755
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1744,7 +1744,7 @@
         case DT_MIPS_RLD_MAP:
             // Set the DT_MIPS_RLD_MAP entry to the address of _r_debug for GDB.
             {
-              r_debug** dp = reinterpret_cast<r_debug**>(d->d_un.d_ptr);
+              r_debug** dp = reinterpret_cast<r_debug**>(base + d->d_un.d_ptr);
               *dp = &_r_debug;
             }
             break;
diff --git a/tests/math_test.cpp b/tests/math_test.cpp
index c8974d3..fc561bc 100644
--- a/tests/math_test.cpp
+++ b/tests/math_test.cpp
@@ -16,11 +16,42 @@
 
 #define _DECLARE_C99_LDBL_MATH 1
 
+// This include (and the associated definition of __test_capture_signbit)
+// must be placed before any files that include <cmath> (gtest.h in this case).
+//
+// <math.h> is required to define generic macros signbit, isfinite and
+// several other such functions.
+//
+// <cmath> is required to undef declarations of these macros in the global
+// namespace and make equivalent functions available in namespace std. Our
+// stlport implementation does this only for signbit, isfinite, isinf and
+// isnan.
+//
+// NOTE: We don't write our test using std::signbit because we want to be
+// sure that we're testing the bionic version of signbit. The C++ libraries
+// are free to reimplement signbit or delegate to compiler builtins if they
+// please.
+#include <math.h>
+
+namespace {
+template<typename T> inline int test_capture_signbit(const T in) {
+  return signbit(in);
+}
+template<typename T> inline int test_capture_isfinite(const T in) {
+  return isfinite(in);
+}
+template<typename T> inline int test_capture_isnan(const T in) {
+  return isnan(in);
+}
+template<typename T> inline int test_capture_isinf(const T in) {
+  return isinf(in);
+}
+}
+
 #include <gtest/gtest.h>
 
 #include <fenv.h>
 #include <limits.h>
-#include <math.h>
 #include <stdint.h>
 
 float float_subnormal() {
@@ -59,27 +90,25 @@
   ASSERT_EQ(FP_ZERO, fpclassify(0.0));
 }
 
-/* TODO: stlport breaks the isfinite macro
 TEST(math, isfinite) {
-  ASSERT_TRUE(isfinite(123.0f));
-  ASSERT_TRUE(isfinite(123.0));
-  ASSERT_FALSE(isfinite(HUGE_VALF));
-  ASSERT_FALSE(isfinite(HUGE_VAL));
+  ASSERT_TRUE(test_capture_isfinite(123.0f));
+  ASSERT_TRUE(test_capture_isfinite(123.0));
+  ASSERT_FALSE(test_capture_isfinite(HUGE_VALF));
+  ASSERT_FALSE(test_capture_isfinite(HUGE_VAL));
 }
-*/
 
 TEST(math, isinf) {
-  ASSERT_FALSE(isinf(123.0f));
-  ASSERT_FALSE(isinf(123.0));
-  ASSERT_TRUE(isinf(HUGE_VALF));
-  ASSERT_TRUE(isinf(HUGE_VAL));
+  ASSERT_FALSE(test_capture_isinf(123.0f));
+  ASSERT_FALSE(test_capture_isinf(123.0));
+  ASSERT_TRUE(test_capture_isinf(HUGE_VALF));
+  ASSERT_TRUE(test_capture_isinf(HUGE_VAL));
 }
 
 TEST(math, isnan) {
-  ASSERT_FALSE(isnan(123.0f));
-  ASSERT_FALSE(isnan(123.0));
-  ASSERT_TRUE(isnan(nanf("")));
-  ASSERT_TRUE(isnan(nan("")));
+  ASSERT_FALSE(test_capture_isnan(123.0f));
+  ASSERT_FALSE(test_capture_isnan(123.0));
+  ASSERT_TRUE(test_capture_isnan(nanf("")));
+  ASSERT_TRUE(test_capture_isnan(nan("")));
 }
 
 TEST(math, isnormal) {
@@ -90,19 +119,16 @@
 }
 
 // TODO: isgreater, isgreaterequals, isless, islessequal, islessgreater, isunordered
-
-/* TODO: stlport breaks the signbit macro
 TEST(math, signbit) {
-  ASSERT_EQ(0, signbit(0.0f));
-  ASSERT_EQ(0, signbit(0.0));
+  ASSERT_EQ(0, test_capture_signbit(0.0f));
+  ASSERT_EQ(0, test_capture_signbit(0.0));
 
-  ASSERT_EQ(0, signbit(1.0f));
-  ASSERT_EQ(0, signbit(1.0));
+  ASSERT_EQ(0, test_capture_signbit(1.0f));
+  ASSERT_EQ(0, test_capture_signbit(1.0));
 
-  ASSERT_NE(0, signbit(-1.0f));
-  ASSERT_NE(0, signbit(-1.0));
+  ASSERT_NE(0, test_capture_signbit(-1.0f));
+  ASSERT_NE(0, test_capture_signbit(-1.0));
 }
-*/
 
 TEST(math, __fpclassifyd) {
 #if defined(__BIONIC__)