[llvm] [LLVM][Cygwin] Define _GNU_SOURCE on Cygwin as well. (PR #138329)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 2 12:22:31 PDT 2025
https://github.com/jeremyd2019 created https://github.com/llvm/llvm-project/pull/138329
Without it, certain functions such as dladdr are not make available by the headers.
>From 31e9552ff514ecbae07178614863f10586e4ca1a Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github at jdrake.com>
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 <github at jdrake.com>
---
llvm/cmake/config-ix.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 15ae04f5a6913..9468ef04c6a58 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -86,7 +86,7 @@ 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")
More information about the llvm-commits
mailing list