Replace LIB_PATH macro with kLibPath

The string is still "lib" or "lib64" with native bridge. It doesn't need
to be configured in the Android.bp file anymore, so move it to a header
file. This change will ensure that ${LIB} expands to the same thing in
both ld.config.txt and DT_RUN_PATH.

Bug: http://b/145197367
Test: manual
Change-Id: Iab87f3156f2984dd3a20e4ccda423892c8b58763
Merged-In: Iab87f3156f2984dd3a20e4ccda423892c8b58763
diff --git a/linker/Android.bp b/linker/Android.bp
index 1800bdb..3b25d12 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -335,11 +335,7 @@
 
     symlinks: ["linker_asan"],
     multilib: {
-        lib32: {
-            cflags: ["-DLIB_PATH=\"lib\""],
-        },
         lib64: {
-            cflags: ["-DLIB_PATH=\"lib64\""],
             suffix: "64",
         },
     },
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 85ea8d1..ada25a5 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -353,11 +353,6 @@
 
 static constexpr const char* kDefaultConfigName = "default";
 static constexpr const char* kPropertyAdditionalNamespaces = "additional.namespaces";
-#if defined(__LP64__)
-static constexpr const char* kLibParamValue = "lib64";
-#else
-static constexpr const char* kLibParamValue = "lib";
-#endif
 
 class Properties {
  public:
@@ -401,7 +396,7 @@
     split_path(paths_str.c_str(), ":", &paths);
 
     std::vector<std::pair<std::string, std::string>> params;
-    params.push_back({ "LIB", kLibParamValue });
+    params.push_back({ "LIB", kLibPath });
     if (target_sdk_version_ != 0) {
       char buf[16];
       async_safe_format_buffer(buf, sizeof(buf), "%d", target_sdk_version_);
diff --git a/linker/linker_config.h b/linker/linker_config.h
index 75d9378..6733148 100644
--- a/linker/linker_config.h
+++ b/linker/linker_config.h
@@ -40,6 +40,12 @@
 
 #include <android-base/macros.h>
 
+#if defined(__LP64__)
+static constexpr const char* kLibPath = "lib64";
+#else
+static constexpr const char* kLibPath = "lib";
+#endif
+
 class NamespaceLinkConfig {
  public:
   NamespaceLinkConfig() = default;
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index 14293d9..c71945a 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -36,6 +36,7 @@
 
 #include <async_safe/log.h>
 
+#include "linker_config.h"
 #include "linker_debug.h"
 #include "linker_globals.h"
 #include "linker_logger.h"
@@ -85,11 +86,7 @@
   // FIXME: add $PLATFORM.
   std::vector<std::pair<std::string, std::string>> params = {
     {"ORIGIN", origin},
-#if defined(LIB_PATH)
-    {"LIB", LIB_PATH},
-#else
-#error "LIB_PATH not defined"
-#endif
+    {"LIB", kLibPath},
   };
   for (auto&& s : runpaths) {
     format_string(&s, params);