Skip to content

Commit e73cdd0

Browse files
estewart08ronlieb
authored andcommitted
[openmp] - Do not look for asan.bc/ockl.bc if -nogpulib specified.
clang/test/Driver/openmp-runtimelib was asserting for builds with assertions enabled. The test passes -nogpulib as well as support for asan libs. We should not be looking for device-libs when -nogpulib is present. If asan is enabled, then ockl is added by default for llvm-link. But due to -nogpulib getOCKLPath() will be empty. Note that getOCKLPath() has an assert whilegetAsanRTLPath() does not. Overall premise, if -nogpulib is specified, do not look for asanrtl.bc or ockl.bc. Updated clang error if ockl.bc is not found. Change-Id: I3b1e5e81309a8dc17cf0355ed59a9fbf4e58ca46
1 parent be1b1d4 commit e73cdd0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,19 @@ const char *amdgpu::dlr::getLinkCommandArgs(
265265
if (Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize,
266266
true) &&
267267
TC.getSanitizerArgs(Args).needsAsanRt()) {
268-
std::string AsanRTL(RocmInstallation.getAsanRTLPath());
269-
// asanrtl is dependent on ockl so for every asanrtl bitcode linking
270-
// requires ockl but viceversa is not true.
271-
std::string OcklRTL(RocmInstallation.getOCKLPath());
272-
if (AsanRTL.empty() && OcklRTL.empty()) {
273-
if (!Args.hasArg(options::OPT_nogpulib))
268+
if (!Args.hasArg(options::OPT_nogpulib)){
269+
std::string AsanRTL(RocmInstallation.getAsanRTLPath());
270+
// asanrtl is dependent on ockl so for every asanrtl bitcode linking
271+
// requires ockl but viceversa is not true.
272+
std::string OcklRTL(RocmInstallation.getOCKLPath());
273+
if(AsanRTL.empty())
274274
TC.getDriver().Diag(diag::err_drv_no_asan_rt_lib);
275-
} else {
276-
BCLibs.push_back(AsanRTL);
277-
BCLibs.push_back(OcklRTL);
275+
else if(OcklRTL.empty())
276+
TC.getDriver().Diag(diag::err_drv_no_rocm_device_lib);
277+
else{
278+
BCLibs.push_back(AsanRTL);
279+
BCLibs.push_back(OcklRTL);
280+
}
278281
}
279282
}
280283
StringRef GPUArch = getProcessorFromTargetID(Triple, TargetID);

0 commit comments

Comments
 (0)