macaw-ppc
: Generalize ppc64_linux_info
to take a Maybe (TOC w)
argument instead of a LoadedBinary
#415
Labels
macaw-ppc
: Generalize ppc64_linux_info
to take a Maybe (TOC w)
argument instead of a LoadedBinary
#415
Compared to other
ArchitectureInfo
-producing functions,ppc64_linux_info
is somewhat unusual in that it requires aLoadedBinary
as an argument:macaw/macaw-ppc/src/Data/Macaw/PPC.hs
Lines 91 to 94 in 1a2b928
This is because knowing the location of the entrypoint address in complicated on PPC64. In some cases, PPC64 binaries can have an
.opd
section with a table of contents (TOC
), which is used to translate function addresses to the actual locations where the functions are defined. See this part ofmacaw-ppc-loader
for the full story.Ultimately,
ppc64_linux_info
'sLoadedBinary
argument is used to obtain theTOC
for a binary. This approach is somewhat unsatisfactory, however, for two reasons:.opd
sections (seemacaw-loader-ppc
crashes on PPC64musl-gcc
binaries macaw-loader#21). For binaries without.opd
sections, needing to pass in aTOC
is overkill, since theTOC
won't be used as part of the translation.macaw-symbolic-syntax
backend for PPC64 which consumes Crucible S-expression programs as input instead of binaries. This is currently impossible, however, as it is not possible to supplyppc64_linux_info
with aLoadedBinary
when the input isn't a binary in the first place.To address both of these issues, I propose that we generalize the type of
ppc64_linux_info
to take aMaybe (TOC w)
argument instead of aLoadedBinary
argument. This way, one could passNothing
toppc64_linux_info
whenever one has an.opd
-less binary or a Crucible S-expression program as input. This approach would closely mirror howmacaw-ppc
'smkInitialAbsState
function (whichppc64_linux_info
invokes), which also takes aMaybe (TOC w)
argument.Note that it will likely be convenient to fix this issue and GaloisInc/macaw-loader#21 at the same time. A reasonable way to fix GaloisInc/macaw-loader#21 would be to change the return type of
getTOC
fromTOC w
toMaybe (TOC w)
. After this change has been made, one can callppc64_linux_info (getTOC binary)
to obtain anArchitectureInfo
value from a PPC64 binary.The text was updated successfully, but these errors were encountered: