}
}
+static void print_file_name(const char *file)
+{
+ add_flag(&ldflags_obst, "-print-file-name=%s", file);
+
+ obstack_1grow(&ldflags_obst, '\0');
+ const char *flags = obstack_finish(&ldflags_obst);
+
+ /* construct commandline */
+ obstack_printf(&ldflags_obst, "%s ", LINKER);
+ obstack_printf(&ldflags_obst, "%s", flags);
+ obstack_1grow(&ldflags_obst, '\0');
+
+ char *commandline = obstack_finish(&ldflags_obst);
+
+ if (verbose) {
+ puts(commandline);
+ }
+ int err = system(commandline);
+ if (err != EXIT_SUCCESS) {
+ fprintf(stderr, "linker reported an error\n");
+ exit(1);
+ }
+}
+
static const char *try_dir(const char *dir)
{
if (dir == NULL)
initialize_firm();
const char *dumpfunction = NULL;
+ const char *print_file_name_file = NULL;
compile_mode_t mode = CompileAssembleLink;
int opt_level = 1;
int result = EXIT_SUCCESS;
strncpy(cpu_arch, opt, sizeof(cpu_arch));
}
} else if (option[0] == 'W') {
- if (option[1] == 'p') {
+ if (strstart(option + 1, "p,")) {
// pass options directly to the preprocessor
const char *opt;
GET_ARG_AFTER(opt, "-Wp,");
(fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg), standard);
} else if (streq(option, "version")) {
print_cparser_version();
+ } else if (strstart(option, "print-file-name=")) {
+ GET_ARG_AFTER(print_file_name_file, "-print-file-name=");
} else if (option[0] == '-') {
/* double dash option */
++option;
}
}
+ if (print_file_name_file != NULL) {
+ print_file_name(print_file_name_file);
+ return 0;
+ }
+
if (files == NULL) {
fprintf(stderr, "error: no input files specified\n");
argument_errors = true;