Skip to content

Commit

Permalink
Update clang and gcc to latest version.
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhaom committed Jun 15, 2017
1 parent c6a7272 commit 47c7124
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 48 deletions.
14 changes: 10 additions & 4 deletions build_crosstool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CROSSTOOL_GCC_VERSION="4.9"

# Assume the clang source code is checked out following
# http://clang.llvm.org/get_started.html
CROSSTOOL_CLANG_VERSION="3.7"
CROSSTOOL_CLANG_VERSION="4.0"

: ${crosstool_rpmver:="1.0"}
# Update this each time new RPM's are built.
Expand All @@ -54,12 +54,14 @@ for pkg in runtime headers gde; do
dpkg -i ${DEB_DIR}/${GRTEBASENAME}-${pkg}_${grte_rpmver}-${grte_rpmrel}_amd64.deb
done

# sed -e "s:/usr/lrte/v3/lib64/::g" -i /usr/lrte/v3/lib64/libm.so

# Use bash as shell, other "source" command inside rpm spec will fail.
ln -sf /bin/bash /bin/sh

# install packages that are needed by building binutils and clang
apt-get update
apt-get install -y flex bison rpm texinfo texi2html libxml2-dev make alien
apt-get install -y flex bison rpm texinfo texi2html libxml2-dev make alien wget

