| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 #@ PNaCl toolchain build script | 6 #@ PNaCl toolchain build script |
| 7 #@------------------------------------------------------------------- | 7 #@------------------------------------------------------------------- |
| 8 #@ This script builds the ARM and PNaCl untrusted toolchains. | 8 #@ This script builds the ARM and PNaCl untrusted toolchains. |
| 9 #@ It MUST be run from the native_client/ directory. | 9 #@ It MUST be run from the native_client/ directory. |
| 10 ###################################################################### | 10 ###################################################################### |
| (...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 #+ binutils-configure- Configure binutils for ARM | 1854 #+ binutils-configure- Configure binutils for ARM |
| 1855 binutils-configure() { | 1855 binutils-configure() { |
| 1856 StepBanner "BINUTILS" "Configure" | 1856 StepBanner "BINUTILS" "Configure" |
| 1857 | 1857 |
| 1858 local srcdir="${TC_SRC_BINUTILS}" | 1858 local srcdir="${TC_SRC_BINUTILS}" |
| 1859 local objdir="${TC_BUILD_BINUTILS}" | 1859 local objdir="${TC_BUILD_BINUTILS}" |
| 1860 | 1860 |
| 1861 # enable multiple targets so that we can use the same ar with all .o files | 1861 # enable multiple targets so that we can use the same ar with all .o files |
| 1862 local targ="arm-pc-nacl,i686-pc-nacl,x86_64-pc-nacl" | 1862 local targ="arm-pc-nacl,i686-pc-nacl,x86_64-pc-nacl,mipsel-pc-nacl" |
| 1863 mkdir -p "${objdir}" | 1863 mkdir -p "${objdir}" |
| 1864 spushd "${objdir}" | 1864 spushd "${objdir}" |
| 1865 | 1865 |
| 1866 # The linux escaping is horrible but apparently the only way of doing this: | 1866 # The linux escaping is horrible but apparently the only way of doing this: |
| 1867 # c.f.: http://sourceware.org/ml/binutils/2009-05/msg00252.html | 1867 # c.f.: http://sourceware.org/ml/binutils/2009-05/msg00252.html |
| 1868 # all we try to do here is to add "$ORIGIN/../lib to "rpath". | 1868 # all we try to do here is to add "$ORIGIN/../lib to "rpath". |
| 1869 # If you ever touch this please make sure that rpath is correct via: | 1869 # If you ever touch this please make sure that rpath is correct via: |
| 1870 # objdump -p toolchain/${TOOLCHAIN_LABEL}/host/bin/arm-pc-nacl-ld.gold | 1870 # objdump -p toolchain/${TOOLCHAIN_LABEL}/host/bin/arm-pc-nacl-ld.gold |
| 1871 # objdump -p toolchain/${TOOLCHAIN_LABEL}/host/bin/arm-pc-nacl-objdump | 1871 # objdump -p toolchain/${TOOLCHAIN_LABEL}/host/bin/arm-pc-nacl-objdump |
| 1872 if ${BUILD_PLATFORM_LINUX} ; then | 1872 if ${BUILD_PLATFORM_LINUX} ; then |
| 1873 local flags='-Xlinker -rpath -Xlinker '"'"'$\\$$\$$\\$$\$$ORIGIN/../lib'"'
" | 1873 local flags='-Xlinker -rpath -Xlinker '"'"'$\\$$\$$\\$$\$$ORIGIN/../lib'"'
" |
| 1874 local shared='yes' | 1874 local shared='yes' |
| 1875 local zlib='--without-zlib' | 1875 local zlib='--without-zlib' |
| 1876 else | 1876 else |
| 1877 # The shared build for binutils on mac is currently disabled. | 1877 # The shared build for binutils on mac is currently disabled. |
| 1878 # A mac-expert needs to look at this but | 1878 # A mac-expert needs to look at this but |
| 1879 # It seems that on mac the linker is storing "full" library paths into | 1879 # It seems that on mac the linker is storing "full" library paths into |
| 1880 # the dynamic image, e.g, for the llc dynamic image we see paths like: | 1880 # the dynamic image, e.g, for the llc dynamic image we see paths like: |
| 1881 # @executable_path/../lib/libLLVM-3.3svn.dylib | 1881 # @executable_path/../lib/libLLVM-3.3svn.dylib |
| 1882 # This only works if at linktime the libraries are already at | 1882 # This only works if at linktime the libraries are already at |
| 1883 # @executable_path/../lib which is not the case for mac | 1883 # @executable_path/../lib which is not the case for mac |
| 1884 #local flags="-Xlinker -rpath -Xlinker '@executable_path/../lib'" | 1884 #local flags="-Xlinker -rpath -Xlinker '@executable_path/../lib'" |
| 1885 local flags='' | 1885 local flags='' |
| 1886 local shared='no' | 1886 local shared='no' |
| 1887 local zlib='' | 1887 local zlib='' |
| 1888 fi | 1888 fi |
| 1889 # The --enable-gold and --enable-plugins options are on so that we | 1889 # The --enable-gold and --enable-plugins options are on so that we |
| 1890 # can use gold's support for plugin to link PNaCl modules. | 1890 # can use gold's support for plugin to link PNaCl modules, and use |
| 1891 # gold as the final linker. We do not use bfd ld, and it is disabled |
| 1892 # in part because we do not have its MIPS support downstream. |
| 1891 | 1893 |
| 1892 # We llvm's mc for assembly so we no longer build gas | 1894 # We llvm's mc for assembly so we no longer build gas |
| 1893 # TODO(robertm): We no longer use ld and should really use | |
| 1894 # --enable-ld=no but the binutils build setup is buggy | |
| 1895 RunWithLog binutils.configure \ | 1895 RunWithLog binutils.configure \ |
| 1896 env -i \ | 1896 env -i \ |
| 1897 PATH="${PATH}" \ | 1897 PATH="${PATH}" \ |
| 1898 CC="${CC}" \ | 1898 CC="${CC}" \ |
| 1899 CXX="${CXX}" \ | 1899 CXX="${CXX}" \ |
| 1900 LDFLAGS="${flags}" \ | 1900 LDFLAGS="${flags}" \ |
| 1901 ${srcdir}/configure \ | 1901 ${srcdir}/configure \ |
| 1902 --prefix="${BINUTILS_INSTALL_DIR}" \ | 1902 --prefix="${BINUTILS_INSTALL_DIR}" \ |
| 1903 --target=${BINUTILS_TARGET} \ | 1903 --target=${BINUTILS_TARGET} \ |
| 1904 --enable-targets=${targ} \ | 1904 --enable-targets=${targ} \ |
| 1905 --enable-shared=${shared} \ | 1905 --enable-shared=${shared} \ |
| 1906 --enable-gold=yes \ | 1906 --enable-gold=default \ |
| 1907 --enable-ld=yes \ | 1907 --enable-ld=no \ |
| 1908 --disable-nls \ | 1908 --disable-nls \ |
| 1909 --enable-plugins \ | 1909 --enable-plugins \ |
| 1910 --disable-werror \ | 1910 --disable-werror \ |
| 1911 --without-gas \ | 1911 --without-gas \ |
| 1912 ${zlib} \ | 1912 ${zlib} \ |
| 1913 --with-sysroot="${NONEXISTENT_PATH}" | 1913 --with-sysroot="${NONEXISTENT_PATH}" |
| 1914 # There's no point in setting the correct path as sysroot, because we | 1914 # There's no point in setting the correct path as sysroot, because we |
| 1915 # want the toolchain to be relocatable. The driver will use ld command-line | 1915 # want the toolchain to be relocatable. The driver will use ld command-line |
| 1916 # option --sysroot= to override this value and set it to the correct path. | 1916 # option --sysroot= to override this value and set it to the correct path. |
| 1917 # However, we need to include --with-sysroot during configure to get this | 1917 # However, we need to include --with-sysroot during configure to get this |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3802 | 3802 |
| 3803 if [ "$(type -t $1)" != "function" ]; then | 3803 if [ "$(type -t $1)" != "function" ]; then |
| 3804 #Usage | 3804 #Usage |
| 3805 echo "ERROR: unknown function '$1'." >&2 | 3805 echo "ERROR: unknown function '$1'." >&2 |
| 3806 echo "For help, try:" | 3806 echo "For help, try:" |
| 3807 echo " $0 help" | 3807 echo " $0 help" |
| 3808 exit 1 | 3808 exit 1 |
| 3809 fi | 3809 fi |
| 3810 | 3810 |
| 3811 "$@" | 3811 "$@" |
| OLD | NEW |