######################################################################
#
# All directories are relative to BASE which is
-# On Linux: native_client/toolchain/pnacl_linux_x86/
-# On Mac: native_client/toolchain/pnacl_mac_x86/
-# On Windows: native_client/toolchain/pnacl_win_x86/
+# On Linux: native_client/toolchain/linux_x86/pnacl_newlib/
+# On Mac: native_client/toolchain/mac_x86/pnacl_newlib/
+# On Windows: native_client/toolchain/win_x86/pnacl_newlib/
#
######################################################################
readonly ARM_FPU=vfp
readonly TOOLCHAIN_ROOT="${NACL_ROOT}/toolchain"
+readonly TOOLCHAIN_BASE="${TOOLCHAIN_ROOT}/${SCONS_BUILD_PLATFORM}_x86"
-readonly NNACL_BASE="${TOOLCHAIN_ROOT}/${SCONS_BUILD_PLATFORM}_x86"
-readonly NNACL_NEWLIB_ROOT="${NNACL_BASE}_newlib"
-readonly NNACL_ARM_NEWLIB_ROOT="${TOOLCHAIN_ROOT}/linux_arm_newlib"
+readonly NNACL_NEWLIB_ROOT="${TOOLCHAIN_BASE}/nacl_x86_newlib"
+readonly NNACL_ARM_NEWLIB_ROOT="${TOOLCHAIN_BASE}/nacl_arm_newlib"
readonly PNACL_MAKE_OPTS="${PNACL_MAKE_OPTS:-}"
readonly MAKE_OPTS="-j${PNACL_CONCURRENCY} VERBOSE=1 ${PNACL_MAKE_OPTS}"
readonly TIMESTAMP_FILENAME="make-timestamp"
# PNaCl toolchain installation directories (absolute paths)
-readonly TOOLCHAIN_LABEL="${TOOLCHAIN_LABEL:-pnacl_${BUILD_PLATFORM}_x86}"
-readonly INSTALL_ROOT="${TOOLCHAIN_ROOT}/${TOOLCHAIN_LABEL}"
+readonly INSTALL_ROOT="${TOOLCHAIN_BASE}/pnacl_newlib"
readonly INSTALL_BIN="${INSTALL_ROOT}/bin"
# Bitcode lib directories (including static bitcode libs)
readonly INSTALL_LIB_MIPS32="${INSTALL_LIB_NATIVE}mips32"
# PNaCl client-translators (sandboxed) binary locations
-readonly INSTALL_TRANSLATOR="${TOOLCHAIN_ROOT}/pnacl_translator"
+readonly INSTALL_TRANSLATOR="${TOOLCHAIN_BASE}/pnacl_translator"
# The INSTALL_HOST directory has host binaries and libs which
LIB_CPP_INSTALL_DIR="${INSTALL_ROOT}/usr-bc-${arch}"
;;
x86-32)
- BIASED_BC_CFLAGS="--target=i686-nacl"
+ BIASED_BC_CFLAGS="--target=i686-unknown-nacl"
NEWLIB_INSTALL_DIR="${INSTALL_ROOT}/usr-bc-${arch}"
INSTALL_LIB="${INSTALL_ROOT}/lib-bc-${arch}"
LIB_CPP_INSTALL_DIR="${INSTALL_ROOT}/usr-bc-${arch}"
;;
x86-64)
- BIASED_BC_CFLAGS="--target=x86_64-nacl"
+ BIASED_BC_CFLAGS="--target=x86_64-unknown-nacl"
NEWLIB_INSTALL_DIR="${INSTALL_ROOT}/usr-bc-${arch}"
INSTALL_LIB="${INSTALL_ROOT}/lib-bc-${arch}"
LIB_CPP_INSTALL_DIR="${INSTALL_ROOT}/usr-bc-${arch}"
newlib ${arch}
done
libs-support
- for arch in arm x86-32 x86-64 mips32 x86-32-nonsfi; do
+ for arch in arm x86-32 x86-64 mips32 arm-nonsfi x86-32-nonsfi; do
dummy-irt-shim ${arch}
done
compiler-rt-all
driver-install-translator
}
-#@ translator-archive-pexes <tarball> -archive gold and llc pexes
-#@ <tarball> should be an absolute pathname,
-#@ and should have tar.bz2 as the suffix (as that is
-#@ what will be produced).
-#@
-#@ This must run before pexes are pruned.
-translator-archive-pexes() {
- local tarball=$1
-
- if [[ "${tarball#*.}" != "tar.bz2" ]]; then
- echo "translator-archive-pexes: ${tarball} not named with .tar.bz2 suffix"
- exit 1
- fi
- local tarball_no_bz2=${tarball%.*}
-
- # Clear tarball before appending files to it.
- rm -f ${tarball}
-
- # Archive LD
- for arch in ${SBTC_ARCHES_ALL} ; do
- local pexe_dir="$(GetTranslatorInstallDir ${arch})/bin"
- echo "pexe_dir is ${pexe_dir}"
- # Label the pexes by architecture.
- local pexe_ld="${pexe_dir}/ld.${arch}"
- cp "${pexe_dir}/ld.pexe" "${pexe_ld}.nonfinal.pexe"
- ${PNACL_FINALIZE} "${pexe_ld}.nonfinal.pexe" -o "${pexe_ld}.final.pexe"
- local all="${pexe_ld}.final.pexe"
- file ${all}
- ls -l ${all}
- # strip all path components
- tar rf ${tarball_no_bz2} --transform 's!^.*/!!' ${all}
- done
-
- # Archive LLC (which combines x86 and x86_64).
- for arch in ${SBTC_ARCHES_LLVM} ; do
- local pexe_dir="$(GetTranslatorInstallDir ${arch})/bin"
- echo "pexe_dir is ${pexe_dir}"
- # Label the pexes by architecture.
- local pexe_llc="${pexe_dir}/pnacl-llc.${arch}"
- cp "${pexe_dir}/pnacl-llc.pexe" "${pexe_llc}.nonfinal.pexe"
- ${PNACL_FINALIZE} "${pexe_llc}.nonfinal.pexe" \
- -o "${pexe_llc}.final.pexe"
- local all="${pexe_llc}.final.pexe"
- file ${all}
- ls -l ${all}
- # strip all path components
- tar rf ${tarball_no_bz2} --transform 's!^.*/!!' ${all}
- done
- bzip2 ${tarball_no_bz2}
-}
-
-
#+ translator-clean-all - Clean all translator install/build directories
translator-clean-all() {
StepBanner "TRANSLATOR" "Clean all"
-DLLVM_TARGETS_TO_BUILD="X86;ARM;Mips" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-ULLVM_ENABLE_ZLIB \
+ -DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_APPEND_VC_REV=ON \
-DLLVM_BINUTILS_INCDIR="${binutils_include}" \
compiler-rt mips32
compiler-rt x86-32
compiler-rt x86-64
+ compiler-rt arm-nonsfi
compiler-rt x86-32-nonsfi
}
cmake -G "Unix Makefiles" \
-DCMAKE_CXX_COMPILER_WORKS=1 \
-DCMAKE_C_COMPILER_WORKS=1 \
+ -DCMAKE_SYSTEM_NAME=nacl \
-DCMAKE_INSTALL_PREFIX="${LIB_CPP_INSTALL_DIR}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="${PNACL_CC}" \
# c.f.: http://sourceware.org/ml/binutils/2009-05/msg00252.html
# all we try to do here is to add "$ORIGIN/../lib to "rpath".
# If you ever touch this please make sure that rpath is correct via:
- # objdump -p toolchain/${TOOLCHAIN_LABEL}/host/bin/le32-nacl-ld.gold
- # objdump -p toolchain/${TOOLCHAIN_LABEL}/host/bin/le32-nacl-objdump
+ # objdump -p ${TOOLCHAIN_BASE}/pnacl_newlib/host/bin/le32-nacl-ld.gold
+ # objdump -p ${TOOLCHAIN_BASE}/pnacl_newlib/host/bin/le32-nacl-objdump
if ${BUILD_PLATFORM_LINUX} ; then
local flags='-Xlinker -rpath -Xlinker '"'"'$\\$$\$$\\$$\$$ORIGIN/../lib'"'"
local shared='yes'
libs-support-bitcode x86-64
local arch
- for arch in arm x86-32 x86-64 mips32 x86-32-nonsfi; do
+ for arch in arm x86-32 x86-64 mips32 arm-nonsfi x86-32-nonsfi; do
libs-support-native ${arch}
done
local setjmp_arch="$arch"
if [ "$setjmp_arch" = "x86-32-nonsfi" ]; then
setjmp_arch=x86-32
+ elif [ "$setjmp_arch" = "arm-nonsfi" ]; then
+ setjmp_arch=arm
fi
${cc_cmd} -c setjmp_${setjmp_arch/-/_}.S -o "${tmpdir}"/setjmp.o
}
libs-support-unsandboxed() {
- if ${BUILD_PLATFORM_LINUX}; then
- local arch=x86-32-linux
+ if ${BUILD_PLATFORM_LINUX} || ${BUILD_PLATFORM_MAC}; then
+ local arch="x86-32-${BUILD_PLATFORM}"
StepBanner "LIBS-SUPPORT (${arch})" "Install unsandboxed_irt.o"
local destdir="${INSTALL_LIB_NATIVE}"${arch}
mkdir -p ${destdir}
- gcc -m32 -O2 -Wall -Werror -I${NACL_ROOT}/.. -DNACL_LINUX=1 -c \
- ${PNACL_SUPPORT}/unsandboxed_irt.c -o ${destdir}/unsandboxed_irt.o
+ # The NaCl headers insist on having a platform macro such as
+ # NACL_LINUX defined, but nonsfi/irt/irt_interfaces.c does not
+ # itself use any of these macros, so defining NACL_LINUX here even
+ # on non-Linux systems is OK.
+ gcc -m32 -O2 -Wall -Werror -I${NACL_ROOT}/.. -c \
+ -DNACL_LINUX=1 -DDEFINE_MAIN \
+ ${NACL_ROOT}/src/nonsfi/irt/irt_interfaces.c \
+ -o ${destdir}/unsandboxed_irt.o
fi
}
StepBanner "SDK" "Install headers"
spushd "${NACL_ROOT}"
- # TODO(pnacl-team): remove this pnaclsdk_mode once we have a better story
- # about host binary type (x86-32 vs x86-64). SCons only knows how to use
- # x86-32 host binaries right now, so we need pnaclsdk_mode to override that.
RunWithLog "sdk.headers" \
./scons \
"${SCONS_ARGS[@]}" \
${extra_flags} \
platform=${neutral_platform} \
- pnaclsdk_mode="custom:${INSTALL_ROOT}" \
+ pnacl_newlib_dir="${INSTALL_ROOT}" \
install_headers \
includedir="$(PosixToSysPath "${SDK_INSTALL_INCLUDE}")"
spopd
local neutral_platform="x86-32"
spushd "${NACL_ROOT}"
- # See above TODO about pnaclsdk_mode.
RunWithLog "sdk.libs.bitcode" \
./scons \
"${SCONS_ARGS[@]}" \
${extra_flags} \
platform=${neutral_platform} \
- pnaclsdk_mode="custom:${INSTALL_ROOT}" \
+ pnacl_newlib_dir="${INSTALL_ROOT}" \
install_lib \
libdir="$(PosixToSysPath "${SDK_INSTALL_LIB}")"
spopd
spushd "${NACL_ROOT}"
local neutral_platform="x86-32"
- # See above TODO about pnaclsdk_mode.
RunWithLog "sdk.libs_private.bitcode" \
./scons \
-j${PNACL_CONCURRENCY} \
bitcode=1 \
platform=${neutral_platform} \
- pnaclsdk_mode="custom:${INSTALL_ROOT}" \
+ pnacl_newlib_dir="${INSTALL_ROOT}" \
--verbose \
libnacl_sys_private \
libpthread_private \
#
# If you are adding a test that depends on a toolchain change, you
# can increment this version number manually.
- echo 4 > "${INSTALL_ROOT}/FEATURE_VERSION"
+ echo 5 > "${INSTALL_ROOT}/FEATURE_VERSION"
}
# The driver is a simple python script which changes its behavior
DumpAllRevisions() {
one-line-rev-info ${NACL_ROOT}
- for d in ${PNACL_ROOT}/git/*/ ; do
+ for d in ${PNACL_GIT_ROOT}/*/ ; do
one-line-rev-info $d
done
}
}
#@-------------------------------------------------------------------------
-#+ verify - Verifies that toolchain/pnacl-untrusted ELF files
+#+ verify - Verifies that the pnacl-untrusted ELF files
#+ are of the correct architecture.
verify() {
StepBanner "VERIFY"
env | grep PNACL
Banner "uname info for builder:"
uname -a
- Banner "Revisions:"
- DumpAllRevisions
}
#@ help - Usage information.
}
has-trusted-toolchain() {
- if [ -f ${TOOLCHAIN_ROOT}/linux_arm-trusted/ld_script_arm_trusted ]; then
+ if [ -f ${TOOLCHAIN_BASE}/arm_trusted/ld_script_arm_trusted ]; then
return 0
else
return 1
######################################################################
mkdir -p "${INSTALL_ROOT}"
-PackageCheck
if [ $# = 0 ]; then set -- help; fi # Avoid reference to undefined $1.