[flang-commits] [flang] 6637259 - [flang] Disable libc++ assertions in the runtime library

Shao-Ce SUN via flang-commits flang-commits at lists.llvm.org
Mon Feb 13 18:18:20 PST 2023


Author: Shao-Ce SUN
Date: 2023-02-14T10:18:11+08:00
New Revision: 663725947bae26a94f067c72f21b10ed6df9dc27

URL: https://github.com/llvm/llvm-project/commit/663725947bae26a94f067c72f21b10ed6df9dc27
DIFF: https://github.com/llvm/llvm-project/commit/663725947bae26a94f067c72f21b10ed6df9dc27.diff

LOG: [flang] Disable libc++ assertions in the runtime library

Similar to D143168. Solve compiling error caused by D143612.

Error info:
```
flang-new -flang-experimental-exec hello.f90
/usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x25
llvm-project/build/lib/libFortranRuntime.a(unit.cpp.o): in function `std::__1::optional<unsigned long>::operator*[abi:v170000]() &':
unit.cpp:(.text._ZNRSt3__18optionalImEdeB7v170000Ev[_ZNRSt3__18optionalImEdeB7v170000Ev]+0x4f): undefined reference to `std::__1::__libcpp_verbose_abort(char const*, ...)'
/usr/bin/ld: llvm-project/build/lib/libFortranRuntime.a(unit.cpp.o): in function `void std::__1::__optional_storage_base<long, false>::__construct[abi:v170000]<unsigned long>(unsigned long&&)':
unit.cpp:(.text._ZNSt3__123__optional_storage_baseIlLb0EE11__constructB7v170000IJmEEEvDpOT_[_ZNSt3__123__optional_storage_baseIlLb0EE11__constructB7v170000IJmEEEvDpOT_]+0x55): undefined reference to `std::__1::__libcpp_verbose_abort(char const*, ...)'
```

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D143890

Added: 
    

Modified: 
    flang/runtime/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt
index e0a8f2c44145f..1e289d35cdfa9 100644
--- a/flang/runtime/CMakeLists.txt
+++ b/flang/runtime/CMakeLists.txt
@@ -86,9 +86,10 @@ include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR})
 append(${NO_LTO_FLAGS} CMAKE_C_FLAGS)
 append(${NO_LTO_FLAGS} CMAKE_CXX_FLAGS)
 
-# Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to
-# avoid an unwanted dependency on libstdc++.so.
+# Disable libstdc++/libc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build,
+# to avoid an unwanted dependency on libstdc++/libc++.so.
 add_definitions(-U_GLIBCXX_ASSERTIONS)
+add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS)
 
 add_subdirectory(FortranMain)
 


        


More information about the flang-commits mailing list