summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'native_client_sdk/src/tools')
-rw-r--r--native_client_sdk/src/tools/common.mk6
-rwxr-xr-xnative_client_sdk/src/tools/create_nmf.py7
-rw-r--r--native_client_sdk/src/tools/lib/get_shared_deps.py13
-rw-r--r--native_client_sdk/src/tools/nacl_gcc.mk21
4 files changed, 41 insertions, 6 deletions
diff --git a/native_client_sdk/src/tools/common.mk b/native_client_sdk/src/tools/common.mk
index c3227985..d385bcf 100644
--- a/native_client_sdk/src/tools/common.mk
+++ b/native_client_sdk/src/tools/common.mk
@@ -14,7 +14,11 @@
# If your project only builds in one or the other then this should be overridden
# accordingly.
#
+ifneq ($(ENABLE_BIONIC),)
+ALL_TOOLCHAINS ?= pnacl glibc clang-newlib bionic
+else
ALL_TOOLCHAINS ?= pnacl glibc clang-newlib
+endif
VALID_TOOLCHAINS ?= $(ALL_TOOLCHAINS)
TOOLCHAIN ?= $(word 1,$(VALID_TOOLCHAINS))
@@ -424,7 +428,7 @@ ifneq (,$(findstring $(TOOLCHAIN),win))
include $(NACL_SDK_ROOT)/tools/host_vc.mk
endif
-ifneq (,$(findstring $(TOOLCHAIN),glibc clang-newlib))
+ifneq (,$(findstring $(TOOLCHAIN),glibc bionic clang-newlib))
include $(NACL_SDK_ROOT)/tools/nacl_gcc.mk
endif
diff --git a/native_client_sdk/src/tools/create_nmf.py b/native_client_sdk/src/tools/create_nmf.py
index c1fe50c..fe4abb9 100755
--- a/native_client_sdk/src/tools/create_nmf.py
+++ b/native_client_sdk/src/tools/create_nmf.py
@@ -552,6 +552,13 @@ def GetDefaultLibPath(config):
'ports/lib/glibc_arm/%s' % config_fallback,
]
+ bionic_dir = 'toolchain/%s_arm_bionic' % osname
+ if os.path.isdir(os.path.join(sdk_root, bionic_dir)):
+ libpath += [
+ '%s/arm-nacl/lib' % bionic_dir,
+ '%s/arm-nacl/usr/lib' % bionic_dir,
+ 'lib/bionic_arm/%s' % config,
+ ]
libpath = [os.path.normpath(p) for p in libpath]
libpath = [os.path.join(sdk_root, p) for p in libpath]
libpath.append(os.path.join(sdk_root, 'tools'))
diff --git a/native_client_sdk/src/tools/lib/get_shared_deps.py b/native_client_sdk/src/tools/lib/get_shared_deps.py
index 5325df9..5a3a658 100644
--- a/native_client_sdk/src/tools/lib/get_shared_deps.py
+++ b/native_client_sdk/src/tools/lib/get_shared_deps.py
@@ -210,9 +210,16 @@ def _FindLibsInPath(name, lib_path):
files = []
for dirname in lib_path:
# The libc.so files in the the glibc toolchain is actually a linker
- # script which references libc.so.<SHA1>. This means the libc.so itself
- # does not end up in the NEEDED section for glibc.
- if name == 'libc.so':
+ # script which references libc.so.<SHA1>. This means the lib.so itself
+ # does not end up in the NEEDED section for glibc. However with bionic
+ # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump
+ # if fails to parse it, os this filters out libc.so expept for within
+ # the bionic toolchain.
+ # TODO(bradnelson): Remove this once the SONAME in bionic is made to be
+ # unique in the same it is under glibc:
+ # https://code.google.com/p/nativeclient/issues/detail?id=3833
+ rel_dirname = os.path.relpath(dirname, SDK_DIR)
+ if name == 'libc.so' and 'bionic' not in rel_dirname:
continue
filename = os.path.join(dirname, name)
if os.path.exists(filename):
diff --git a/native_client_sdk/src/tools/nacl_gcc.mk b/native_client_sdk/src/tools/nacl_gcc.mk
index 2249734..f4fd613 100644
--- a/native_client_sdk/src/tools/nacl_gcc.mk
+++ b/native_client_sdk/src/tools/nacl_gcc.mk
@@ -10,6 +10,7 @@
#
# Macros for TOOLS
#
+ifneq ($(TOOLCHAIN),bionic)
X86_32_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=cc)
X86_32_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=c++)
X86_32_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=c++)
@@ -23,6 +24,7 @@ X86_64_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=c++)
X86_64_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=ar)
X86_64_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=strip)
X86_64_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=nm)
+endif
ARM_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=cc)
ARM_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=c++)
@@ -69,6 +71,18 @@ X86_64_LDFLAGS ?= -Wl,-Map,$(X86_64_OUTDIR)/$(TARGET)_x86_64.map
ARM_LDFLAGS ?= -Wl,-Map,$(ARM_OUTDIR)/$(TARGET)_arm.map
endif
+#
+# Choose between static and dynamic linking for Bionic
+# (Default to dynamic)
+#
+ifeq ($(TOOLCHAIN),bionic)
+ifeq (,$(BIONIC_USE_DYNAMIC))
+BIONIC_LINK:=-static
+else
+BIONIC_LINK:=-Wl,-Ttext-segment=0x100000
+endif
+endif
+
LDFLAGS_SHARED = -shared
#
@@ -160,7 +174,10 @@ endef
# Determine which architectures to build for. The user can set NACL_ARCH or
# ARCHES in the environment to control this.
#
-VALID_ARCHES := x86_32 x86_64 arm
+ifneq ($(TOOLCHAIN),bionic)
+VALID_ARCHES := x86_32 x86_64
+endif
+VALID_ARCHES += arm
ifdef NACL_ARCH
ifeq (,$(findstring $(NACL_ARCH),$(VALID_ARCHES)))
@@ -344,7 +361,7 @@ ifneq (,$(findstring arm,$(ARCHES)))
all: $(ARM_OUTDIR)/$(1)_arm.nexe
$(ARM_OUTDIR)/$(1)_arm.nexe: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_arm)) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
$(MKDIR) -p $$(dir $$@)
- $(call LOG,LINK,$$@,$(ARM_LINK) -o $$@ $$(filter %.o,$$^) $(NACL_LDFLAGS) $(ARM_LDFLAGS) $(LDFLAGS) $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_arm/$(CONFIG_DIR) -L$(path)/$(TOOLCHAIN)_arm/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(5))
+ $(call LOG,LINK,$$@,$(ARM_LINK) $(BIONIC_LINK) -o $$@ $$(filter %.o,$$^) $(NACL_LDFLAGS) $(ARM_LDFLAGS) $(LDFLAGS) $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_arm/$(CONFIG_DIR) -L$(path)/$(TOOLCHAIN)_arm/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(5))
$(call LOG,VALIDATE,$$@,$(NCVAL) $$@)
endif
endef