Allow late lookup for @CriticalNative methods.

Test: Add and enable tests in 178-app-image-native-method
Test: Add and enable tests in jni_compiler_test
Test: Manually step through the new stub in GDB and check
      that backtrace works at various points.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Test: run-gtests.sh
Test: testrunner.py --target --optimizing
Bug: 112189621
Change-Id: If094e5062acbb99eefa88f2afb4815f93730cb82
diff --git a/runtime/oat.h b/runtime/oat.h
index 206f8af..8c81844 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -32,8 +32,8 @@
 class PACKED(4) OatHeader {
  public:
   static constexpr std::array<uint8_t, 4> kOatMagic { { 'o', 'a', 't', '\n' } };
-  // Last oat version changed reason: invokeinterface on j.l.Object do a vtable call.
-  static constexpr std::array<uint8_t, 4> kOatVersion { { '1', '7', '9', '\0' } };
+  // Last oat version changed reason: Allow late lookup for @CriticalNative.
+  static constexpr std::array<uint8_t, 4> kOatVersion { { '1', '8', '0', '\0' } };
 
   static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";
   static constexpr const char* kDebuggableKey = "debuggable";
@@ -72,6 +72,9 @@
   const void* GetJniDlsymLookupTrampoline() const;
   uint32_t GetJniDlsymLookupTrampolineOffset() const;
   void SetJniDlsymLookupTrampolineOffset(uint32_t offset);
+  const void* GetJniDlsymLookupCriticalTrampoline() const;
+  uint32_t GetJniDlsymLookupCriticalTrampolineOffset() const;
+  void SetJniDlsymLookupCriticalTrampolineOffset(uint32_t offset);
 
   const void* GetQuickGenericJniTrampoline() const;
   uint32_t GetQuickGenericJniTrampolineOffset() const;
@@ -123,6 +126,7 @@
   uint32_t oat_dex_files_offset_;
   uint32_t executable_offset_;
   uint32_t jni_dlsym_lookup_trampoline_offset_;
+  uint32_t jni_dlsym_lookup_critical_trampoline_offset_;
   uint32_t quick_generic_jni_trampoline_offset_;
   uint32_t quick_imt_conflict_trampoline_offset_;
   uint32_t quick_resolution_trampoline_offset_;