Skip to content

Commit

Permalink
Merge branch 'master' into xor-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelf authored Feb 19, 2024
2 parents 48fec83 + 8978760 commit f9033ae
Show file tree
Hide file tree
Showing 72 changed files with 3,166 additions and 738 deletions.
24 changes: 24 additions & 0 deletions .adacore-gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'

anod_build:
services:
- image:sandbox
- cpu:8
- mem:16
stage: build
script:
- export ANOD_DEFAULT_SANDBOX_DIR=/it/wave

# Check out QSYM
- cd runtime/qsym_backend
- git clone -b symcc https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/eng/fuzz/qsym

# Use our repositories
- anod vcs --add-repo symcc $CI_PROJECT_DIR
- anod vcs --add-repo qsym $CI_PROJECT_DIR/runtime/qsym_backend/qsym

# Build SymCC
- anod source symcc
- anod build symcc
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BasedOnStyle: LLVM
...
19 changes: 19 additions & 0 deletions .github/workflows/check_style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check coding style
on: [pull_request]
jobs:
coding_style:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run clang-format
shell: bash
run: |
format_changes=$(git clang-format-14 --quiet --diff \
${{ github.event.pull_request.base.sha }} \
${{ github.event.pull_request.head.sha }} | wc -c)
if [[ $format_changes -ne 0 ]]; then
echo "Please format your changes with clang-format using the LLVM style, e.g., git clang-format --style LLVM before committing"
exit 1
fi
63 changes: 62 additions & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Compile and test SymCC
on: [push, pull_request]
on: [pull_request, workflow_dispatch]
jobs:
build_and_test_symcc:
runs-on: ubuntu-20.04
Expand All @@ -15,3 +15,64 @@ jobs:
run: docker build --target builder_qsym -t symcc .
- name: Creation of the final SymCC docker image with Qsym backend and libcxx
run: docker build -t symcc .
llvm_compatibility:
runs-on: ubuntu-22.04
strategy:
matrix:
llvm_version: [11, 12, 13, 14, 15]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
llvm-${{ matrix.llvm_version }}-dev \
libz3-dev \
python2
- name: Build SymCC with the QSYM backend
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DZ3_TRUST_SYSTEM_VERSION=ON \
-DQSYM_BACKEND=ON \
-DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm_version }}/cmake \
..
make
llvm_compatibility_latest_llvm:
runs-on: ubuntu-22.04
strategy:
matrix:
llvm_version: [16, 17]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Add LLVM project deb repository
uses: myci-actions/add-deb-repo@11
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ matrix.llvm_version }} main
repo-name: llvm
update: false
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
llvm-${{ matrix.llvm_version }}-dev \
libz3-dev \
python2
- name: Build SymCC with the QSYM backend
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DZ3_TRUST_SYSTEM_VERSION=ON \
-DQSYM_BACKEND=ON \
-DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm_version }}/cmake \
..
make
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ TAGS
# Clang tooling
compile_commands.json
.clangd
.cache

# Build directories
build*
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
cmake_minimum_required(VERSION 3.5)
project(SymbolicCompiler)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

option(QSYM_BACKEND "Use the Qsym backend instead of our own" OFF)
option(TARGET_32BIT "Make the compiler work correctly with -m32" OFF)

Expand All @@ -33,10 +35,12 @@ set(SYM_RUNTIME_BUILD_ARGS
-DCMAKE_CXX_FLAGS_INIT=${CMAKE_CXX_FLAGS_INIT}
-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}
-DCMAKE_EXE_LINKER_FLAGS_INIT=${CMAKE_EXE_LINKER_FLAGS_INIT}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_MODULE_LINKER_FLAGS=${CMAKE_MODULE_LINKER_FLAGS}
-DCMAKE_MODULE_LINKER_FLAGS_INIT=${CMAKE_MODULE_LINKER_FLAGS_INIT}
-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS_INIT=${CMAKE_SHARED_LINKER_FLAGS_INIT}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-DCMAKE_SYSROOT=${CMAKE_SYSROOT}
-DQSYM_BACKEND=${QSYM_BACKEND}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand Down Expand Up @@ -76,8 +80,8 @@ find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake from ${LLVM_DIR}")

