1

I'm trying to analyze the oat format to understand how android application loader works. I think that android applications are all compiled into native code as oat file in Android Runtime(ART).

What I found was, however, that there is original dex file in oat file, and there are also non-compiled methods in oat class headers.

Furthermore, there is an type field in oat class header which tells how many parts of the methods are compiled. The existence of this type field means that there can be non-compiled methods in oat file.

Here is the figure which describes the type field which was revealed by Paul Sabanal in Black Hat 2014.

The type field of oat class header

Here is what my oatdump shows about oat file in Android 6.0

Compiled method in oat file

Non-compiled method in oat file

You can see that non-compiled methods do not have any field of native method offset.

I couldn't find any official documents about oat file.

To sum it up, the questions are

  • Why are there non-compiled methods in oat file?
  • How can the non-compiled methods be executed during Android Runtime?
  • Why can the non-compiled methods not be compiled during compile time by dextooat?
  • Is there any easy example that cannot be compiled into native code?

Thank you for your answers in advance.

Community
  • 1
  • 1
DM Jo
  • 11
  • 3
  • Just checking if you seen the Google IO videos on ART: https://youtu.be/EBlTzQsUoOw which may inform some of your questions, and the later ones: https://youtu.be/fwMM6g7wpQ8 and https://youtu.be/iFE2Utbv1Oo for further changes in later version of Android – Morrison Chang Jan 09 '18 at 07:54

0 Answers0