$(addsuffix .$(mode),$(NACL_ARCHES)))
HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
-ifeq ($(HOST_OS), linux)
- TOOLCHAIN_DIR = linux_x86_glibc
-else
- ifeq ($(HOST_OS), mac)
- TOOLCHAIN_DIR = mac_x86_glibc
- else
- $(error Host platform "${HOST_OS}" is not supported)
- endif
-endif
-
TOOLCHAIN_PATH = $(realpath ${NACL_SDK_ROOT}/toolchain)
-NACL_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR}
+NACL_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/linux_pnacl
+
+ifeq ($(wildcard $(NACL_TOOLCHAIN)),)
+ $(error Cannot find Native Client toolchain in "${NACL_TOOLCHAIN}")
+endif
ifeq ($(ARCH), nacl_ia32)
GYPENV = nacl_target_arch=nacl_ia32 v8_target_arch=arm v8_host_arch=ia32
- TOOLCHAIN_ARCH = x86-4.4
- NACL_CC = "$(NACL_TOOLCHAIN)/bin/i686-nacl-gcc"
- NACL_CXX = "$(NACL_TOOLCHAIN)/bin/i686-nacl-g++"
- NACL_LINK = "$(NACL_TOOLCHAIN)/bin/i686-nacl-g++"
+ NACL_CC = "$(NACL_TOOLCHAIN)/bin/pnacl-clang"
+ NACL_CXX = "$(NACL_TOOLCHAIN)/bin/pnacl-clang++"
+ NACL_LINK = "$(NACL_TOOLCHAIN)/bin/pnacl-clang++ --pnacl-allow-native -arch x86-32"
else
ifeq ($(ARCH), nacl_x64)
GYPENV = nacl_target_arch=nacl_x64 v8_target_arch=arm v8_host_arch=ia32
- TOOLCHAIN_ARCH = x86-4.4
- NACL_CC = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-gcc"
- NACL_CXX = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-g++"
- NACL_LINK = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-g++"
+ NACL_CC = "$(NACL_TOOLCHAIN)/bin/pnacl-clang"
+ NACL_CXX = "$(NACL_TOOLCHAIN)/bin/pnacl-clang++"
+ NACL_LINK = "$(NACL_TOOLCHAIN)/bin/pnacl-clang++ --pnacl-allow-native -arch x86-64"
else
$(error Target architecture "${ARCH}" is not supported)
endif
endif
-ifeq ($(wildcard $(NACL_TOOLCHAIN)),)
- $(error Cannot find Native Client toolchain in "${NACL_TOOLCHAIN}")
-endif
-
# For mksnapshot host generation.
GYPENV += host_os=${HOST_OS}
# For some reason the $$(basename $$@) expansion didn't work here...
$(NACL_BUILDS): $(NACL_MAKEFILES)
@$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
+ CC=${NACL_CC} \
CXX=${NACL_CXX} \
+ AR="$(NACL_TOOLCHAIN)/bin/pnacl-ar" \
+ RANLIB="$(NACL_TOOLCHAIN)/bin/pnacl-ranlib" \
+ LD="$(NACL_TOOLCHAIN)/bin/pnacl-ld" \
LINK=${NACL_LINK} \
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
python -c "print raw_input().capitalize()") \
GYP_DEFINES="${GYPENV}" \
CC=${NACL_CC} \
CXX=${NACL_CXX} \
+ LINK=${NACL_LINK} \
PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/build:$(PYTHONPATH)" \
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
typedef char Atomic8;
typedef int32_t Atomic32;
-#ifdef V8_HOST_ARCH_64_BIT
+#if defined(__native_client__)
+typedef int64_t Atomic64;
+#elif defined(V8_HOST_ARCH_64_BIT)
// We need to be able to go between Atomic64 and AtomicWord implicitly. This
// means Atomic64 and AtomicWord should be the same type on 64-bit.
#if defined(__ILP32__)
typedef int64_t Atomic64;
#else
typedef intptr_t Atomic64;
-#endif
-#endif
+#endif // defined(V8_HOST_ARCH_64_BIT)
+#endif // defined(__native_client__)
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
// Atomic64 routines below, depending on your architecture.
#include "src/base/atomicops_internals_x86_msvc.h"
#elif defined(__APPLE__)
#include "src/base/atomicops_internals_mac.h"
+#elif defined(__native_client__)
+#include "src/base/atomicops_internals_portable.h"
#elif defined(__GNUC__) && V8_HOST_ARCH_ARM64
#include "src/base/atomicops_internals_arm64_gcc.h"
#elif defined(__GNUC__) && V8_HOST_ARCH_ARM
#define V8_HOST_ARCH_64_BIT 1
#endif
#endif // __native_client__
+#elif defined(__pnacl__)
+// PNaCl is also ILP-32.
+#define V8_HOST_ARCH_IA32 1
+#define V8_HOST_ARCH_32_BIT 1
#elif defined(_M_IX86) || defined(__i386__)
#define V8_HOST_ARCH_IA32 1
#define V8_HOST_ARCH_32_BIT 1
namespace v8 {
namespace base {
-#if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
+#if defined(__pnacl__)
+// Portable host shouldn't do feature detection.
+#elif V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
// Define __cpuid() for non-MSVC libraries.
#if !V8_LIBC_MSVCRT
has_vfp3_d32_(false),
is_fp64_mode_(false) {
memcpy(vendor_, "Unknown", 8);
-#if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
+#if defined(__pnacl__)
+// Portable host shouldn't do feature detection.
+// TODO(jfb): Remove the hardcoded ARM simulator flags in the build, and
+// hardcode them here instead.
+#elif V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
int cpu_info[4];
// __cpuid with an InfoType argument of 0 returns the number of
'toolsets': ['target'],
}],
['OS=="linux"', {
- 'link_settings': {
- 'libraries': [
- '-lrt'
- ]
- },
+ 'conditions': [
+ ['nacl_target_arch=="none"', {
+ 'link_settings': {
+ 'libraries': [
+ '-lrt'
+ ],
+ },
+ }, {
+ 'defines': [
+ 'V8_LIBRT_NOT_AVAILABLE=1',
+ ],
+ }],
+ ],
'sources': [
'../../src/base/platform/platform-linux.cc',
'../../src/base/platform/platform-posix.cc'
import os
from os.path import join, dirname, abspath
+import re
import subprocess
import sys
import tempfile
try:
p = subprocess.Popen(['file', nexe], stdout=subprocess.PIPE)
out, err = p.communicate()
- lines = out.split('\n')
+ lines = [re.sub("\s+", " " , line) for line in out.split('\n')]
if lines[0].find(": ELF 32-bit LSB executable, Intel 80386") > 0:
return "x86_32"
if lines[0].find(": ELF 64-bit LSB executable, x86-64") > 0:
print("NaCl V8 ARM support is not ready yet.")
sys.exit(1)
else:
- print("Invalid nexe %s" % nexe)
+ print("Invalid nexe %s with NaCl arch %s" % (nexe, nacl_arch))
sys.exit(1)
nacl_sel_ldr = os.path.join(nacl_sdk_dir, "tools", sel_ldr)
nacl_irt = os.path.join(nacl_sdk_dir, "tools", irt)
- nacl_ld_so = os.path.join(nacl_sdk_dir, "toolchain", toolchain,
- "x86_64-nacl", libdir, "runnable-ld.so")
- nacl_lib_path = os.path.join(nacl_sdk_dir, "toolchain", toolchain,
- "x86_64-nacl", libdir)
- return (nacl_sdk_dir, nacl_sel_ldr, nacl_irt, nacl_ld_so, nacl_lib_path)
+ return (nacl_sdk_dir, nacl_sel_ldr, nacl_irt)
def Main():
if (len(sys.argv) == 1):
args = [Escape(arg) for arg in sys.argv[1:]]
- (nacl_sdk_dir, nacl_sel_ldr, nacl_irt, nacl_ld_so,
- nacl_lib_path) = GetNaClResources(sys.argv[1])
+ (nacl_sdk_dir, nacl_sel_ldr, nacl_irt) = GetNaClResources(sys.argv[1])
# sel_ldr Options:
# -c -c: disable validation (for performance)
# -a: allow file access
# -B <irt>: load the IRT
- command = ' '.join([nacl_sel_ldr, '-c', '-c', '-a', '-B', nacl_irt, '--',
- nacl_ld_so, '--library-path', nacl_lib_path] + args)
+ command = ' '.join([nacl_sel_ldr, '-c', '-c', '-a', '-B', nacl_irt, '--'] +
+ args)
error_code = Execute(command)
return error_code