summaryrefslogtreecommitdiffstats
path: root/libc/tools/gensyscalls.py
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-10-04 10:03:17 -0700
committerPavel Chupin <pavel.v.chupin@intel.com>2013-10-07 21:37:12 +0400
commit6fe4e8795452651862c1e02994f434ec5f0d5832 (patch)
tree5d2989a77bbf0f37e0d02f6c0deec601af1e838c /libc/tools/gensyscalls.py
parenta6e9ae80e51bffa40e600beb38e7796d2ef45242 (diff)
downloadbionic-6fe4e8795452651862c1e02994f434ec5f0d5832.zip
bionic-6fe4e8795452651862c1e02994f434ec5f0d5832.tar.gz
bionic-6fe4e8795452651862c1e02994f434ec5f0d5832.tar.bz2
Add an optional alias list to SYSCALLS.TXT
This patch adds an optional alias list to SYSCALLS.TXT. It is used to create aliases for a syscall. For x86-64, lseek64 is an alias for lseek. Change-Id: Icb11fd2bb461ea4f5f0a26bfc585471d7d7cc468 Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Diffstat (limited to 'libc/tools/gensyscalls.py')
-rwxr-xr-xlibc/tools/gensyscalls.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index a3c8450..386a8db 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -37,6 +37,10 @@ syscall_stub_header = """/* autogenerated by gensyscalls.py */
ENTRY(%(fname)s)
"""
+function_alias = """
+ .globl _C_LABEL(%(alias)s)
+ .equ _C_LABEL(%(alias)s), _C_LABEL(%(fname)s)
+"""
#
# x86 assembler templates for each syscall stub
@@ -210,7 +214,7 @@ class State:
self.other_files = []
self.syscalls = []
- def x86_64_genstub(self, fname, numparams, idname):
+ def x86_64_genstub(self, fname, numparams, idname, aliases):
t = { "fname" : fname, "idname" : idname }
result = syscall_stub_header % t
@@ -219,6 +223,10 @@ class State:
result += " movq %rcx, %r10\n"
result += x86_64_call % t
+ for alias in aliases:
+ t = { "fname" : fname, "alias" : alias }
+ result += function_alias % t
+
return result
def x86_genstub(self, fname, numparams, idname):
@@ -301,6 +309,7 @@ class State:
for t in self.syscalls:
syscall_func = t["func"]
+ syscall_aliases = t["aliases"]
syscall_params = t["params"]
syscall_name = t["name"]
__NR_name = make__NR_name(t["name"])
@@ -324,7 +333,7 @@ class State:
if t.has_key("x86_64"):
num_regs = count_generic_param_registers64(syscall_params)
- t["asm-x86_64"] = self.x86_64_genstub(syscall_func, num_regs, __NR_name)
+ t["asm-x86_64"] = self.x86_64_genstub(syscall_func, num_regs, __NR_name, syscall_aliases)
# Scan a Linux kernel asm/unistd.h file containing __NR_* constants
# and write out equivalent SYS_* constants for glibc source compatibility.