From 0e4bad0334f9c60f195735d21defd85e726878f9 Mon Sep 17 00:00:00 2001 From: zhoujingya Date: Fri, 20 Sep 2024 10:00:09 +0800 Subject: [PATCH] Disable rtti --- CMakeLists.txt | 2 +- src/smallcc/CMakeLists.txt | 5 +++-- src/smallcc/smallcc-main.cpp | 2 +- src/support/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7330195..b01dc9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/smallcc/CMakeLists.txt b/src/smallcc/CMakeLists.txt index a1574ab..e89672b 100644 --- a/src/smallcc/CMakeLists.txt +++ b/src/smallcc/CMakeLists.txt @@ -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) diff --git a/src/smallcc/smallcc-main.cpp b/src/smallcc/smallcc-main.cpp index fab5f97..193fb17 100644 --- a/src/smallcc/smallcc-main.cpp +++ b/src/smallcc/smallcc-main.cpp @@ -14,7 +14,7 @@ std::string getInputFile(llvm::StringRef filename) { llvm::ErrorOr> 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(); } diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt index 2d3b9f1..596a480 100644 --- a/src/support/CMakeLists.txt +++ b/src/support/CMakeLists.txt @@ -1,3 +1,3 @@ add_executable(commandline commandline.cpp) -target_link_libraries(commandline LLVMCore LLVMSupport) +target_link_libraries(commandline PRIVATE LLVMCore LLVMSupport)