From 3fc3075de85c2e482698cde5bac04b57b1e2a097 Mon Sep 17 00:00:00 2001 From: Jeremy Drake Date: Fri, 2 May 2025 12:21:07 -0700 Subject: [PATCH] [LLVM][Cygwin] Define _GNU_SOURCE on Cygwin as well. Without it, certain functions such as dladdr are not make available by the headers. Signed-off-by: Jeremy Drake --- llvm/cmake/config-ix.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 15ae04f5a6913..43311dad457ec 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -86,15 +86,15 @@ endif() # Keep this at the top to make sure we don't add _GNU_SOURCE dependent checks # before adding it. check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) -if(LLVM_USING_GLIBC) +if(LLVM_USING_GLIBC OR CYGWIN) add_compile_definitions(_GNU_SOURCE) list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") +endif() - # enable 64bit off_t on 32bit systems using glibc - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - add_compile_definitions(_FILE_OFFSET_BITS=64) - list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") - endif() +# enable 64bit off_t on 32bit systems using glibc +if(LLVM_USING_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4) + add_compile_definitions(_FILE_OFFSET_BITS=64) + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") endif() # include checks