ELF View Support for SHN_COMMON-Relative Symbols #6111
Labels
Component: DebugInfo
Issue requires changes to the DebugInfo API
Effort: Medium
Issue should take < 1 month
Impact: Medium
Issue is impactful with a bad, or no, workaround
Type: Enhancement
Issue is a small enhancement to existing functionality
What is the feature you'd like to have?
The ELF specification describes a Special Section Index
SHN_COMMON
that's defined as follows:And also when describing symbol types:
Binary Ninja does not currently have any special handling for symbols with the
SHN_COMMON
section index, which leads to very unintuitive behavior when analyzing files that contain them.Ideally, Binary Ninja would introduce an additional
.common
section similar to the current.extern
section to contain properly sized and aligned objects with theSHN_COMMON
special section index.Is your feature request related to a problem?
While reverse-engineering a static library archive, I wanted to have visibility into all the constituent
.o
files at once. As a stop-gap alternative to getting upstream support (#2085), I used GCC to partially link the entire.a
into a single.o
file (riscv32-picolibc-elf-gcc -r -Og -g3 -o libch59xble.o -Wl,--whole-archive LIBCH59xBLE.a
). When doing so, many symbols that were onceSTT_NOTYPE
/SHN_UNDEF
externs becameSTT_OBJECT
/SHN_COMMON
symbols that were no longer resolved by Binary Ninja.Are any alternative solutions acceptable?
I can invent workarounds for my current usecase, but this would probably be good for Binary Ninja to support.
Additional Information:
You'll find the original static library as well as the partially-linked single object version in the zipfile attached to this issue. You may need my custom patch to the RISC-V architecture to get an entirely clean disassembly, as the RISC-V chip in question has some questionable RISC-V extensions.
Binary Ninja's disassembly of an example function in
LIBCH59xBLE.a->rf_fh.o
:Relevant
LIBCH59xBLE.a->rf_fh.o
readelf snippets:Binary Ninja's disassembly of an example function in
libch59xble.o
. Relocations forgBleIPPara
at 0x2be62/0x2be66 and 0x2be74/0x2be78 have gone unfilled:libch59xble.o
readelf snippets:shn_common_files.zip
The text was updated successfully, but these errors were encountered: