[libunwind] [libunwind][libc++][libc++abi] Add cross-compilation flags to tests (PR #67201)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 08:40:55 PDT 2023


arichardson wrote:

> > I think it would be good if all of them did it, the reason I didn't is that I limited it to the ones I can test locally. Seeing as there is probably CI coverage for all of the configs, should I try updating the remaining ones?
> 
> Yes, I think it makes sense for all of them to use that variable. Can you confirm that this is basically empty all the time except if you're using a custom CMake toolchain file?

Grepping through the CMake source shows that the variable could have an effect on the tests when targeting Android and Windows, but for other targets (Linux,macOS) it is a set to `" "`. I guess one option could be to guard it using `if "@CMAKE_CROSSCOMPILING@":`?

```
Modules/Compiler/ARMCC.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/ARMClang.cmake:        string(APPEND CMAKE_${lang}_FLAGS_INIT " -march=${CMAKE_SYSTEM_ARCH}")
Modules/Compiler/ARMClang.cmake:        string(APPEND CMAKE_${lang}_FLAGS_INIT " -mcpu=${CMAKE_SYSTEM_PROCESSOR}")
Modules/Compiler/Bruce-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -D__CLASSIC_C__")
Modules/Compiler/Fujitsu.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/GHS-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " ")
Modules/Compiler/GHS-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " ")
Modules/Compiler/GNU.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/IAR.cmake:    string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/IAR.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " --silent")
Modules/Compiler/IAR.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -S")
Modules/Compiler/Intel-ISPC.cmake:string(APPEND CMAKE_ISPC_FLAGS_INIT " ")
Modules/Compiler/Intel.cmake:    string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/IntelLLVM.cmake:    string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/LCC.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/NVIDIA-CUDA.cmake:  string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
Modules/Compiler/OpenWatcom.cmake:  string(APPEND CMAKE_${type}_LINKER_FLAGS_INIT " opt map")
Modules/Compiler/OpenWatcom.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " -w3")
Modules/Compiler/PGI.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/PGI.cmake:    string(APPEND CMAKE_${lang}_FLAGS_INIT " -Bdynamic")
Modules/Compiler/PathScale.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/SunPro-ASM.cmake:string(APPEND CMAKE_ASM_FLAGS_INIT " ")
Modules/Compiler/SunPro-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " ")
Modules/Compiler/SunPro-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " ")
Modules/Compiler/Tasking.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Compiler/TinyCC-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " ")
Modules/Compiler/XL-ASM.cmake:string(APPEND CMAKE_ASM_FLAGS_INIT " -qthreaded -qhalt=e -qsourcetype=assembler")
Modules/Compiler/XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded")
Modules/Compiler/XL-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded")
Modules/Platform/AIX-XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/AIX-XL-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
Modules/Platform/ARTOS-GNU-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -DARTOS -Xp -+")
Modules/Platform/Android-Common.cmake:        string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libstdc++")
Modules/Platform/Android-Common.cmake:        string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libc++")
Modules/Platform/Android-Common.cmake:        string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libc++")
Modules/Platform/Android-Common.cmake:    string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_ANDROID_ABI_INIT_CFLAGS}")
Modules/Platform/Android-Common.cmake:      string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_ANDROID_ABI_INIT_LDFLAGS}")
Modules/Platform/Android-Common.cmake:    string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${_ANDROID_ABI_INIT_EXE_LDFLAGS}")
Modules/Platform/Android-Common.cmake:      string(APPEND CMAKE_${lang}_FLAGS_INIT " -fexceptions")
Modules/Platform/Android-Common.cmake:      string(APPEND CMAKE_${lang}_FLAGS_INIT " -fno-exceptions")
Modules/Platform/Android-Common.cmake:      string(APPEND CMAKE_${lang}_FLAGS_INIT " -frtti")
Modules/Platform/Android-Common.cmake:      string(APPEND CMAKE_${lang}_FLAGS_INIT " -fno-rtti")
Modules/Platform/Apple-XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/Apple-XL-CXX.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/BlueGeneP-dynamic-XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
Modules/Platform/BlueGeneP-static-XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/BlueGeneP-static-XL-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
Modules/Platform/BlueGeneQ-static-XL-C.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e")
Modules/Platform/BlueGeneQ-static-XL-CXX.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s")
Modules/Platform/CYGWIN-GNU.cmake:string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,--enable-auto-import")
Modules/Platform/DOS-OpenWatcom.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system dos")
Modules/Platform/DOS-OpenWatcom.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system dos4g")
Modules/Platform/DOS-OpenWatcom.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -bt=dos")
Modules/Platform/DOS-OpenWatcom.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=dos -xs")
Modules/Platform/HP-UX-HP.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
Modules/Platform/Linux-OpenWatcom.cmake:string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system linux opt noextension")
Modules/Platform/Linux-OpenWatcom.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -bt=linux")
Modules/Platform/Linux-OpenWatcom.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=linux -xs")
Modules/Platform/OS2-OpenWatcom.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system os2")
Modules/Platform/OS2-OpenWatcom.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system os2v2")
Modules/Platform/OS2-OpenWatcom.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -bt=os2")
Modules/Platform/OS2-OpenWatcom.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=os2 -xs")
Modules/Platform/OSF1.cmake:  set (CMAKE_C_FLAGS_INIT "")
Modules/Platform/OSF1.cmake:  set (CMAKE_CXX_FLAGS_INIT "")
Modules/Platform/SerenityOS-GNU.cmake:set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,separate-code,-z,max-page-size=0x1000")
Modules/Platform/Windows-Embarcadero.cmake:  string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_tM} -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192 ")
Modules/Platform/Windows-Embarcadero.cmake:  string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_tM}")
Modules/Platform/Windows-IntelLLVM.cmake:# Save original CMAKE_${t}_LINKER_FLAGS_INIT
Modules/Platform/Windows-IntelLLVM.cmake:  set(_saved_cmake_${t}_linker_flags_init ${CMAKE_${t}_LINKER_FLAGS_INIT})
Modules/Platform/Windows-IntelLLVM.cmake:  set(CMAKE_${t}_LINKER_FLAGS_INIT "")
Modules/Platform/Windows-IntelLLVM.cmake:  foreach(flag ${CMAKE_${t}_LINKER_FLAGS_INIT})
Modules/Platform/Windows-IntelLLVM.cmake:  set(CMAKE_${t}_LINKER_FLAGS_INIT "")
Modules/Platform/Windows-IntelLLVM.cmake:  list(APPEND CMAKE_${t}_LINKER_FLAGS_INIT
Modules/Platform/Windows-MSVC.cmake:    string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
Modules/Platform/Windows-MSVC.cmake:  string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
Modules/Platform/Windows-MSVC.cmake:  string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " /machine:ARM64X")
Modules/Platform/Windows-MSVC.cmake:  string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}")
Modules/Platform/Windows-MSVC.cmake:      string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS${_Wall}${_FLAGS_${lang}}")
Modules/Platform/Windows-MSVC.cmake:      string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS${_W3}${_FLAGS_${lang}}")
Modules/Platform/Windows-MSVC.cmake:  if(NOT CMAKE_RC_FLAGS_INIT)
Modules/Platform/Windows-MSVC.cmake:    string(APPEND CMAKE_RC_FLAGS_INIT " ${fixed_flags}")
Modules/Platform/Windows-NVIDIA-CUDA.cmake:string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"")
Modules/Platform/Windows-OpenWatcom.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -bt=nt -dWIN32 ${_br_bm}")
Modules/Platform/Windows-OpenWatcom.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -dWIN32 ${_br_bm}")
Modules/Platform/Windows-df.cmake:set (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES")
Modules/Platform/Windows3x-OpenWatcom.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system windows")
Modules/Platform/Windows3x-OpenWatcom.cmake:  string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system win386")
Modules/Platform/Windows3x-OpenWatcom.cmake:string(APPEND CMAKE_C_FLAGS_INIT " -bt=windows")
Modules/Platform/Windows3x-OpenWatcom.cmake:string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=windows -xs")
```

https://github.com/llvm/llvm-project/pull/67201


More information about the cfe-commits mailing list