struct args **compiler_args)
{
bool found_c_opt = false;
+ bool found_dc_opt = false;
bool found_S_opt = false;
bool found_pch = false;
bool found_fpch_preprocess = false;
continue;
}
+ // when using nvcc with separable compilation, -dc implies -c
+ if ((str_eq(argv[i], "-dc") || str_eq(argv[i], "--device-c")) && guessed_compiler == GUESSED_NVCC) {
+ found_dc_opt = true;
+ continue;
+ }
+
// -S changes the default extension.
if (str_eq(argv[i], "-S")) {
args_add(common_args, argv[i]);
if (language_for_file(argv[i])) {
cc_log("Multiple input files: %s and %s", input_file, argv[i]);
stats_update(STATS_MULTIPLE);
- } else if (!found_c_opt) {
+ } else if (!found_c_opt && !found_dc_opt) {
cc_log("Called for link with %s", argv[i]);
if (strstr(argv[i], "conftest.")) {
stats_update(STATS_CONFTEST);
goto out;
}
- if (!found_c_opt && !found_S_opt) {
+ if (!found_c_opt && !found_dc_opt && !found_S_opt) {
if (output_is_precompiled_header) {
args_add(common_args, "-c");
} else {
args_add(*compiler_args, "-c");
}
+ if (found_dc_opt) {
+ args_add(*compiler_args, "-dc");
+ }
+
for (size_t i = 0; i < arch_args_size; ++i) {
args_add(*compiler_args, "-arch");
args_add(*compiler_args, arch_args[i]);