File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ stages:
9696 configuration: Debug
9797 CC: gcc-9
9898 CXX: g++-9
99+ CMAKE_OPTS: -DLLVM_USE_SPLIT_DWARF=On
99100 MacOS_Clang_Release:
100101 image: ${{ variables.macOS }}
101102 configuration: Release
@@ -164,4 +165,3 @@ stages:
164165 testResultsFormat: 'JUnit'
165166 testResultsFiles: '**/testresults.xunit.xml'
166167 condition: succeededOrFailed()
167-
Original file line number Diff line number Diff line change @@ -567,9 +567,19 @@ if(LLVM_USE_SANITIZER)
567567 endif()
568568endif()
569569
570- # Turn on -gsplit-dwarf if requested
571- if(LLVM_USE_SPLIT_DWARF)
572- add_definitions("-gsplit-dwarf")
570+ # Turn on -gsplit-dwarf if requested in debug builds.
571+ if (LLVM_USE_SPLIT_DWARF AND
572+ ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
573+ (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
574+ # Limit to clang and gcc so far. Add compilers supporting this option.
575+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
576+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
577+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-gsplit-dwarf>)
578+ include(CheckLinkerFlag)
579+ check_linker_flag(CXX "-Wl,--gdb-index" LINKER_SUPPORTS_GDB_INDEX)
580+ append_if(LINKER_SUPPORTS_GDB_INDEX "-Wl,--gdb-index"
581+ CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
582+ endif()
573583endif()
574584
575585add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
You can’t perform that action at this time.
0 commit comments