Skip to content

Commit bc39d7b

Browse files
committed
libclang.so: Make SONAME the same as LLVM version
This partially reverts c7b3a91. Having libclang.so with a different SONAME than the other LLVM libraries was causing a lot of confusion for users. Also, this change did not really acheive it's purpose of allowing apps to use newer versions of libclang.so without rebuilding, because a new version of libclang.so requires a new version of libLLVM.so, which does not have a stable ABI. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D129160
1 parent 79c2fe0 commit bc39d7b

File tree

5 files changed

+398
-462
lines changed

5 files changed

+398
-462
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,8 @@ clang-extdef-mapping
670670
libclang
671671
--------
672672

673-
- ...
673+
- The soversion for libclang will now change for each new LLVM major release. This matches
674+
the behavior of clang <= 13.
674675

675676
Static Analyzer
676677
---------------

clang/tools/libclang/CMakeLists.txt

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# The SOVERSION should be updated only if a change is made to the libclang
2-
# ABI, and when it is updated, it should be updated to the current
3-
# LLVM_VERSION_MAJOR.
4-
# Please also see clang/tools/libclang/libclang.map
5-
set(CLANG_SONAME 13)
6-
71
set(SOURCES
82
ARCMigrate.cpp
93
BuildSystem.cpp
@@ -70,8 +64,7 @@ endif ()
7064
option(LIBCLANG_BUILD_STATIC
7165
"Build libclang as a static library (in addition to a shared one)" OFF)
7266

73-
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_BINARY_DIR}/libclang-generic.exports)
74-
set(LIBCLANG_VERSION_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)
67+
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports)
7568

7669
if(MSVC)
7770
# Avoid LNK4197 by not specifying libclang.exports here.
@@ -80,20 +73,6 @@ if(MSVC)
8073
set(LLVM_EXPORTED_SYMBOL_FILE)
8174
endif()
8275

83-
if (UNIX AND NOT APPLE)
84-
set(LLVM_EXPORTED_SYMBOL_FILE)
85-
set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT})
86-
endif()
87-
88-
if (LLVM_EXPORTED_SYMBOL_FILE)
89-
add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}
90-
COMMAND "${Python3_EXECUTABLE}"
91-
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/linker-script-to-export-list.py
92-
${LIBCLANG_VERSION_SCRIPT_FILE}
93-
${LLVM_EXPORTED_SYMBOL_FILE}
94-
DEPENDS ${LIBCLANG_VERSION_SCRIPT_FILE})
95-
endif()
96-
9776
if(LLVM_ENABLE_PIC OR (WIN32 AND NOT LIBCLANG_BUILD_STATIC))
9877
set(ENABLE_SHARED SHARED)
9978
endif()
@@ -166,21 +145,6 @@ if(ENABLE_SHARED)
166145
)
167146
endif()
168147
endif()
169-
if (USE_VERSION_SCRIPT)
170-
target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
171-
# The Solaris 11.4 linker supports a subset of GNU ld version scripts,
172-
# but requires a special option to enable it.
173-
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
174-
target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat")
175-
endif()
176-
# Ensure that libclang.so gets rebuilt when the linker script changes.
177-
set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
178-
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)
179-
180-
set_target_properties(libclang PROPERTIES
181-
VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}
182-
SOVERSION ${CLANG_SONAME})
183-
endif()
184148
endif()
185149

186150
if(INTERNAL_INSTALL_PREFIX)

0 commit comments

Comments
 (0)