[libc-commits] [PATCH] D118889: [libc] Disable rtti/expections
Guillaume Chatelet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Feb 3 04:38:36 PST 2022
gchatelet created this revision.
gchatelet added a reviewer: sivachandra.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added a project: libc-project.
gchatelet requested review of this revision.
llvm-libc exhibits a C interface but its source is C++.
This patch explicitly disables the use of exceptions and RTTI when compiling the entrypoints.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118889
Files:
libc/cmake/modules/LLVMLibCObjectRules.cmake
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -5,6 +5,18 @@
if(NOT ${LIBC_TARGET_OS} STREQUAL "windows")
set(compile_options ${compile_options} -fpie -ffreestanding)
endif()
+ if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ list(APPEND compile_options "-fno-exceptions")
+ list(APPEND compile_options "-fno-unwind-tables")
+ list(APPEND compile_options "-fno-asynchronous-unwind-tables")
+ list(APPEND compile_options "-fno-rtti")
+ elseif(MSVC)
+ list(APPEND compile_options "/EHs-c-")
+ list(APPEND compile_options "/GR-")
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL")
+ list(APPEND compile_options "-qnoeh")
+ list(APPEND compile_options "-qnortti")
+ endif()
set(${output_var} ${compile_options} PARENT_SCOPE)
endfunction()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118889.405579.patch
Type: text/x-patch
Size: 937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220203/03ba040d/attachment-0001.bin>
More information about the libc-commits
mailing list