aboutsummaryrefslogtreecommitdiff
path: root/projects/grpc-swift
diff options
context:
space:
mode:
authorasraa <asraa@google.com>2021-08-19 19:52:44 -0400
committerGitHub <noreply@github.com>2021-08-20 09:52:44 +1000
commit30d927e324f3909ce7a9a9823219fcd8cb185150 (patch)
tree32245764b8291cd20bf37e8f218be494692296dc /projects/grpc-swift
parent7d950a1008fa0f3829d3730482e561eb1345d477 (diff)
downloadoss-fuzz-30d927e324f3909ce7a9a9823219fcd8cb185150.tar.gz
New base builder without lang specific installation + swift base (#5986)
Removes unnecessary stuff in base-builder image to create a base-builder-new, and then adds a base-builder-swift on top of this that swift projects can use (without JVM/Go/etc fuzzing).
Diffstat (limited to 'projects/grpc-swift')
-rw-r--r--projects/grpc-swift/Dockerfile28
-rwxr-xr-xprojects/grpc-swift/build.sh18
-rw-r--r--projects/grpc-swift/llvmsymbol.diff51
3 files changed, 1 insertions, 96 deletions
diff --git a/projects/grpc-swift/Dockerfile b/projects/grpc-swift/Dockerfile
index ccea076b3..8c56c0b2d 100644
--- a/projects/grpc-swift/Dockerfile
+++ b/projects/grpc-swift/Dockerfile
@@ -14,33 +14,7 @@
#
################################################################################
-FROM gcr.io/oss-fuzz-base/base-builder
-
-# generic swift
-RUN apt-get update && apt install -y wget \
- binutils \
- libc6-dev \
- libcurl3 \
- libedit2 \
- libgcc-5-dev \
- libpython2.7 \
- libsqlite3-0 \
- libstdc++-5-dev \
- libxml2 \
- pkg-config \
- tzdata \
- zlib1g-dev
-RUN wget https://swift.org/builds/swift-5.3.3-release/ubuntu1604/swift-5.3.3-RELEASE/swift-5.3.3-RELEASE-ubuntu16.04.tar.gz
-RUN tar xzf swift-5.3.3-RELEASE-ubuntu16.04.tar.gz
-RUN cp -r swift-5.3.3-RELEASE-ubuntu16.04/usr/* /usr/
-
-# generic swift symbolizer
-RUN apt-get update && apt-get install -y build-essential make \
- ninja-build git python3 g++-multilib binutils-dev zlib1g-dev \
- --no-install-recommends
-
-RUN git clone --depth 1 https://github.com/llvm/llvm-project.git
-COPY llvmsymbol.diff $SRC
+FROM gcr.io/oss-fuzz-base/base-builder-swift
# specific to project
RUN git clone --depth 1 https://github.com/grpc/grpc-swift
diff --git a/projects/grpc-swift/build.sh b/projects/grpc-swift/build.sh
index 3c1aaf841..f9f415062 100755
--- a/projects/grpc-swift/build.sh
+++ b/projects/grpc-swift/build.sh
@@ -15,24 +15,6 @@
#
################################################################################
-# generic swift symbolizer
-(
-cd $SRC/llvm-project
-git apply ../llvmsymbol.diff
-cmake -G "Ninja" \
- -DLIBCXX_ENABLE_SHARED=OFF \
- -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
- -DLIBCXXABI_ENABLE_SHARED=OFF \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLVM_TARGETS_TO_BUILD=X86 \
- -DCMAKE_C_COMPILER=clang \
- -DCMAKE_CXX_COMPILER=clang++ \
- -DLLVM_BUILD_TESTS=OFF \
- -DLLVM_INCLUDE_TESTS=OFF llvm
-ninja -j$(nproc) llvm-symbolizer
-cp bin/llvm-symbolizer $OUT/
-)
-
# build project
cd FuzzTesting
# Maybe we should have a helper script to set $SWIFT_FLAGS
diff --git a/projects/grpc-swift/llvmsymbol.diff b/projects/grpc-swift/llvmsymbol.diff
deleted file mode 100644
index c53c978df..000000000
--- a/projects/grpc-swift/llvmsymbol.diff
+++ /dev/null
@@ -1,51 +0,0 @@
-diff --git a/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt b/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
-index acfb3bd0e..5c4cf9763 100644
---- a/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
-+++ b/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
-@@ -12,4 +12,12 @@ add_llvm_component_library(LLVMSymbolize
- Object
- Support
- Demangle
-- )
-+
-+ LINK_LIBS
-+ /usr/lib/swift_static/linux/libswiftCore.a
-+ /usr/lib/swift_static/linux/libswiftImageInspectionShared.a
-+ /usr/lib/swift_static/linux/libicui18nswift.a
-+ /usr/lib/swift_static/linux/libicuucswift.a
-+ /usr/lib/swift_static/linux/libicudataswift.a
-+ /usr/lib/x86_64-linux-gnu/libstdc++.so.6
-+)
-diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
-index 4c3f3a3767e1..aa7b9f0f5abb 100644
---- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
-+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
-@@ -36,6 +36,13 @@
- #include <cassert>
- #include <cstring>
-
-+
-+extern "C" char *swift_demangle(const char *mangledName,
-+ size_t mangledNameLength,
-+ char *outputBuffer,
-+ size_t *outputBufferSize,
-+ uint32_t flags);
-+
- namespace llvm {
- namespace symbolize {
-
-@@ -632,6 +639,14 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
- free(DemangledName);
- return Result;
- }
-+ if (!Name.empty() && Name.front() == '$') {
-+ char *DemangledName = swift_demangle(Name.c_str(), Name.length(), 0, 0, 0);
-+ if (DemangledName) {
-+ std::string Result = DemangledName;
-+ free(DemangledName);
-+ return Result;
-+ }
-+ }
-
- if (DbiModuleDescriptor && DbiModuleDescriptor->isWin32Module())
- return std::string(demanglePE32ExternCFunc(Name));