if (${LLVM_VERSION_MAJOR} LESS 8 OR ${LLVM_VERSION_MAJOR} GREATER 11)
message(WARNING "The software has been developed for LLVM 8 through 11; \
if (${LLVM_VERSION_MAJOR} LESS 8 OR ${LLVM_VERSION_MAJOR} GREATER 17)
message(WARNING "The software has been developed for LLVM 8 through 17; \
it is unlikely to work with other versions!")
endif()

Expand All @@ -87,7 +91,7 @@ include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 \
-Wredundant-decls -Wcast-align -Wmissing-include-dirs -Wswitch-default \
-Wextra -Wall -Winvalid-pch -Wredundant-decls -Wformat=2 \
-Wmissing-format-attribute -Wformat-nonliteral -Werror")
-Wmissing-format-attribute -Wformat-nonliteral -Werror -Wno-error=deprecated-declarations")

# Mark nodelete to work around unload bug in upstream LLVM 5.0+
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,nodelete")
Expand All @@ -114,6 +118,12 @@ if (NOT CLANG_BINARY)
message(FATAL_ERROR "Clang not found; please make sure that the version corresponding to your LLVM installation is available.")
endif()

if (${LLVM_VERSION_MAJOR} LESS 13)
set(CLANG_LOAD_PASS "-Xclang -load -Xclang ")
else()
set(CLANG_LOAD_PASS "-fpass-plugin=")
endif()

configure_file("compiler/symcc.in" "symcc" @ONLY)
configure_file("compiler/sym++.in" "sym++" @ONLY)

Expand Down
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing to SymCC

We encourage everyone to contribute improvements and bug fixes to SymCC. Our
preferred way of accepting contributions is via GitHub pull requests. Please be
sure to run clang-format on any C/C++ code you change; an easy way to do so is
with `git clang-format --style LLVM` just before committing. (On Ubuntu, you can
get `git-clang-format` via `apt install clang-format`.) Ideally, also add a test
to your patch (see the
[docs](https://github.com/eurecom-s3/symcc/blob/master/docs/Testing.txt) for
details). Unfortunately, since the project is a bit short on developers at the
moment, we have to ask for your patience while we review your PR.

Please note that any contributions you make are licensed under the same terms as
the code you're contributing to, as per the GitHub Terms of Service, [section
D.6](https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#6-contributions-under-repository-license).
At the time of writing, this means LGPL (version 3 or later) for the SymCC
runtime, and GPL (version 3 or later) for the rest of SymCC.
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
#
# The base image
#
FROM ubuntu:20.04 AS builder
FROM ubuntu:22.04 AS builder

# Install dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
cargo \
clang-10 \
clang-15 \
cmake \
g++ \
git \
libz3-dev \
llvm-10-dev \
llvm-10-tools \
llvm-15-dev \
llvm-15-tools \
ninja-build \
python2 \
python3-pip \
Expand All @@ -42,7 +42,7 @@ RUN git clone -b v2.56b https://github.com/google/AFL.git afl \

# Download the LLVM sources already so that we don't need to get them again when
# SymCC changes
RUN git clone -b llvmorg-10.0.1 --depth 1 https://github.com/llvm/llvm-project.git /llvm_source
RUN git clone -b llvmorg-15.0.0 --depth 1 https://github.com/llvm/llvm-project.git /llvm_source

# Build a version of SymCC with the simple backend to compile libc++
COPY . /symcc_source
Expand Down Expand Up @@ -105,14 +105,14 @@ RUN cmake -G Ninja \
#
# The final image
#
FROM ubuntu:20.04
FROM ubuntu:22.04

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
clang-10 \
clang-15 \
g++ \
libllvm10 \
libllvm15 \
zlib1g \
sudo \
&& rm -rf /var/lib/apt/lists/* \
Expand All @@ -127,8 +127,8 @@ COPY --from=builder_qsym /afl /afl

ENV PATH /symcc_build:$PATH
ENV AFL_PATH /afl
ENV AFL_CC clang-10
ENV AFL_CXX clang++-10
ENV AFL_CC clang-15
ENV AFL_CXX clang++-15
ENV SYMCC_LIBCXX_PATH=/libcxx_symcc_install

USER ubuntu
Expand Down
Loading

0 comments on commit f9033ae

Please sign in to comment.