clang: add support for LLVM gold plugin in case of accelerated 37/323137/1 aarch64_ilp32 accepted/tizen/base/20250429.115321 accepted/tizen/base/x/20250429.203523
authorKonstantin Baladurin <k.baladurin@samsung.com>
Mon, 15 Apr 2019 17:36:54 +0000 (20:36 +0300)
committerPavel Kudrevatykh <p.kudrevatyh@partner.samsung.com>
Wed, 23 Apr 2025 09:01:18 +0000 (12:01 +0300)
environment

Change-Id: I5e29abefacef0f25e44cf4d3f030a8ba762586d2

clang/include/clang/Driver/Driver.h
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp

index 04b46782467d6adc37694e8b2f67901f18edf6f1..94b27a0fade8cfb4669f4d1057ec2b426ae9284d 100644 (file)
@@ -154,6 +154,10 @@ public:
   /// command line.
   std::string Dir;
 
+  /// The real path the driver executable was in, as invoked from the
+  /// command line. It differs from Dir in case of accelerated environment.
+  std::string RealDir;
+
   /// The original path to the clang executable.
   std::string ClangExecutable;
 
index e304130f09a51ac0e22f0900001a8466aca9e142..d7508015f41e2aae2fa9fb75c07836484dc7805c 100644 (file)
@@ -219,6 +219,8 @@ Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
   if (!this->VFS)
     this->VFS = llvm::vfs::getRealFileSystem();
 
+  RealDir = llvm::sys::path::parent_path(ClangExecutable);
+
 // Skip /emul if we work in accelerated environment
 #define QEMU_ACCEL_DIR "/emul"
   if (ClangExecutable.substr(0, sizeof(QEMU_ACCEL_DIR) - 1) == QEMU_ACCEL_DIR)
index 019df16a909f4e3445bd56c0ae203142e032da3e..283c27b1f42f387615258cc1af90d0401b2f6ff1 100644 (file)
@@ -836,7 +836,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
 #endif
 
     SmallString<1024> Plugin;
-    llvm::sys::path::native(Twine(D.Dir) +
+    llvm::sys::path::native(Twine(D.RealDir) +
                                 "/../" CLANG_INSTALL_LIBDIR_BASENAME +
                                 PluginName + Suffix,
                             Plugin);