| OLD | NEW |
| 1 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 EnableGlibcCompat | 5 EnableGlibcCompat |
| 6 EnableCliMain | 6 EnableCliMain |
| 7 | 7 |
| 8 PatchStep() { | 8 PatchStep() { |
| 9 DefaultPatchStep | 9 DefaultPatchStep |
| 10 MakeDir ${SRC_DIR}/toolchain_build/src | 10 MakeDir ${SRC_DIR}/toolchain_build/src |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 GOLD_LDADD+=" -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils" | 54 GOLD_LDADD+=" -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils" |
| 55 GOLD_LDADD+=" -lLLVMARMDisassembler -lLLVMARMCodeGen" | 55 GOLD_LDADD+=" -lLLVMARMDisassembler -lLLVMARMCodeGen" |
| 56 GOLD_LDADD+=" -lLLVMNaClTransforms" | 56 GOLD_LDADD+=" -lLLVMNaClTransforms" |
| 57 GOLD_LDADD+=" -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo" | 57 GOLD_LDADD+=" -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo" |
| 58 GOLD_LDADD+=" -lLLVMARMAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen" | 58 GOLD_LDADD+=" -lLLVMARMAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen" |
| 59 GOLD_LDADD+=" -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen" | 59 GOLD_LDADD+=" -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen" |
| 60 GOLD_LDADD+=" -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo" | 60 GOLD_LDADD+=" -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo" |
| 61 GOLD_LDADD+=" -lLLVMMipsAsmPrinter -lLLVMMCDisassembler -lLLVMLTO" | 61 GOLD_LDADD+=" -lLLVMMipsAsmPrinter -lLLVMMCDisassembler -lLLVMLTO" |
| 62 GOLD_LDADD+=" -lLLVMMCParser -lLLVMLinker -lLLVMipo -lLLVMObjCARCOpts" | 62 GOLD_LDADD+=" -lLLVMMCParser -lLLVMLinker -lLLVMipo -lLLVMObjCARCOpts" |
| 63 GOLD_LDADD+=" -lLLVMVectorize -lLLVMScalarOpts -lLLVMInstCombine" | 63 GOLD_LDADD+=" -lLLVMVectorize -lLLVMScalarOpts -lLLVMInstCombine" |
| 64 GOLD_LDADD+=" -lLLVMJSBackendCodeGen -lLLVMJSBackendDesc -lLLVMJSBackendInfo" | |
| 65 GOLD_LDADD+=" -lLLVMTransformUtils -lLLVMipa -lLLVMBitWriter" | 64 GOLD_LDADD+=" -lLLVMTransformUtils -lLLVMipa -lLLVMBitWriter" |
| 66 GOLD_LDADD+=" -lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMMC" | 65 GOLD_LDADD+=" -lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMMC" |
| 67 GOLD_LDADD+=" -lLLVMObject -lLLVMCore -lLLVMSupport" | 66 GOLD_LDADD+=" -lLLVMObject -lLLVMCore -lLLVMSupport" |
| 68 GOLD_LDADD+=" -Wl,--end-group" | 67 GOLD_LDADD+=" -Wl,--end-group" |
| 69 | 68 |
| 70 EXTRA_CONFIGURE="--extra-configure-arg=--disable-compiler-version-checks" | 69 EXTRA_CONFIGURE="--extra-configure-arg=--disable-compiler-version-checks" |
| 71 EXTRA_CONFIGURE+=" --extra-configure-arg=--enable-libcpp" | 70 EXTRA_CONFIGURE+=" --extra-configure-arg=--enable-libcpp" |
| 72 # Without this configure will detect vfork as missing and define | 71 # Without this configure will detect vfork as missing and define |
| 73 # vfork to fork which clobbers that define in "spawn.h". | 72 # vfork to fork which clobbers that define in "spawn.h". |
| 74 EXTRA_CONFIGURE+=" --extra-configure-arg=ac_cv_func_vfork_works=yes" | 73 EXTRA_CONFIGURE+=" --extra-configure-arg=ac_cv_func_vfork_works=yes" |
| 75 EXTRA_CONFIGURE+=" --extra-configure-arg=ac_cv_func_getrusage=no" | 74 EXTRA_CONFIGURE+=" --extra-configure-arg=ac_cv_func_getrusage=no" |
| 76 if [[ ${NACL_DEBUG} == 1 ]]; then | 75 if [[ ${NACL_DEBUG} == 1 ]]; then |
| 77 EXTRA_CONFIGURE+=" --host-flavor=debug" | 76 EXTRA_CONFIGURE+=" --host-flavor=debug" |
| 78 fi | 77 fi |
| 79 | 78 |
| 80 # Some code in llvm uses intrisics not supported in the pnacl stable abi. | 79 # Some code in llvm uses intrisics not supported in the pnacl stable abi. |
| 81 if [[ ${TOOLCHAIN} == pnacl ]]; then | 80 if [[ ${TOOLCHAIN} == pnacl ]]; then |
| 82 EXTRA_CC_ARGS="-fgnu-inline-asm" | 81 EXTRA_CC_ARGS="-fgnu-inline-asm" |
| 83 EXTRA_CC_ARGS+=" --pnacl-disable-abi-check" | 82 if [[ ${NACL_ARCH} == le32 ]]; then |
| 83 GOLD_LDADD+=" -Wl,-plugin-opt=no-abi-verify" |
| 84 else |
| 85 EXTRA_CC_ARGS+=" --pnacl-disable-abi-check" |
| 86 fi |
| 84 fi | 87 fi |
| 85 if [[ ${TOOLCHAIN} != glibc ]]; then | 88 if [[ ${TOOLCHAIN} != glibc ]]; then |
| 86 EXTRA_CC_ARGS+=" -I${NACLPORTS_INCLUDE}/glibc-compat" | 89 EXTRA_CC_ARGS+=" -I${NACLPORTS_INCLUDE}/glibc-compat" |
| 87 fi | 90 fi |
| 88 | 91 |
| 89 EXTRA_CC_ARGS+=" -include spawn.h" | 92 EXTRA_CC_ARGS+=" -include spawn.h" |
| 90 EXTRA_CC_ARGS+=" -I${NACL_SDK_ROOT}/include" | 93 EXTRA_CC_ARGS+=" -I${NACL_SDK_ROOT}/include" |
| 91 EXTRA_CC_ARGS+=" -I${NACLPORTS_INCLUDE}" | 94 EXTRA_CC_ARGS+=" -isystem${NACLPORTS_INCLUDE}" |
| 92 | 95 |
| 93 # export WEBPORTS_EXTRA_LIBS so that compiler_wapper.py can access it | 96 # export WEBPORTS_EXTRA_LIBS so that compiler_wapper.py can access it |
| 94 export WEBPORTS_EXTRA_LIBS="${NACLPORTS_LDFLAGS} ${NACLPORTS_LIBS}" | 97 export WEBPORTS_EXTRA_LIBS="${NACLPORTS_LDFLAGS} ${NACLPORTS_LIBS}" |
| 95 echo "WEBPORTS_EXTRA_LIBS=${WEBPORTS_EXTRA_LIBS}" | 98 echo "WEBPORTS_EXTRA_LIBS=${WEBPORTS_EXTRA_LIBS}" |
| 96 | 99 |
| 97 # Inject a shim that speed up pnacl invocations for configure. | 100 # Inject a shim that speed up pnacl invocations for configure. |
| 98 if [ "${NACL_ARCH}" = "pnacl" ]; then | 101 if [ "${NACL_ARCH}" = "pnacl" ]; then |
| 99 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" | 102 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" |
| 100 NACLCC="${PNACL_CONF_SHIM} ${NACLCC}" | 103 NACLCC="${PNACL_CONF_SHIM} ${NACLCC}" |
| 101 NACLCXX="${PNACL_CONF_SHIM} ${NACLCXX}" | 104 NACLCXX="${PNACL_CONF_SHIM} ${NACLCXX}" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 113 export RANLIB=${NACLRANLIB} | 116 export RANLIB=${NACLRANLIB} |
| 114 LogExecute ${SRC_DIR}/toolchain_build/toolchain_build_pnacl.py -v \ | 117 LogExecute ${SRC_DIR}/toolchain_build/toolchain_build_pnacl.py -v \ |
| 115 --no-use-cached-results \ | 118 --no-use-cached-results \ |
| 116 --no-use-remote-cache \ | 119 --no-use-remote-cache \ |
| 117 --no-annotator \ | 120 --no-annotator \ |
| 118 --pnacl-in-pnacl \ | 121 --pnacl-in-pnacl \ |
| 119 --output=${OUT_DIR} \ | 122 --output=${OUT_DIR} \ |
| 120 --install=${OUT_INSTALL} \ | 123 --install=${OUT_INSTALL} \ |
| 121 "--extra-cc-args=${EXTRA_CC_ARGS}" \ | 124 "--extra-cc-args=${EXTRA_CC_ARGS}" \ |
| 122 ${EXTRA_CONFIGURE} \ | 125 ${EXTRA_CONFIGURE} \ |
| 123 "--binutils-pnacl-extra-configure=${GOLD_LDADD}" | 126 "--binutils-extra-configure=${GOLD_LDADD}" |
| 124 | 127 |
| 125 CreateHybridToolchain | 128 CreateHybridToolchain |
| 126 } | 129 } |
| 127 | 130 |
| 128 CreateHybridToolchain() { | 131 CreateHybridToolchain() { |
| 129 Banner "Creating Hybrid Toolchain" | 132 Banner "Creating Hybrid Toolchain" |
| 130 | 133 |
| 131 # Build a full toolchain based on the one in NACL_SDK_ROOT, but overlayed | 134 # Build a full toolchain based on the one in NACL_SDK_ROOT, but overlayed |
| 132 # with the one we just compiled. | 135 # with the one we just compiled. |
| 133 Remove toolchain | 136 Remove toolchain |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 Remove $f ${f%.*} | 195 Remove $f ${f%.*} |
| 193 LogExecute ln -s clang ${f%.*} | 196 LogExecute ln -s clang ${f%.*} |
| 194 done | 197 done |
| 195 for f in $(find ${INSTALL_DIR} -type f -name "*${NACL_EXEEXT}"); do | 198 for f in $(find ${INSTALL_DIR} -type f -name "*${NACL_EXEEXT}"); do |
| 196 LogExecute mv $f ${f%.*} | 199 LogExecute mv $f ${f%.*} |
| 197 done | 200 done |
| 198 } | 201 } |
| 199 | 202 |
| 200 TestStep() { | 203 TestStep() { |
| 201 # Verify that binaries at least load under sel_ldr | 204 # Verify that binaries at least load under sel_ldr |
| 202 LogExecute toolchain/bin/le32-nacl-strings --version | 205 LogExecute toolchain/bin/le32-nacl-clang --version |
| 203 LogExecute toolchain/bin/arm-nacl-readelf --version | 206 LogExecute toolchain/bin/arm-nacl-readelf --version |
| 204 LogExecute toolchain/bin/x86_64-nacl-as --version | 207 LogExecute toolchain/bin/x86_64-nacl-as --version |
| 205 LogExecute toolchain/bin/clang --version | 208 LogExecute toolchain/bin/clang --version |
| 206 | 209 |
| 207 TestNaClClang | 210 TestNaClClang |
| 208 } | 211 } |
| 209 | 212 |
| 210 TestNaClClang() { | 213 TestNaClClang() { |
| 211 # Try compiling and running a simple hello world program. We have to | 214 # Try compiling and running a simple hello world program. We have to |
| 212 # use explicit compile, assemble and link commands since sel_ldr doesn't | 215 # use explicit compile, assemble and link commands since sel_ldr doesn't |
| (...skipping 29 matching lines...) Expand all Loading... |
| 242 -L$PWD/toolchain/bin/../x86_64-nacl/usr/lib | 245 -L$PWD/toolchain/bin/../x86_64-nacl/usr/lib |
| 243 -L$PWD/toolchain/bin/../lib/clang/3.7.0/lib/x86_64-nacl | 246 -L$PWD/toolchain/bin/../lib/clang/3.7.0/lib/x86_64-nacl |
| 244 ./hello.o --start-group -lc -lgcc --as-needed -lgcc_eh --no-as-needed | 247 ./hello.o --start-group -lc -lgcc --as-needed -lgcc_eh --no-as-needed |
| 245 --end-group | 248 --end-group |
| 246 $PWD/toolchain/bin/../lib/clang/3.7.0/lib/x86_64-nacl/crtend.o | 249 $PWD/toolchain/bin/../lib/clang/3.7.0/lib/x86_64-nacl/crtend.o |
| 247 $PWD/toolchain/bin/../x86_64-nacl/lib/crtn.o | 250 $PWD/toolchain/bin/../x86_64-nacl/lib/crtn.o |
| 248 " | 251 " |
| 249 LogExecute $link_command | 252 LogExecute $link_command |
| 250 RunSelLdrCommand hello.nexe | 253 RunSelLdrCommand hello.nexe |
| 251 } | 254 } |
| OLD | NEW |