Skip to content

Commit b135c12

Browse files
committed
travis: Use upstream LLVM repositories for Fuchsia
The Fuchsia copies of LLVM repositories contain additional patches for work-in-progress features and there is some amount of churn that may break Rust. Use upstream LLVM repositories instead for building the toolchain used by the Fuchsia builder.
1 parent ad5dfec commit b135c12

File tree

3 files changed

+64
-12
lines changed

3 files changed

+64
-12
lines changed

src/ci/docker/dist-fuchsia/Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1414
xz-utils \
1515
swig \
1616
libedit-dev \
17-
libncurses5-dev
17+
libncurses5-dev \
18+
patch
1819

1920
RUN curl -L https://cmake.org/files/v3.8/cmake-3.8.0-rc1-Linux-x86_64.tar.gz | \
2021
tar xzf - -C /usr/local --strip-components=1
2122

2223
WORKDIR /tmp
23-
COPY shared.sh build-toolchain.sh /tmp/
24+
COPY shared.sh build-toolchain.sh compiler-rt-dso-handle.patch /tmp/
2425
RUN /tmp/build-toolchain.sh
2526

2627
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \

src/ci/docker/dist-fuchsia/build-toolchain.sh

+20-10
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,43 @@
99
# option. This file may not be copied, modified, or distributed
1010
# except according to those terms.
1111

12+
# ignore-tidy-linelength
13+
1214
set -ex
1315
source shared.sh
1416

1517
# Download sources
1618
SRCS=(
17-
"https://fuchsia.googlesource.com/magenta magenta ac69119"
18-
"https://fuchsia.googlesource.com/third_party/llvm llvm 5463083"
19-
"https://fuchsia.googlesource.com/third_party/clang llvm/tools/clang 4ff7b4b"
20-
"https://fuchsia.googlesource.com/third_party/lld llvm/tools/lld fd465a3"
21-
"https://fuchsia.googlesource.com/third_party/lldb llvm/tools/lldb 6bb11f8"
22-
"https://fuchsia.googlesource.com/third_party/compiler-rt llvm/runtimes/compiler-rt 52d4ecc"
23-
"https://fuchsia.googlesource.com/third_party/libcxx llvm/runtimes/libcxx e891cc8"
24-
"https://fuchsia.googlesource.com/third_party/libcxxabi llvm/runtimes/libcxxabi f0f0257"
25-
"https://fuchsia.googlesource.com/third_party/libunwind llvm/runtimes/libunwind 50bddc1"
19+
"https://fuchsia.googlesource.com/magenta magenta d17073dc8de344ead3b65e8cc6a12280dec38c84"
20+
"https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025"
21+
"https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111"
22+
"https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b"
23+
"https://llvm.googlesource.com/lldb llvm/tools/lldb 0b2384abec4cb99ad66687712e07dee4dd9d187e"
24+
"https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt 9093a35c599fe41278606a20b51095ea8bd5a081"
25+
"https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 607e0c71ec4f7fd377ad3f6c47b08dbe89f66eaa"
26+
"https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi 0a3a1a8a5ca5ef69e0f6b7d5b9d13e63e6fd2c19"
27+
"https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind e128003563d99d9ee62247c4cee40f07d21c03e3"
2628
)
2729

2830
fetch() {
2931
mkdir -p $2
3032
pushd $2 > /dev/null
31-
curl -sL $1/+archive/$3.tar.gz | tar xzf -
33+
git init
34+
git remote add origin $1
35+
git fetch --depth=1 origin $3
36+
git reset --hard FETCH_HEAD
3237
popd > /dev/null
3338
}
3439

3540
for i in "${SRCS[@]}"; do
3641
fetch $i
3742
done
3843

44+
# Remove this once https://reviews.llvm.org/D28791 is resolved
45+
cd llvm/runtimes/compiler-rt
46+
patch -Np1 < /tmp/compiler-rt-dso-handle.patch
47+
cd ../../..
48+
3949
# Build toolchain
4050
cd llvm
4151
mkdir build
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
2+
index fc4384af2..b442264c0 100644
3+
--- a/lib/builtins/CMakeLists.txt
4+
+++ b/lib/builtins/CMakeLists.txt
5+
@@ -194,6 +194,12 @@ if(APPLE)
6+
atomic_thread_fence.c)
7+
endif()
8+
9+
+if(FUCHSIA)
10+
+ set(GENERIC_SOURCES
11+
+ ${GENERIC_SOURCES}
12+
+ dso_handle.c)
13+
+endif()
14+
+
15+
if(NOT WIN32 OR MINGW)
16+
set(GENERIC_SOURCES
17+
${GENERIC_SOURCES}
18+
diff --git a/lib/builtins/dso_handle.c b/lib/builtins/dso_handle.c
19+
new file mode 100644
20+
index 000000000..7766cd0aa
21+
--- /dev/null
22+
+++ b/lib/builtins/dso_handle.c
23+
@@ -0,0 +1,18 @@
24+
+/* ===-- dso_handle.c - Provide __dso_handle -------------------------------===
25+
+ *
26+
+ * The LLVM Compiler Infrastructure
27+
+ *
28+
+ * This file is dual licensed under the MIT and the University of Illinois Open
29+
+ * Source Licenses. See LICENSE.TXT for details.
30+
+ *
31+
+ * ===----------------------------------------------------------------------===
32+
+ */
33+
+
34+
+/* __dso_handle symbol is mandated by C++ ABI with a value which is an address
35+
+ * in one of the object's segments, and as such this symbol has to be included
36+
+ * statically and cannot be a part of a shared library. Traditionally, it has
37+
+ * been defined in crtbegin.o but there's no principled reason for it to be
38+
+ * there. We defined this symbol in the builtin library which is built as a
39+
+ * static library and always included in the final link.
40+
+ */
41+
+__attribute__((visibility("hidden"))) void *const __dso_handle;

0 commit comments

Comments
 (0)