mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-12 12:21:15 -08:00
mobile: support Nacl and PNacl
This patch adds support for chrome's Native Client and Portable Native Client
This commit is contained in:
parent
30e3184d08
commit
df019224f8
10 changed files with 127 additions and 27 deletions
28
src/aclocal.m4
vendored
28
src/aclocal.m4
vendored
|
|
@ -449,10 +449,38 @@ case "${host_os}" in
|
|||
esac
|
||||
|
||||
case "${host}" in
|
||||
*-nacl)
|
||||
thehost='linux'
|
||||
THREAD_CFLAGS='-D_THREAD_SAFE'
|
||||
THREAD_LIBS='-lpthread'
|
||||
SHARED_LDFLAGS="-shared ${LDFLAGS}"
|
||||
BUNDLE_LDFLAGS="-shared ${LDFLAGS}"
|
||||
ECL_GC_DIR=gc-unstable
|
||||
ECL_LDRPATH='-Wl,--rpath,~A'
|
||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ${CFLAGS}"
|
||||
SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION"
|
||||
SONAME_LDFLAGS="-Wl,-soname,SONAME"
|
||||
ECL_ADD_FEATURE([nacl])
|
||||
;;
|
||||
*-pnacl)
|
||||
thehost='linux'
|
||||
THREAD_CFLAGS='-D_THREAD_SAFE'
|
||||
THREAD_LIBS='-lpthread'
|
||||
dnl SHARED_LDFLAGS="-shared ${LDFLAGS}"
|
||||
dnl BUNDLE_LDFLAGS="-shared ${LDFLAGS}"
|
||||
ECL_GC_DIR=gc-unstable
|
||||
dnl ECL_LDRPATH='-Wl,--rpath,~A'
|
||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ${CFLAGS}"
|
||||
dnl SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION"
|
||||
dnl SONAME_LDFLAGS="-Wl,-soname,SONAME"
|
||||
ECL_ADD_FEATURE([nacl])
|
||||
ECL_ADD_FEATURE([pnacl])
|
||||
;;
|
||||
i686*-android*)
|
||||
THREAD_LIBS=''
|
||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DANDROID -DPLATFORM_ANDROID -DUSE_GET_STACKBASE_FOR_MAIN -DIGNORE_DYNAMIC_LOADING -DNO_GETCONTEXT -DHAVE_GETTIMEOFDAY -DHAVE_SIGPROCMASK ${CFLAGS}"
|
||||
ECL_ADD_FEATURE([android])
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${host_cpu}" in
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ ecl_cs_set_org(cl_env_ptr env)
|
|||
env->cs_org = (char*)(&env);
|
||||
env->cs_barrier = env->cs_org;
|
||||
env->cs_max_size = 0;
|
||||
#if defined(HAVE_SYS_RESOURCE_H) && defined(RLIMIT_STACK)
|
||||
#if defined(HAVE_SYS_RESOURCE_H) && defined(RLIMIT_STACK) && !defined(NACL)
|
||||
{
|
||||
struct rlimit rl;
|
||||
cl_index size;
|
||||
|
|
|
|||
|
|
@ -673,7 +673,7 @@ handler_fn_prototype(fpe_signal_handler, int sig, siginfo_t *info, void *data)
|
|||
feclearexcept(FE_ALL_EXCEPT);
|
||||
# endif
|
||||
#endif /* !_MSC_VER */
|
||||
#ifdef SA_SIGINFO
|
||||
#if defined(SA_SIGINFO) && !defined(NACL)
|
||||
if (info) {
|
||||
if (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV) {
|
||||
condition = @'division-by-zero';
|
||||
|
|
@ -726,7 +726,7 @@ handler_fn_prototype(sigsegv_handler, int sig, siginfo_t *info, void *aux)
|
|||
the_env = ecl_process_env();
|
||||
unlikely_if (zombie_process(the_env))
|
||||
return;
|
||||
#if defined(SA_SIGINFO)
|
||||
#if defined(SA_SIGINFO) && !defined(NACL)
|
||||
# if defined(ECL_USE_MPROTECT)
|
||||
/* We access the environment when it was protected. That
|
||||
* means there was a pending signal. */
|
||||
|
|
|
|||
|
|
@ -47,7 +47,12 @@
|
|||
cl_object
|
||||
si_getpid(void)
|
||||
{
|
||||
#if defined(NACL)
|
||||
FElibc_error("si_getpid not implemented",1);
|
||||
@(return Cnil)
|
||||
#else
|
||||
@(return ecl_make_fixnum(getpid()))
|
||||
#endif
|
||||
}
|
||||
|
||||
cl_object
|
||||
|
|
@ -66,6 +71,10 @@ ecl_def_ct_base_string(fake_out_name, "PIPE-WRITE-ENDPOINT", 19, static, const);
|
|||
cl_object
|
||||
si_make_pipe()
|
||||
{
|
||||
#if defined(NACL)
|
||||
FElibc_error("si_make_pipe not implemented",1);
|
||||
@(return Cnil)
|
||||
#else
|
||||
cl_object output;
|
||||
int fds[2], ret;
|
||||
#if defined(ECL_MS_WINDOWS_HOST)
|
||||
|
|
@ -84,6 +93,7 @@ si_make_pipe()
|
|||
output = cl_make_two_way_stream(in, out);
|
||||
}
|
||||
@(return output)
|
||||
#endif
|
||||
}
|
||||
|
||||
static cl_object
|
||||
|
|
@ -237,7 +247,10 @@ static cl_object
|
|||
ecl_waitpid(cl_object pid, cl_object wait)
|
||||
{
|
||||
cl_object status, code;
|
||||
#if defined(ECL_MS_WINDOWS_HOST)
|
||||
#if defined(NACL)
|
||||
FElibc_error("ecl_waitpid not implemented",1);
|
||||
@(return Cnil)
|
||||
#elif defined(ECL_MS_WINDOWS_HOST)
|
||||
cl_env_ptr the_env = ecl_process_env();
|
||||
HANDLE *hProcess = ecl_foreign_data_pointer_safe(pid);
|
||||
DWORD exitcode;
|
||||
|
|
@ -649,7 +662,7 @@ create_descriptor(cl_object stream, cl_object direction,
|
|||
if (child_stdout) CloseHandle(child_stdout);
|
||||
if (child_stderr) CloseHandle(child_stderr);
|
||||
}
|
||||
#else /* mingw */
|
||||
#elif !defined(NACL) /* mingw */
|
||||
{
|
||||
int child_stdin, child_stdout, child_stderr;
|
||||
int pipe_fd[2];
|
||||
|
|
@ -730,6 +743,11 @@ create_descriptor(cl_object stream, cl_object direction,
|
|||
close(child_stdout);
|
||||
close(child_stderr);
|
||||
}
|
||||
#else
|
||||
{
|
||||
FElibc_error("ext::run-program not implemented",1);
|
||||
@(return Cnil)
|
||||
}
|
||||
#endif /* mingw */
|
||||
if (Null(pid)) {
|
||||
if (parent_write) close(parent_write);
|
||||
|
|
|
|||
|
|
@ -45,8 +45,12 @@ coprocessor).")
|
|||
(defvar *ld-format* #-msvc "~A -o ~S -L~S ~{~S ~} ~@[~S~]~{ '~A'~} ~A"
|
||||
#+msvc "~A -Fe~S~* ~{~S ~} ~@[~S~]~{ '~A'~} ~A")
|
||||
|
||||
(defvar *cc-format* #-msvc "~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}"
|
||||
#+msvc "~A -I. -I\"~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -Fo\"~A\"~{ '~A'~}")
|
||||
(defvar *cc-format* (cond ((member :msvc *features*)
|
||||
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}")
|
||||
((member :nacl *features*) ;; pnacl-clang doesn't support -w
|
||||
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -c \"~A\" -o \"~A\"~{ '~A'~}")
|
||||
(t
|
||||
"~A -I. \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}")))
|
||||
|
||||
#-dlopen
|
||||
(defvar *ld-flags* "@LDFLAGS@ -lecl @CORE_LIBS@ @FASL_LIBS@ @LIBS@")
|
||||
|
|
|
|||
|
|
@ -97,7 +97,20 @@ initialization function in object files have more or less unpredictable
|
|||
names, we store them in a string in the object file. This string is recognized
|
||||
by the TAG it has at the beginning This function searches that tag and retrieves
|
||||
the function name it precedes."
|
||||
#-pnacl
|
||||
(with-open-file (stream file :direction :input :element-type '(unsigned-byte 8))
|
||||
(when (search-tag stream tag)
|
||||
(let ((name (read-name stream)))
|
||||
name)))
|
||||
#+pnacl
|
||||
(let* ((pnacl-dis (or (ext:getenv "PNACL_DIS")
|
||||
(error "please set the PNACL_DIS environment variable to your toolchain's pnacl-dis location")))
|
||||
(stream (ext:run-program
|
||||
pnacl-dis
|
||||
(list (namestring (translate-logical-pathname file)))
|
||||
:wait nil :input NIL :output :STREAM :error :OUTPUT)))
|
||||
(unless stream
|
||||
(error "Unable to disasemble file ~a" file))
|
||||
(when (search-tag stream tag)
|
||||
(let ((name (read-name stream)))
|
||||
name))))
|
||||
|
|
|
|||
29
src/configure
vendored
29
src/configure
vendored
|
|
@ -5070,12 +5070,41 @@ LSP_FEATURES="(cons :android ${LSP_FEATURES})"
|
|||
esac
|
||||
|
||||
case "${host}" in
|
||||
*-nacl)
|
||||
thehost='linux'
|
||||
THREAD_CFLAGS='-D_THREAD_SAFE'
|
||||
THREAD_LIBS='-lpthread'
|
||||
SHARED_LDFLAGS="-shared ${LDFLAGS}"
|
||||
BUNDLE_LDFLAGS="-shared ${LDFLAGS}"
|
||||
ECL_GC_DIR=gc-unstable
|
||||
ECL_LDRPATH='-Wl,--rpath,~A'
|
||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ${CFLAGS}"
|
||||
SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION"
|
||||
SONAME_LDFLAGS="-Wl,-soname,SONAME"
|
||||
|
||||
LSP_FEATURES="(cons :nacl ${LSP_FEATURES})"
|
||||
|
||||
;;
|
||||
*-pnacl)
|
||||
thehost='linux'
|
||||
THREAD_CFLAGS='-D_THREAD_SAFE'
|
||||
THREAD_LIBS='-lpthread'
|
||||
ECL_GC_DIR=gc-unstable
|
||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ${CFLAGS}"
|
||||
|
||||
LSP_FEATURES="(cons :nacl ${LSP_FEATURES})"
|
||||
|
||||
|
||||
LSP_FEATURES="(cons :pnacl ${LSP_FEATURES})"
|
||||
|
||||
;;
|
||||
i686*-android*)
|
||||
THREAD_LIBS=''
|
||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DANDROID -DPLATFORM_ANDROID -DUSE_GET_STACKBASE_FOR_MAIN -DIGNORE_DYNAMIC_LOADING -DNO_GETCONTEXT -DHAVE_GETTIMEOFDAY -DHAVE_SIGPROCMASK ${CFLAGS}"
|
||||
|
||||
LSP_FEATURES="(cons :android ${LSP_FEATURES})"
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${host_cpu}" in
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
/* -*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*- */
|
||||
/* vim: set filetype=c tabstop=8 shiftwidth=4 expandtab: */
|
||||
|
||||
/* ecl/configpre.h. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
|
|
|
|||
|
|
@ -124,12 +124,13 @@
|
|||
/* We use hierarchical package names, like in Allegro CL */
|
||||
#undef ECL_RELATIVE_PACKAGE_NAMES
|
||||
|
||||
/* Use mprotect for fast interrupt dispatch */
|
||||
/* Use mprotect for fast interrupt dispatch */
|
||||
#ifndef NACL
|
||||
#undef ECL_USE_MPROTECT
|
||||
#endif
|
||||
#if defined(ECL_MS_WINDOWS_HOST)
|
||||
# define ECL_USE_GUARD_PAGE
|
||||
#endif
|
||||
|
||||
/* Integer types */
|
||||
@ECL_STDINT_HEADER@
|
||||
#undef ecl_uint8_t
|
||||
|
|
@ -327,28 +328,36 @@ typedef unsigned char ecl_base_char;
|
|||
#undef HAVE_NANOSLEEP
|
||||
/* Float version if isnan() */
|
||||
#undef HAVE_ISNANF
|
||||
/* float.h for epsilons, maximum real numbers, etc */
|
||||
/* float.h for epsilons, maximum real numbers, etc */
|
||||
#undef HAVE_FLOAT_H
|
||||
/* select() */
|
||||
/* select() */
|
||||
#ifndef NACL
|
||||
#undef HAVE_SELECT
|
||||
#endif
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
/* putenv() or setenv() */
|
||||
/* putenv() or setenv() */
|
||||
#undef HAVE_SETENV
|
||||
#undef HAVE_PUTENV
|
||||
/* times() and sys/times.h */
|
||||
/* times() and sys/times.h */
|
||||
#ifndef NACL
|
||||
#undef HAVE_TIMES
|
||||
/* gettimeofday() and sys/time.h */
|
||||
#endif
|
||||
/* gettimeofday() and sys/time.h */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
/* getrusage() and sys/resource.h */
|
||||
/* getrusage() and sys/resource.h */
|
||||
#ifndef NACL
|
||||
#undef HAVE_GETRUSAGE
|
||||
/* user home directory, user name, etc... */
|
||||
#endif
|
||||
/* user home directory, user name, etc... */
|
||||
#undef HAVE_PW_H
|
||||
/* symbolic links and checking their existence */
|
||||
/* symbolic links and checking their existence */
|
||||
#ifndef NACL
|
||||
#undef HAVE_LSTAT
|
||||
/* safe creation of temporary files */
|
||||
#endif
|
||||
/* safe creation of temporary files */
|
||||
#undef HAVE_MKSTEMP
|
||||
/* timer for userland threads */
|
||||
/* timer for userland threads */
|
||||
#undef HAVE_ALARM
|
||||
/* filesytem */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
|
@ -356,11 +365,13 @@ typedef unsigned char ecl_base_char;
|
|||
#undef HAVE_DLFCN_H
|
||||
#undef HAVE_LINK_H
|
||||
#undef HAVE_MACH_O_DYLD_H
|
||||
/* POSIX signals */
|
||||
/* POSIX signals */
|
||||
#ifndef NACL
|
||||
#undef HAVE_SIGPROCMASK
|
||||
/* isatty() checks whether a file is connected to a */
|
||||
#endif
|
||||
/* isatty() checks whether a file is connected to a */
|
||||
#undef HAVE_ISATTY
|
||||
/* can manipulate floating point environment */
|
||||
/* can manipulate floating point environment */
|
||||
#undef HAVE_FENV_H
|
||||
/* can activate individual traps in floating point environment */
|
||||
/* this flag has to be deactivated for the Itanium architecture, where */
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
;;
|
||||
(in-package "LISP")
|
||||
|
||||
#+(and (not ecl-min) uname)
|
||||
#+(and (not ecl-min) (not nacl) uname)
|
||||
(ffi:clines "
|
||||
#include <sys/utsname.h>
|
||||
")
|
||||
|
||||
#+(and (not ecl-min) uname)
|
||||
#+(and (not ecl-min) (not nacl) uname)
|
||||
(defun uname ()
|
||||
(ffi:c-inline () () :object "{
|
||||
cl_object output;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue