Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed stubs.c and patch file path with corrected command. #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:18.04

MAINTAINER Tanmay

# Setting Environment variables.
ENV KLEE_HOME_DIR=/home/Gklee
ENV PATH=$KLEE_HOME_DIR/bin:$PATH

# Updating apt-get distro
RUN apt-get update

# Installing all dependencies using apt-get
RUN apt-get install -y gcc-4.8 g++-4.8 cmake git wget python vim doxygen zlib1g zlib1g-dev bison flex build-essential

# Switching alternatives to gcc and g++ to 4.8
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10

# Cloning the repository
RUN cd /home && git clone https://github.com/tanmaytirpankar/Gklee.git

# Fixing gklee-nvcc to use the correct gcc toolchain
RUN cd /home/Gklee && sed -i "s|-Xclang -fgpu-device|-Xclang -fgpu-device -gcc-toolchain /usr/include/c++/4.8.5|g" bin/gklee-nvcc

# Changing build mode to Release
RUN cd /home/Gklee && sed -i "s|CMAKE_BUILD_TYPE RelWithDebInfo|CMAKE_BUILD_TYPE Release|g" CMakeLists.txt

# Building
RUN cd /home/Gklee && mkdir build && cd build && cmake .. && make
2 changes: 2 additions & 0 deletions Gklee/runtime/POSIX/stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ int strverscmp (__const char *__s1, __const char *__s2) {
return strcmp(__s1, __s2); /* XXX no doubt this is bad */
}

/*
unsigned int gnu_dev_major(unsigned long long int __dev) __attribute__((weak));
unsigned int gnu_dev_major(unsigned long long int __dev) {
return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
Expand All @@ -256,6 +257,7 @@ unsigned long long int gnu_dev_makedev(unsigned int __major, unsigned int __mino
| (((unsigned long long int) (__minor & ~0xff)) << 12)
| (((unsigned long long int) (__major & ~0xfff)) << 32));
}
*/

char *canonicalize_file_name (const char *name) __attribute__((weak));
char *canonicalize_file_name (const char *name) {
Expand Down
8 changes: 4 additions & 4 deletions cmake/modules/SetupExterns.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ find_program(PATCH patch)
find_program(BASH bash)

set(
PCMD
cd ${LLVM_SRC}/src/LLVM/tools && if [ ! -e clang ]$<SEMICOLON> then ${DOWNLOAD} http://www.llvm.org/releases/3.2/clang-3.2.src.tar.gz && ${EXTRACT} -zxf clang-3.2.src.tar.gz && mv -f clang-3.2.src clang && rm clang-3.2.src.tar.gz && cd clang && cp ${CMAKE_SOURCE_DIR}/patch/clang.patch ./ && ${PATCH} -p1 -N < clang.patch$<SEMICOLON> fi && cd ${LLVM_SRC}/src/LLVM/projects && if [ ! -e compiler-rt ]$<SEMICOLON> then ${DOWNLOAD} http://www.llvm.org/releases/3.2/compiler-rt-3.2.src.tar.gz && ${EXTRACT} -zxf compiler-rt-3.2.src.tar.gz && mv compiler-rt-3.2.src compiler-rt && rm compiler-rt-3.2.src.tar.gz && cd compiler-rt/lib/asan && cp ${LLVM_SRC}/patch/compiler-rt_lib_asan.patch . && ${PATCH} -p1 -N compiler-rt_lib_asan.patch$<SEMICOLON> fi
PCMD
cd ${LLVM_SRC}/src/LLVM/tools && if [ ! -e clang ]$<SEMICOLON> then ${DOWNLOAD} http://www.llvm.org/releases/3.2/clang-3.2.src.tar.gz && ${EXTRACT} -zxf clang-3.2.src.tar.gz && mv -f clang-3.2.src clang && rm clang-3.2.src.tar.gz && cd clang && cp ${CMAKE_SOURCE_DIR}/patch/clang.patch ./ && ${PATCH} -p1 -N < clang.patch$<SEMICOLON> fi && cd ${LLVM_SRC}/src/LLVM/projects && if [ ! -e compiler-rt ]$<SEMICOLON> then ${DOWNLOAD} http://www.llvm.org/releases/3.2/compiler-rt-3.2.src.tar.gz && ${EXTRACT} -zxf compiler-rt-3.2.src.tar.gz && mv compiler-rt-3.2.src compiler-rt && rm compiler-rt-3.2.src.tar.gz && cd compiler-rt/lib/asan && cp ${LLVM_SRC}/../patch/compiler-rt_lib_asan_linux.patch . && ${PATCH} -p0 -N < compiler-rt_lib_asan_linux.patch$<SEMICOLON> fi
)
string(REPLACE ";" " " PCMD "${PCMD}")
ExternalProject_add(
Expand All @@ -18,8 +18,8 @@ ExternalProject_add(
URL http://www.llvm.org/releases/3.2/llvm-3.2.src.tar.gz
URL_MD5 71610289bbc819e3e15fdd562809a2d7
PATCH_COMMAND ${BASH} -c ${PCMD}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${GLIBCXX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${GLIBCXX}
-std=c++11 -DCMAKE_EXPORT_COMPILE_COMMANDS=${CMAKE_EXPORT_COMPILE_COMMANDS} -DLLVM_TARGETS_TO_BUILD=X86
)

Expand Down