embench / embench-iot

The main Embench repository
https://www.embench.org/
GNU General Public License v3.0
254 stars 104 forks source link

Use of lief to handle macho #125

Closed Roger-Shepherd closed 3 years ago

Roger-Shepherd commented 3 years ago

I'm intending using the lief-project to help with handling of macho files in benchmark_speed.py.

  1. It is released under Apache 2.0. Is this a problem.
  2. I'd also use it to handle elf. The lief provides the same API for elf, lief (and pe). The only difference in the handling of elf and macho is that for elf the test for a section being wanted is section.name.startswith(target_name) (to deal with groups) and for macho it is target_name == section.name. The lief code is simpler than the existing code (IMHO).

Do either of these give us a problem?

Roger-Shepherd commented 3 years ago

Now that I have implemented the handling of macho and elf using lief I can report that the logic for both macho and dwarf is identical, and the only place where a check is made on the format is to check that the magic number at the start of the file matches that expected.