function build_rpm() {
local rpmrel=$1
Expand All @@ -79,6 +81,10 @@ function build_rpm() {
--define "grte_glibc_version ${glibc_version}" \
--define "grte_rpmver ${grte_rpmver}" \
--define "grte_rpmrel ${grte_rpmrel}" \
--define "binutils_version ${binutils_version}" \
--define "gmp_version ${gmp_version}" \
--define "mpfr_version ${mpfr_version}" \
--define "mpc_version ${mpc_version}" \
--define "crosstool_scripts ${absroot}/crosstool/scripts" \
--define "crosstool_version ${CROSSTOOL_VERSION}" \
--define "crosstool_rpmver ${crosstool_rpmver}" \
Expand Down Expand Up @@ -120,10 +126,10 @@ dpkg -i ${DEB_DIR}/${GRTEBASENAME}-crosstool${CROSSTOOL_VERSION}-gcc-${CROSSTOOL

# Build cmake because cmake in ubuntu 13 is too old
mkdir -p ${STAGING}/cmake
CMAKE_VERSION=3.3.2
CMAKE_VERSION=3.8.2
if [ ! -e ${CROSSTOOL_SOURCES}/cmake-${CMAKE_VERSION}.tar.gz ]; then
pushd ${CROSSTOOL_SOURCES}
wget http://cmake.org/files/v3.3/cmake-${CMAKE_VERSION}.tar.gz
wget http://cmake.org/files/v3.8/cmake-${CMAKE_VERSION}.tar.gz
popd
fi
tar zxf ${CROSSTOOL_SOURCES}/cmake-${CMAKE_VERSION}.tar.gz -C ${STAGING}/cmake
Expand Down
3 changes: 2 additions & 1 deletion crosstool/crosstool-grte-clang.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH"
%{target_top}/x86/bin/*
%{target_top}/x86/include/*
%{target_top}/x86/lib/*
%{target_top}/x86/libexec/*
%{target_top}/x86/share/*

%changelog
* Mon Jun 01 2015 Release Engineer <%{maintainer_email}>
* Mon Jun 12 2017 Release Engineer <%{maintainer_email}>
- Clang %{crosstool_clang_version} with SVN %{clang_svn_version}.
20 changes: 10 additions & 10 deletions crosstool/crosstool-grte-gcc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ AutoReqProv: no
Requires: %{grte_basename}-runtime %{grte_basename}-headers

# Source0: crosstool-scripts.tar.gz
Source0: binutils-2.25.tar.bz2
Source0: binutils-%{binutils_version}.tar.bz2
# Patch0: binutils-2.24-set-section-macros.patch
Source1: gmp-6.0.0a.tar.bz2
Source2: mpc-1.0.3.tar.gz
Source3: mpfr-3.1.2.tar.bz2
Source1: gmp-%{gmp_version}.tar.bz2
Source2: mpc-%{mpc_version}.tar.gz
Source3: mpfr-%{mpfr_version}.tar.bz2

BuildRoot: %{_tmppath}/%{name}-buildroot

Expand Down Expand Up @@ -65,7 +65,7 @@ export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH"

WORK_DIR="$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION"

BINUTILS_SRC_SUBDIR="binutils-2.25"
BINUTILS_SRC_SUBDIR="binutils-%{binutils_version}"
GCC_SRC_SUBDIR="gcc-%{crosstool_gcc_version}"

CFLAGS="-O2 -isystem %{grte_top}/include -L%{grte_top}/lib64"
Expand Down Expand Up @@ -119,9 +119,9 @@ build_binutils "$WORK_DIR/$BINUTILS_SRC_SUBDIR" "$WORK_DIR/build-binutils" \
export PATH="${PREFIX}/bin:${PREFIX}/sbin:$PATH"
# Checked out into upstream/ from svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9
cp -r %{_sourcedir}/gcc-4_9 $WORK_DIR/gcc-src
mv $WORK_DIR/gmp-6.0.0 $WORK_DIR/gcc-src/gmp
mv $WORK_DIR/mpc-1.0.3 $WORK_DIR/gcc-src/mpc
mv $WORK_DIR/mpfr-3.1.2 $WORK_DIR/gcc-src/mpfr
mv $WORK_DIR/gmp-%{gmp_version} $WORK_DIR/gcc-src/gmp
mv $WORK_DIR/mpc-%{mpc_version} $WORK_DIR/gcc-src/mpc
mv $WORK_DIR/mpfr-%{mpfr_version} $WORK_DIR/gcc-src/mpfr

mkdir $WORK_DIR/build-gcc
cd $WORK_DIR/build-gcc
Expand Down Expand Up @@ -201,5 +201,5 @@ export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH"
%{target_top}/x86/*

%changelog
* Mon Jun 01 2015 Ming Zhao <mzhao@luminatewireless.com>
- Build gcc 4.9(@svn %{gcc_svn_version}) and binutils 2.25.
* Mon Jun 12 2017 Ming Zhao <mingzhao@gmail.com>
- Build gcc 4.9(@svn %{gcc_svn_version}) and binutils 2.28
47 changes: 14 additions & 33 deletions upstream/clang-grte-runtime.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 238804)
--- CMakeLists.txt (revision 305394)
+++ CMakeLists.txt (working copy)
@@ -192,6 +192,12 @@
@@ -239,6 +239,12 @@
add_definitions( -DCLANG_VENDOR="${CLANG_VENDOR} " )
endif()

Expand All @@ -15,37 +15,18 @@ Index: CMakeLists.txt
set(CLANG_REPOSITORY_STRING "" CACHE STRING
"Vendor-specific text for showing the repository the source is taken from.")

Index: lib/Driver/Tools.cpp
Index: lib/Driver/ToolChains/Linux.cpp
===================================================================
--- lib/Driver/Tools.cpp (revision 238804)
+++ lib/Driver/Tools.cpp (working copy)
@@ -7827,9 +7827,15 @@
return "/lib64/ld-linux.so.2";
else if (ToolChain.getArch() == llvm::Triple::x86_64 &&
ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32)
+#ifdef GRTE_ROOT
+ return GRTE_ROOT "/libx32/ld-linux-x32.so.2";
+ else
+ return GRTE_ROOT "/lib64/ld-linux-x86-64.so.2";
+#else
return "/libx32/ld-linux-x32.so.2";
else
return "/lib64/ld-linux-x86-64.so.2";
+#endif
--- lib/Driver/ToolChains/Linux.cpp (revision 305394)
+++ lib/Driver/ToolChains/Linux.cpp (working copy)
@@ -577,8 +577,8 @@

if (Distro == Distro::Exherbo && (Triple.getVendor() == llvm::Triple::UnknownVendor ||
Triple.getVendor() == llvm::Triple::PC))
- return "/usr/" + Triple.str() + "/lib/" + Loader;
- return "/" + LibDir + "/" + Loader;
+ return GRTE_ROOT "/usr/" + Triple.str() + "/lib/" + Loader;
+ return GRTE_ROOT "/" + LibDir + "/" + Loader;
}

static void AddRunTimeLibs(const ToolChain &TC, const Driver &D,
Index: lib/Frontend/InitHeaderSearch.cpp
===================================================================
--- lib/Frontend/InitHeaderSearch.cpp (revision 238804)
+++ lib/Frontend/InitHeaderSearch.cpp (working copy)
@@ -512,8 +512,7 @@
// fudged system headers.
if (triple.getOS() == llvm::Triple::Solaris)
AddPath("/usr/include/c++/v1/support/solaris", CXXSystem, false);
-
- AddPath("/usr/include/c++/v1", CXXSystem, false);
+ AddPath(GRTE_ROOT "/include/c++/v1", CXXSystem, false);
} else {
AddDefaultCPlusPlusIncludePaths(triple, HSOpts);
}
void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,

0 comments on commit 47c7124

Please sign in to comment.