summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-09-25 17:09:17 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-09-25 17:09:17 +0000
commit464ab241e7e613002d6749c32183c01c6f3c0525 (patch)
treebd0de71950262550de5c6188cdfa863b162c9584 /clang/lib
parent28e7e60ea4d176e9fffb15101b62d29d862ef370 (diff)
downloadbcm5719-llvm-464ab241e7e613002d6749c32183c01c6f3c0525.tar.gz
bcm5719-llvm-464ab241e7e613002d6749c32183c01c6f3c0525.zip
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
clang-offload-bundler should not be invoked with the unbundling action when the input file type does not match the action type. For example, .so files should be unbundled during linking phase and should be linked only with the host code. llvm-svn: 342991
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Driver.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 81369f995da..0b74bbf6df3 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2559,6 +2559,8 @@ class OffloadingActionBuilder final {
getDeviceDependences(OffloadAction::DeviceDependences &DA,
phases::ID CurPhase, phases::ID FinalPhase,
PhasesTy &Phases) override {
+ if (OpenMPDeviceActions.empty())
+ return ABRT_Inactive;
// We should always have an action for each input.
assert(OpenMPDeviceActions.size() == ToolChains.size() &&
@@ -2817,6 +2819,16 @@ public:
if (CanUseBundler && isa<InputAction>(HostAction) &&
InputArg->getOption().getKind() == llvm::opt::Option::InputClass &&
!types::isSrcFile(HostAction->getType())) {
+ StringRef FileName = InputArg->getAsString(C.getArgs());
+ // 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.
+ if (HostAction->getType() == types::TY_Object &&
+ llvm::sys::path::has_extension(FileName) &&
+ types::lookupTypeForExtension(
+ llvm::sys::path::extension(FileName).drop_front()) !=
+ HostAction->getType())
+ return false;
auto UnbundlingHostAction =
C.MakeAction<OffloadUnbundlingJobAction>(HostAction);
UnbundlingHostAction->registerDependentActionInfo(
OpenPOWER on IntegriCloud