Skip to content

Commit

Permalink
Disable rtti
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoujingya committed Sep 20, 2024
1 parent 369040e commit 0e4bad0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.22)
project(llvm-essential
project(compiler-essential
VERSION 1.0.0)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
5 changes: 3 additions & 2 deletions src/smallcc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

set(CXX_STANDARD c++17)
set(CMAKE_CXX_FLAGS "-fno-common")
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fno-common")

add_executable(smallcc smallcc-main.cpp)

target_link_libraries(smallcc PRIVATE LLVMSupport)
# NOTE: it's bery important to disable
target_link_libraries(smallcc PRIVATE LLVMCore LLVMSupport)
2 changes: 1 addition & 1 deletion src/smallcc/smallcc-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ std::string getInputFile(llvm::StringRef filename) {
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> fileOrErr =
llvm::MemoryBuffer::getFileOrSTDIN(filename);
if (std::error_code ec = fileOrErr.getError())
llvm::report_fatal_error("Could not open input file: "+ filename);
llvm::report_fatal_error("Could not open input file: " + filename);
return fileOrErr.get()->getBuffer().str();
}

Expand Down
2 changes: 1 addition & 1 deletion src/support/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(commandline commandline.cpp)

target_link_libraries(commandline LLVMCore LLVMSupport)
target_link_libraries(commandline PRIVATE LLVMCore LLVMSupport)

0 comments on commit 0e4bad0

Please sign in to comment.