Skip to content

[libc++] Reject abilist if it contains an ABI tag #139030

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: main
Choose a base branch
from

Conversation

philnik777
Copy link
Contributor

We currently don't have any ABI tags in our dylib symbols, and this is unlikely to change in the future. By diagnosing this we avoid accidentally adding one through e.g. having _LIBCPP_HIDE_FROM_ABI on an exported symbol.

@philnik777 philnik777 requested a review from a team as a code owner May 8, 2025 06:26
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 8, 2025
@llvmbot
Copy link
Member

llvmbot commented May 8, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

We currently don't have any ABI tags in our dylib symbols, and this is unlikely to change in the future. By diagnosing this we avoid accidentally adding one through e.g. having _LIBCPP_HIDE_FROM_ABI on an exported symbol.


Full diff: https://github.com/llvm/llvm-project/pull/139030.diff

1 Files Affected:

  • (modified) libcxx/utils/sym_diff.py (+5)
diff --git a/libcxx/utils/sym_diff.py b/libcxx/utils/sym_diff.py
index 8eaf8b7a57591..91af4a0bddaa7 100755
--- a/libcxx/utils/sym_diff.py
+++ b/libcxx/utils/sym_diff.py
@@ -80,6 +80,11 @@ def main():
         old_syms_list, _ = util.filter_stdlib_symbols(old_syms_list)
         new_syms_list, _ = util.filter_stdlib_symbols(new_syms_list)
 
+    for symbol in new_syms_list:
+        if 'B' in symbol["name"]:
+            print(f"Symbol {symbol["name"]} contains an ABI tag!")
+            sys.exit(1)
+
     added, removed, changed = diff.diff(old_syms_list, new_syms_list)
     if args.removed_only:
         added = {}

Comment on lines +83 to +86
for symbol in new_syms_list:
if 'B' in symbol["name"]:
print(f"Symbol {symbol["name"]} contains an ABI tag!")
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to add this as a lit test instead? One thing we could potentially do is nm -g %{lib-dir}/libc++.dylib | grep -v 'B' or something along those lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the name of the library changes depending on the platform this is non-trivial I think. Do you have any idea how to get that except passing it through as another lit substitution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants