elf_diff icon indicating copy to clipboard operation
elf_diff copied to clipboard

Warning: Unable to read assembly from binary and the html report has no meaningful data.

Open AceTheWiz opened this issue 3 years ago • 7 comments

Describe the bug When I compare two files I get an warning. !!!!!!!!! Warning: Unable to read assembly from binary 'FTD_03_00_00-DEV-BIN/ta1l'. !!!!!!!!! an the html report has no meaningful data.

To Reproduce run py -m elf_diff --old_binary_filename "FTD_03_00_00-DEV-BIN/aiu1l" --new_binary_filename "FTD_03_00_00-BIN/aiu1l" --html_file "diff_report.html"

Expected behavior No warnings or errors and detailed info in the report.

Screenshots N/A

Desktop (please complete the following information):

  • OS: Windows 10 (20H2)
  • Python v3.7.7
  • elf_diff v0.6.0
  • objdump, nm, size : (GNU Binutils) v2.32

See attached report and log. console.log diff_report.txt

The report is actually the html output.

AceTheWiz avatar Mar 31 '22 11:03 AceTheWiz

The log message Unable to detect binary file format of FTD_03_00_00-DEV-BIN/aiu1l suggests that the binutils used (those in c:\MinGW\bin) are not compatible with the supplied binaries. Could you please post the output of file FTD_03_00_00-DEV-BIN/aiu1l. Are your binaries possibly stripped? How do you compile them?

noseglasses avatar Apr 07 '22 11:04 noseglasses

I am seeing the same issue when trying to use the objdump from the Android NDK (tried both r17 and r21). Manually running ./i686-linux-android-objdump -drwS libmylib.so works fine however

sylveon avatar Oct 26 '22 04:10 sylveon

Tools:
   objdump: /home/sylveon/Android/Sdk/ndk/17.2.4988734/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-objdump
   nm:      /home/sylveon/Android/Sdk/ndk/17.2.4988734/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-nm
   readelf:      /home/sylveon/Android/Sdk/ndk/17.2.4988734/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf
   size:    /home/sylveon/Android/Sdk/ndk/17.2.4988734/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-size
Verifying config keys...
Symbol selection regex:
   old binary: 'None'
   new binary: 'None'
Symbol exclusion regex:
   old binary: 'None'
   new binary: 'None'
Parsing symbols of old binary (libRMSDKWrapper_ndk15.so)
File format of binary libRMSDKWrapper_ndk15.so: elf32-i386
Extracting symbols
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Gathering instructions
- |#                                                                                          | 0 Elapsed Time: 0:00:00
⚠⚠⚠ Warning: Unable to read assembly from binary 'libRMSDKWrapper_ndk15.so'. ⚠⚠⚠
Parsing symbols of new binary (libRMSDKWrapper_ndk17.so)
File format of binary libRMSDKWrapper_ndk17.so: elf32-i386
Extracting symbols
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Gathering instructions
- |#                                                                                          | 0 Elapsed Time: 0:00:00
⚠⚠⚠ Warning: Unable to read assembly from binary 'libRMSDKWrapper_ndk17.so'. ⚠⚠⚠
Symbol Statistics:
   old binary (libRMSDKWrapper_ndk15.so):
      0 total symbol(s)
      0 symbol(s) selected
   new binary (libRMSDKWrapper_ndk17.so):
      0 total symbol(s)
      0 symbol(s) selected

   0 persisting symbol(s)
   0 disappeared symbol(s)
   0 new symbol(s)
Adding old symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Adding new symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Adding appeared symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Adding disappeared symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Adding persisting symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Adding similar symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Adding migrated symbols to document
- |#                                                                                          | 0 Elapsed Time: 0:00:00
- |#                                                                                          | 0 Elapsed Time: 0:00:00
- |#                                                                                          | 0 Elapsed Time: 0:00:00
Plugin HTMLExportPairReportPlugin: Multi page html pair report written to directory 'report'
🏁 Done.
⚠ Watch out! Warnings occurred.

sylveon avatar Oct 26 '22 05:10 sylveon

The similar problem with calling objdump happens with using llvm-objdump, because of this argument https://github.com/noseglasses/elf_diff/blob/8b0b7236fe9cd7bc09aa011528fb904321a0bd5a/src/elf_diff/instruction_collector.py#L140

llvm-objdump has no flag --source-comment. Could it be made optional under the flag?

LepilkinaElena avatar Nov 09 '22 08:11 LepilkinaElena

Thanks, @LepilkinaElena for pointing out the source of the problem. Unfortunately, this is something that is not easy to fix as currently elf_diff heavily relies of the --source-comment flag being available. It is required for tagging the assembly and, thus, allowing it to be parsed in a platform-agnostic fashion. Without that we would need an individual assembly parser for each platform that would allow us to distinguish assembly instructions from the rest of binutil's output.

If you have any idea for a workaround, please let me know.

noseglasses avatar Dec 25 '22 14:12 noseglasses

Im also using llvm-objdump in windows platform, is it fixed now?

CHy-KK avatar Dec 12 '23 05:12 CHy-KK

Unfortunately not. If you find a way to convince the llvm-objdump devs to add the missing flag, please let me know.

noseglasses avatar Dec 15 '23 10:12 noseglasses