Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[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

Merged
merged 1 commit into from
May 16, 2025

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?

Copy link
Member

Choose a reason for hiding this comment

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

That's right, this is kinda tricky. I had plans to migrate the ABI list tests to Lit at some point, but this is one of the difficulties I encountered too. I think this is good enough for now. For anyone curious: ldionne@060c7d6.

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.

That's right, this is kinda tricky. I had plans to migrate the ABI list tests to Lit at some point, but this is one of the difficulties I encountered too. I think this is good enough for now. For anyone curious: ldionne@060c7d6.

@ldionne
Copy link
Member

ldionne commented May 14, 2025

The CI is failing for real though.

libcxx/utils/sym_diff.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented May 14, 2025

⚠️ Python code formatter, darker found issues in your code. ⚠️

You can test this locally with the following command:
darker --check --diff -r HEAD~1...HEAD libcxx/utils/sym_diff.py
View the diff from darker here.
--- sym_diff.py	2025-05-15 11:28:16.000000 +0000
+++ sym_diff.py	2025-05-15 11:31:10.689848 +0000
@@ -79,11 +79,11 @@
     if args.only_stdlib:
         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 symbol["is_defined"] and 'B' in symbol["name"]:
+        if symbol["is_defined"] and "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:

Update libcxx/utils/sym_diff.py
@philnik777 philnik777 force-pushed the check_abilist_reject_abitag branch from af05bf8 to 6f7128c Compare May 15, 2025 11:28
@philnik777 philnik777 merged commit e1ca2c5 into llvm:main May 16, 2025
135 of 146 checks passed
@philnik777 philnik777 deleted the check_abilist_reject_abitag branch May 16, 2025 13:41
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.