GaloisInc / macaw

Open source binary analysis tools.
BSD 3-Clause "New" or "Revised" License
208 stars 21 forks source link

Consolidate static/dynamic symbol table logic with `elf-edit` #277

Closed RyanGlScott closed 1 year ago

RyanGlScott commented 2 years ago

Data.Macaw.Memory.ElfLoader has two very intricate functions for computing the static symbol table:

https://github.com/GaloisInc/macaw/blob/e4b198ab2dd882e34690ed33056d5231b2d776bf/base/src/Data/Macaw/Memory/ElfLoader.hs#L1330-L1347

And the dynamic symbol table:

https://github.com/GaloisInc/macaw/blob/e4b198ab2dd882e34690ed33056d5231b2d776bf/base/src/Data/Macaw/Memory/ElfLoader.hs#L1636-L1646

It turns out, however, that elfStaticSymbolTable is essentially identical to decodeHeaderSymtab from elf-edit. We should remove macaw's code in favor of decodeHeaderSymtab. Moreover, the dynamic symbol table logic in macaw really ought to belong in elf-edit as well, so that code should be migrated over to elf-edit for others' benefit.

RyanGlScott commented 1 year ago

A handful of thoughts that I wanted to record while looking into this: