addr2line.c: Don't special-case DWARF 5 parsing with GCC

While trying to fix YJIT's symbol hygiene issue over at GH-7115, I found
that addr2line.c's DWARF 5 parsing is half-disabled when building with
GCC. Rust's output contains some DW_AT_rnglists_base records, which the
disabled code reads. Without DW_AT_rnglists_base, it crashes when
generating a backtrace.

In common Ruby build configurations, GCC opts to only use
DW_FORM_sec_offset for the range lists, and so it doesn't generate
DW_AT_rnglists_base records, so consuming GCC's DWARF 5 while building
with GCC was not a problem.

However, even when building with GCC, we might need to parse DWARF 5
generated by other compilers at runtime. They could come from C
extensions built by Clang, or come from Rust extensions. This
can happen even when building without YJIT.
This commit is contained in:
Alan Wu 2023-01-16 14:25:39 -05:00 committed by GitHub
parent 30bd2a32fa
commit e22a1fbe18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2023-01-16 19:26:03 +00:00
Merged: https://github.com/ruby/ruby/pull/7123

Merged-By: XrXr

View file

@ -1725,10 +1725,6 @@ di_read_cu(DebugInfoReader *reader)
di_read_debug_abbrev_cu(reader);
if (di_read_debug_line_cu(reader)) return -1;
#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER_BUILD_DATE)
/* Though DWARF specifies "the applicable base address defaults to the base
address of the compilation unit", but GCC seems to use zero as default */
#else
do {
DIE die;
@ -1779,7 +1775,7 @@ di_read_cu(DebugInfoReader *reader)
break;
}
} while (0);
#endif
return 0;
}