[libunwind] [libunwind] Introduce LIBUNWIND_LIBRARY_VERSION and drop outdated Apple flags (PR #110178)
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 26 15:21:06 PDT 2024
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/110178
This patch introduces the LIBUNWIND_LIBRARY_VERSION setting to control the dylib version of libunwind. This allows expressing the dylib version in CMake instead of adding custom compiler flags.
As a drive-by, also remove some outdated Apple flags that are not relevant anymore.
>From 43870b4ddd02ecc682fc1da3197927145b2cddf5 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 26 Sep 2024 18:18:55 -0400
Subject: [PATCH] [libunwind] Introduce LIBUNWIND_LIBRARY_VERSION and drop
outdated Apple flags
This patch introduces the LIBUNWIND_LIBRARY_VERSION setting to control
the dylib version of libunwind. This allows expressing the dylib
version in CMake instead of adding custom compiler flags.
As a drive-by, also remove some outdated Apple flags that are not
relevant anymore.
---
libunwind/CMakeLists.txt | 6 ++++++
libunwind/src/CMakeLists.txt | 13 ++-----------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 28d67b0fef92cc..6903fa583a501d 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -66,6 +66,12 @@ cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
"Install the shared libunwind library." ON
"LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
+set(LIBUNWIND_LIBRARY_VERSION "1.0" CACHE STRING
+ "Version of libunwind. This will be reflected in the name of the shared library produced.
+ For example, -DLIBUNWIND_LIBRARY_VERSION=x.y will result in the library being named
+ libunwind.x.y.dylib, along with the usual symlinks pointing to that. On Apple platforms,
+ this also controls the linker's 'current_version' property.")
+
if(MINGW)
set(LIBUNWIND_DEFAULT_TEST_CONFIG "llvm-libunwind-mingw.cfg.in")
elseif (LIBUNWIND_ENABLE_SHARED)
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 780430ba70ba60..125cf4ffe912a3 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -105,15 +105,6 @@ if (LIBUNWIND_ENABLE_SHARED AND
"on C++ ABI library is not supported.")
endif()
-if (APPLE)
- add_compile_flags("-U__STRICT_ANSI__")
- add_link_flags("-compatibility_version 1" "-install_name /usr/lib/libunwind.1.dylib")
-
- if (CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6")
- add_link_flags("-current_version ${LIBUNWIND_VERSION}" "/usr/lib/libSystem.B.dylib")
- endif ()
-endif ()
-
if (HAIKU)
add_library_flags_if(LIBUNWIND_HAS_ROOT_LIB root)
@@ -170,8 +161,8 @@ if (LIBUNWIND_ENABLE_SHARED)
LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}"
LINKER_LANGUAGE C
OUTPUT_NAME "${LIBUNWIND_SHARED_OUTPUT_NAME}"
- VERSION "1.0"
- SOVERSION "1"
+ VERSION "${LIBUNWIND_LIBRARY_VERSION}"
+ SOVERSION "1"
)
list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")
More information about the cfe-commits
mailing list