Merge "Disable warning message for missing linker config in some cases"
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 9301f8c..e5450c7 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3375,6 +3375,22 @@
   return ld_config_file_vndk;
 }
 
+bool is_linker_config_expected(const char* executable_path) {
+  // Do not raise message from a host environment which is expected to miss generated linker
+  // configuration.
+#if !defined(__ANDROID__)
+  return false;
+#endif
+
+  if (strcmp(executable_path, "/system/bin/init") == 0) {
+    // Generated linker configuration can be missed from processes executed
+    // with init binary
+    return false;
+  }
+
+  return true;
+}
+
 static std::string get_ld_config_file_path(const char* executable_path) {
 #ifdef USE_LD_CONFIG_FILE
   // This is a debugging/testing only feature. Must not be available on
@@ -3403,12 +3419,10 @@
     return kLdGeneratedConfigFilePath;
   }
 
-  // Do not raise message from a host environment which is expected to miss generated linker
-  // configuration.
-#if defined(__ANDROID__)
-  DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
-          kLdGeneratedConfigFilePath);
-#endif
+  if (is_linker_config_expected(executable_path)) {
+    DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
+            kLdGeneratedConfigFilePath);
+  }
 
   path = get_ld_config_file_vndk_path();
   if (file_exists(path.c_str())) {