Index: pnacl/build.sh |
=================================================================== |
--- pnacl/build.sh (revision 7831) |
+++ pnacl/build.sh (working copy) |
@@ -176,6 +176,9 @@ |
readonly SYSROOT_DIR="${INSTALL_NEWLIB}/sysroot" |
readonly FAKE_INSTALL_DIR="${INSTALL_PKG}/fake" |
+readonly LLVM_GOLD_PLUGIN_DIR="${LLVM_INSTALL_DIR}"/plugin |
+readonly LLVM_GOLD_PLUGIN="${LLVM_GOLD_PLUGIN_DIR}"/gold-plugin-static.o |
+ |
# TODO(pdox): Consider getting rid of pnacl-ld libmode bias, |
# and merging these two. |
readonly PNACL_LD_NEWLIB="${INSTALL_NEWLIB_BIN}/pnacl-ld" |
@@ -254,10 +257,10 @@ |
fi |
# Current milestones in each repo |
-readonly UPSTREAM_REV=${UPSTREAM_REV:-1de82863028c} |
+readonly UPSTREAM_REV=${UPSTREAM_REV:-fb48564375b4} |
readonly NEWLIB_REV=346ea38d142f |
-readonly BINUTILS_REV=ae568f8eb6e0 |
+readonly BINUTILS_REV=3cd8f04ea3b2 |
readonly COMPILER_RT_REV=1a3a6ffb31ea |
readonly LLVM_PROJECT_REV=${LLVM_PROJECT_REV:-147864} |
@@ -278,6 +281,7 @@ |
CC=${CC:-gcc} |
CXX=${CXX:-g++} |
+AR=${AR:-ar} |
if ${HOST_ARCH_X8632} ; then |
# These are simple compiler wrappers to force 32bit builds |
# For bots and releases we build the toolchains |
@@ -803,8 +807,8 @@ |
clean-logs |
+ llvm |
binutils |
- llvm |
driver |
libs |
@@ -1240,42 +1244,32 @@ |
make ${MAKE_OPTS} install |
spopd |
- llvm-install-links |
+ llvm-install-plugin |
} |
-llvm-install-links() { |
- local makelink="ln -sf" |
+# Produces gold-plugin-static.o, which is the gold plugin |
+# with all LLVM dependencies statically linked in. |
+llvm-install-plugin() { |
+ StepBanner "LLVM" "Installing plugin" |
+ mkdir -p "${LLVM_GOLD_PLUGIN_DIR}" |
- # On Windows, these can't be symlinks. |
- if ${BUILD_PLATFORM_WIN}; then |
- makelink="cp -a" |
- fi |
+ # This pulls every LLVM dependency needed for gold-plugin.o and libLTO. |
+ local components="x86 arm linker analysis ipo bitwriter" |
- mkdir -p "${BFD_PLUGIN_DIR}" |
+ ${CC} -r -nostdlib \ |
+ "${TC_BUILD_LLVM}"/tools/gold/Release+Asserts/gold-plugin.o \ |
+ -L "${TC_BUILD_LLVM}"/Release+Asserts/lib \ |
+ -Wl,-Bstatic \ |
+ -lLTO \ |
+ $("${LLVM_INSTALL_DIR}"/bin/llvm-config --libs ${components}) \ |
+ -o "${LLVM_GOLD_PLUGIN}" |
jvoung - send to chromium...
2012/06/22 19:58:49
Perhaps this shouldn't have been a single .o file
|
- # TODO(pdox): These may no longer be necessary. |
- if [ -f "${BFD_PLUGIN_DIR}/../../../llvm/${SO_DIR}/LLVMgold${SO_EXT}" ]; then |
- # this is to make sure whatever name LLVMgold.so is, it is always |
- # libLLVMgold.so as far as PNaCl is concerned |
- |
- StepBanner "Symlinking LLVMgold.so to libLLVMgold.so in " \ |
- "${BFD_PLUGIN_DIR}/../../../llvm/${SO_DIR}" |
- |
- (cd "${BFD_PLUGIN_DIR}/../../../llvm/${SO_DIR}"; |
- ${makelink} "LLVMgold${SO_EXT}" "${SO_PREFIX}LLVMgold${SO_EXT}"; |
- ) |
- fi |
- |
- spushd "${BFD_PLUGIN_DIR}" |
- |
- ${makelink} ../../../llvm/${SO_DIR}/${SO_PREFIX}LLVMgold${SO_EXT} . |
- ${makelink} ../../../llvm/${SO_DIR}/${SO_PREFIX}LTO${SO_EXT} . |
- spopd |
- |
- spushd "${BINUTILS_INSTALL_DIR}/${SO_DIR}" |
- ${makelink} ../../llvm/${SO_DIR}/${SO_PREFIX}LTO${SO_EXT} . |
- ${makelink} ../../llvm/${SO_DIR}/${SO_PREFIX}LLVMgold${SO_EXT} . |
- spopd |
+ # Force re-link of ld, gold, ar, ranlib, nm |
+ rm -f "${TC_BUILD_BINUTILS}"/binutils/ar |
+ rm -f "${TC_BUILD_BINUTILS}"/binutils/nm-new |
+ rm -f "${TC_BUILD_BINUTILS}"/binutils/ranlib |
+ rm -f "${TC_BUILD_BINUTILS}"/gold/ld-new |
+ rm -f "${TC_BUILD_BINUTILS}"/ld/ld-new |
} |
######################################################################### |
@@ -1962,12 +1956,8 @@ |
SkipBanner "BINUTILS" "configure" |
fi |
- if binutils-needs-make; then |
- binutils-make |
- else |
- SkipBanner "BINUTILS" "make" |
- fi |
- |
+ binutils-dlwrap |
+ binutils-make |
binutils-install |
} |
@@ -1978,6 +1968,23 @@ |
rm -rf ${objdir} |
} |
+binutils-dlwrap() { |
+ local srcdir="${TC_SRC_BINUTILS}" |
+ local objdir="${TC_BUILD_BINUTILS}" |
+ |
+ if ! [ -f "${LLVM_GOLD_PLUGIN}" ]; then |
+ Fatal "LLVM must be installed before building binutils." |
+ fi |
+ |
+ # Build libdlwrap.a |
+ mkdir -p "${objdir}/dlwrap" |
+ spushd "${objdir}/dlwrap" |
+ ${CC} -c "${srcdir}"/dlwrap/dlwrap.c -o dlwrap.o |
+ cp "${LLVM_GOLD_PLUGIN}" gold_plugin_static.o |
+ ${AR} crs libdlwrap.a dlwrap.o gold_plugin_static.o |
+ spopd |
+} |
+ |
#+ binutils-configure- Configure binutils for ARM |
binutils-configure() { |
StepBanner "BINUTILS" "Configure" |
@@ -1996,12 +2003,16 @@ |
# TODO(pdox): Building binutils for nacl/nacl64 target currently requires |
# providing NACL_ALIGN_* defines. This should really be defined inside |
# binutils instead. |
+ local flags="-DNACL_ALIGN_BYTES=32 -DNACL_ALIGN_POW2=5 \ |
+ -I${TC_SRC_BINUTILS}/dlwrap -DENABLE_DLWRAP" |
RunWithLog binutils.configure \ |
env -i \ |
PATH="/usr/bin:/bin" \ |
CC="${CC}" \ |
CXX="${CXX}" \ |
- CFLAGS="-DNACL_ALIGN_BYTES=32 -DNACL_ALIGN_POW2=5" \ |
+ LDFLAGS="-L${objdir}/dlwrap" \ |
+ CFLAGS="${flags}" \ |
+ CXXFLAGS="${flags}" \ |
${srcdir}/binutils-2.20/configure --prefix="${BINUTILS_INSTALL_DIR}" \ |
--target=${BINUTILS_TARGET} \ |
--enable-targets=${targ} \ |
@@ -2024,16 +2035,6 @@ |
return $? |
} |
-binutils-needs-make() { |
- local srcdir="${TC_SRC_BINUTILS}" |
- local objdir="${TC_BUILD_BINUTILS}" |
- local ret=1 |
- binutils-mess-hide |
- ts-modified "$srcdir" "$objdir" && ret=0 |
- binutils-mess-unhide |
- return ${ret} |
-} |
- |
#+ binutils-make - Make binutils for ARM |
binutils-make() { |
StepBanner "BINUTILS" "Make" |
@@ -2605,6 +2606,7 @@ |
--enable-targets=${BINUTILS_SB_ELF_TARGETS} \ |
--disable-nls \ |
--disable-werror \ |
+ --disable-plugins \ |
--enable-static \ |
--enable-shared=no |
spopd |