aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2022-09-09 21:54:49 -0400
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2022-09-26 22:16:17 -0400
commit1172bdecfab364579d90e6aa5ba7fc64a5b96786 (patch)
tree5579b8ff0b2c97f7778f499c7502e5108eb8bc2f /clang/lib/Driver/Driver.cpp
parent46fc75ab28b78a730ea21fd7daba6443937bfaac (diff)
downloadllvm-1172bdecfab364579d90e6aa5ba7fc64a5b96786.zip
llvm-1172bdecfab364579d90e6aa5ba7fc64a5b96786.tar.gz
llvm-1172bdecfab364579d90e6aa5ba7fc64a5b96786.tar.bz2
[HIP] Fix unbundling archive
HIP is able to unbundle archive of bundled bitcode. However currently there are two bugs: 1. archives passed by -l: are not unbundled. 2. archives passed as input files are not unbundled The actual file name of an archive passed by -l: should not be prefixed with lib and appended with '.a', but the file path is prefixed with paths in '-L' options. The actual file name of an archive passed as an input file stays the same, not affected by the '-L' options.
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 85c4bb4..c16797f 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2909,12 +2909,16 @@ class OffloadingActionBuilder final {
std::string FileName = IA->getInputArg().getAsString(Args);
// Check if the type of the file is the same as the action. Do not
// unbundle it if it is not. Do not unbundle .so files, for example,
- // which are not object files.
+ // which are not object files. Files with extension ".lib" is classified
+ // as TY_Object but they are actually archives, therefore should not be
+ // unbundled here as objects. They will be handled at other places.
+ const StringRef LibFileExt = ".lib";
if (IA->getType() == types::TY_Object &&
(!llvm::sys::path::has_extension(FileName) ||
types::lookupTypeForExtension(
llvm::sys::path::extension(FileName).drop_front()) !=
- types::TY_Object))
+ types::TY_Object ||
+ llvm::sys::path::extension(FileName) == LibFileExt))
return ABRT_Inactive;
for (auto Arch : GpuArchList) {