Skip to content

[stable/21.x][cmake] lldb: Turn of clang visibility macros if not CLANG_LINK_CLANG_DYLIB #11127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: stable/21.x
Choose a base branch
from

Conversation

AnthonyLatsis
Copy link

Comment on lines +95 to 109
if(MSVC AND NOT CLANG_LINK_CLANG_DYLIB)
# Make sure all consumers also turn off visibility macros so the're not
# trying to dllimport symbols.
target_compile_definitions(${name} PUBLIC CLANG_BUILD_STATIC)
if(TARGET "obj.${name}")
target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC)
endif()
elseif(NOT PARAM_SHARED AND NOT PARAM_STATIC)
# lldb component libraries linked in to clang-cpp are declared without
# SHARED or STATIC.
target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
endif()

if(CLANG_LINK_CLANG_DYLIB)
target_link_libraries(${name} PRIVATE clang-cpp)
Copy link
Author

@AnthonyLatsis AnthonyLatsis Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This

if(MSVC AND NOT CLANG_LINK_CLANG_DYLIB)
  ...
elseif(NOT PARAM_SHARED AND NOT PARAM_STATIC)
  target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
endif()

...

if(CLANG_LINK_CLANG_DYLIB)
  target_link_libraries(${name} PRIVATE clang-cpp)

flow is odd.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @fsfod

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk why i did it that way, but do the LLDB libraries even need there API exported from the clang shared library anyway? I should also mention @andrurogerz is continuing most of the work on this now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is something off with the way the CLANG_ABI annotation definitions are gated right now in LLVM main. I found yesterday that after annotating a bunch of the clang symbols the project doesn't build on Windows even when you don't enable DLL builds. I have not looked into the issue.

@AnthonyLatsis AnthonyLatsis requested a review from bnbarham August 5, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants