Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AceTheWiz opened this issue Mar 31, 2022 · 7 comments

Comments

@AceTheWiz
Copy link

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.

@noseglasses
Copy link
Owner

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?

@sylveon
Copy link

sylveon commented Oct 26, 2022

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
Copy link

sylveon commented Oct 26, 2022

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.

@LepilkinaElena
Copy link

The similar problem with calling objdump happens with using llvm-objdump, because of this argument

"--source-comment=%s" % SOURCE_CODE_START_TAG,

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

@noseglasses
Copy link
Owner

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.

@CHy-KK
Copy link

CHy-KK commented Dec 12, 2023

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

@noseglasses
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants