Skip to content

[llvm] updates to LLVM_ABI export macro definitions #144418

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

Closed
wants to merge 3 commits into from

Conversation

andrurogerz
Copy link
Contributor

Purpose

Update the LLVM_ABI macro to always resolve to __attribute__((visibility("default"))) when building LLVM as a shared library for ELF or Mach-O targets.

Background

Previously, LLVM_ABI was defined to the C++ style attribute [[gnu::visibility("default")]] when compiling with gcc, which has more restrictions on its placement. Of note, the C++ style attributes cannot decorate friend functions and must not appear after extern on variable declarations.

Documentation for LLVM_ABI and related annotations is found in the LLVM repo here.

Overview

  • Directly define LLVM_ABI to __attribute__((visibility("default"))) instead of LLVM_ATTRIBUTE_VISIBILITY_DEFAULT, which resolves to C++ style [[gnu::visibility("default")]] when compiling with gcc.
  • Remove the LLVM_ABI_FRIEND macro and replace all usages of it with LLVM_ABI.
  • Update the documentation for exporting friend functions to no longer reference LLVM_ABI_FRIEND.

Validation

Built with clang and gcc on Linux.

@andrurogerz andrurogerz changed the title Llvm abi gnu attribute [llvm] updates to LLVM_ABI export macro definitions Jun 16, 2025
@andrurogerz andrurogerz force-pushed the llvm-abi-gnu-attribute branch from 1e234c0 to 5811093 Compare June 16, 2025 20:22
@andrurogerz andrurogerz deleted the llvm-abi-gnu-attribute branch June 17, 2025 20:36
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.

1 participant