Skip to content

[libc++][AIX] Fixup problems with ABI list checking - #155643

Merged
daltenty merged 4 commits into
llvm:mainfrom
daltenty:daltenty/libcxx-fix-magic
Aug 27, 2025
Merged

daltenty merged 4 commits into
llvm:mainfrom
daltenty:daltenty/libcxx-fix-magic

Conversation

@daltenty

@daltenty daltenty commented Aug 27, 2025 •

Copy link
Copy Markdown
Member

There are some problems with our ABI list checking exposed by recent compiler/cmake upgrades.

  • For symcheck, there are typos in how XCOFF magic are defined, we intended the second two digits to be a hex value, but our syntax doesn't say that. Thus this will never match a valid XCOFF file.
  • AIX triples can have version numbers. Those need to be discarded when looking for an libc++ ABI list, like we do for other targets.

There are some typos here in how XCOFF magic are defined,
we intended the second two digits to be a hex value, but
our syntax doesn't say that. Thus this will never match.
@daltenty
daltenty requested a review from jakeegan August 27, 2025 15:44
@daltenty
daltenty requested a review from a team as a code owner August 27, 2025 15:44
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 27, 2025
@llvmbot

llvmbot commented Aug 27, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-libcxx

Author: David Tenty (daltenty)

Changes

There are some typos here in how XCOFF magic are defined, we intended the second two digits to be a hex value, but our syntax doesn't say that. Thus this will never match.


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

1 Files Affected:

  • (modified) libcxx/utils/libcxx/sym_check/util.py (+1-1)
diff --git a/libcxx/utils/libcxx/sym_check/util.py b/libcxx/utils/libcxx/sym_check/util.py
index fc7ba4244ab5a..dbc886f29ddea 100644
--- a/libcxx/utils/libcxx/sym_check/util.py
+++ b/libcxx/utils/libcxx/sym_check/util.py
@@ -95,7 +95,7 @@ def is_xcoff_or_big_ar(filename):
     with open(filename, "rb") as f:
         magic_bytes = f.read(7)
     return (
-        magic_bytes[:4] in [b"\x01DF", b"\x01F7"]  # XCOFF32  # XCOFF64
+        magic_bytes[:2] in [b"\x01\xDF", b"\x01\xF7"]  # XCOFF32  # XCOFF64
         or magic_bytes == b"<bigaf>"
     )
 

@daltenty daltenty changed the title [libc++][AIX] fix XCOFF magic in symcheck [libc++][AIX] Fixup problems with ABI list checking Aug 27, 2025

@jakeegan jakeegan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@hubert-reinterpretcast hubert-reinterpretcast left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with minor nit.

Comment thread libcxx/lib/abi/CMakeLists.txt Resolved
Co-authored-by: Hubert Tong <[email protected]>
@daltenty
daltenty merged commit b8456e2 into llvm:main Aug 27, 2025
@daltenty
daltenty deleted the daltenty/libcxx-fix-magic branch August 27, 2025 22:28
@amy-kwan amy-kwan added this to the LLVM 21.x Release milestone Sep 2, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in LLVM Release Status Sep 2, 2025
@amy-kwan

amy-kwan commented Sep 2, 2025

Copy link
Copy Markdown
Member

This should ideally be in LLVM 21.x, as well.

/cherry-pick b8456e2

@llvmbot

llvmbot commented Sep 2, 2025

Copy link
Copy Markdown
Member

/pull-request #156502

@llvmbot llvmbot moved this from Needs Triage to Done in LLVM Release Status Sep 2, 2025
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Sep 8, 2025
There are some problems with our ABI list checking exposed by recent
compiler/cmake upgrades.

- For symcheck, there are typos in how XCOFF magic are defined, we
intended the second two digits to be a hex value, but our syntax doesn't
say that. Thus this will never match a valid XCOFF file.
- AIX triples can have version numbers. Those need to be discarded when
looking for an libc++ ABI list, like we do for other targets.

(cherry picked from commit b8456e2)
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

Development

Successfully merging this pull request may close these issues.

5 participants