12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringRef.h"
23 arch_32.
GetTriple().setEnvironment(llvm::Triple::Android);
26 arch_64.
GetTriple().setEnvironment(llvm::Triple::Android);
36 static const char *
const ld_library_path_separator =
":";
37 static const char *
const default_lib32_path[] = {
"/vendor/lib",
"/system/lib",
39 static const char *
const default_lib64_path[] = {
"/vendor/lib64",
40 "/system/lib64",
nullptr};
42 if (module_path.empty() || module_path[0] ==
'/') {
43 FileSpec file_spec(module_path.c_str());
48 SmallVector<StringRef, 4> ld_paths;
50 if (
const char *ld_library_path = ::getenv(
"LD_LIBRARY_PATH"))
51 StringRef(ld_library_path)
52 .split(ld_paths, StringRef(ld_library_path_separator), -1,
false);
54 const char *
const *default_lib_path =
nullptr;
57 default_lib_path = default_lib32_path;
60 default_lib_path = default_lib64_path;
63 assert(
false &&
"Unknown address byte size");
67 for (
const char *
const *it = default_lib_path; *it; ++it)
68 ld_paths.push_back(StringRef(*it));
70 for (
const StringRef &path : ld_paths) {
71 FileSpec file_candidate(path.str().c_str());
76 return file_candidate;
91 file_spec =
FileSpec(
"/data/local/tmp");