clang-19 compatibility#46
Open
kalvdans wants to merge 2 commits into
Open
Conversation
Adds a Make-driven regression that builds a small shared library with both clang and gcc at DWARF 4 and DWARF 5, runs abi-dumper against each, normalises the dumps (drops compiler-version metadata, renames DIE numeric IDs to stable T0001/T0002/... via structural traversal), and asserts the four dumps agree pairwise per DWARF version. Run with: make -C tests Override compilers with: make -C tests CLANG=clang-19 GCC=gcc-13 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two clang-emitted DWARF encodings that the 1.4 parser mishandled: * DW_TAG_subrange_type: DWARF 5 sec. 5.13 permits the bound to be encoded as DW_AT_count (number of elements) instead of DW_AT_upper_bound (highest index). gcc emits upper_bound; clang (>= 7) emits count for non-VLA C arrays. Previously only upper_bound was consulted, so fixed-size arrays from clang decayed to flexible arrays in the dump. Fall back to count when upper_bound is absent. * DW_FORM_sdata: eu-readelf renders sdata as "(sdata) RAW (SIGNED)" where RAW is the unsigned u64 reinterpretation and SIGNED is the signed value. The generic attribute reader only stripped the "(sdata) " form prefix, leaving "RAW (SIGNED)" as the stored value -- which broke negative enumerators (gcc and clang both use sdata for negative enumerator values). Capture the signed parenthesised value when this shape is seen. Regression covered by tests/. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for two Dwarf constructs that clang-19 emits.
Also adds a tests folder that checks that the fix works. The test needs both clang and gcc installed and not connected to CI in any way yet. Feel free to remove this folder if it doesn't fit the project's plans.
AI disclosure: Claude Opus 4.7 helped to make this PR.