Skip to content

Commit 52b70a6

Browse files
committed
add _GCC_WRITE_OUTFILES support drivers
1 parent 95e1e79 commit 52b70a6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

gcc/gcc.cc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5659,8 +5659,17 @@ end_going_arg (void)
56595659
string = full_script_path;
56605660
}
56615661
store_arg (string, delete_this_arg, this_is_output_file);
5662-
if (this_is_output_file)
5662+
if (this_is_output_file) {
5663+
const char *ofn = env.get("_GCC_WRITE_OUTFILES");
56635664
outfiles[input_file_number] = string;
5665+
if (ofn && *ofn) {
5666+
FILE *f = fopen(ofn, "a");
5667+
if (f) {
5668+
fprintf(f, "%s\n", string);
5669+
fclose(f);
5670+
}
5671+
}
5672+
}
56645673
arg_going = 0;
56655674
}
56665675
}
@@ -8584,6 +8593,17 @@ driver::set_up_specs () const
85848593
/* Now that we have the switches and the specs, set
85858594
the subdirectory based on the options. */
85868595
set_multilib_dir ();
8596+
8597+
if (output_file) {
8598+
const char *ofn = env.get("_GCC_WRITE_OUTFILES");
8599+
if (ofn && *ofn) {
8600+
FILE *f = fopen(ofn, "a");
8601+
if (f) {
8602+
fprintf(f, "%s\n", output_file);
8603+
fclose(f);
8604+
}
8605+
}
8606+
}
85878607
}
85888608

85898609
/* Set up to remember the pathname of gcc and any options

0 commit comments

Comments
 (0)