On 1/29/18 1:23 PM, Segher Boessenkool wrote: >> I also added the pa6t to 970 translation you mentioned in the bugzilla.>> If >> you want me to drop that, that's easy enough to do. > > Yeah dropping it is probably best.
Will do. >> +#ifdef __linux__ >> +/* Canonical GCC cpu name table. */ >> +static const char *rs6000_supported_cpu_names[] = >> +{ >> +#define RS6000_CPU(NAME, CPU, FLAGS) NAME, >> +#include "rs6000-cpus.def" >> +#undef RS6000_CPU >> +}; > > Can't you just use processor_target_table here? Seems like a waste to > duplicate all that. (Need to make the table non-static then of course). Changing it to static won't help, because we don't link rs6000.o into xgcc. That file is linked into cc1, etc, so we don't have access to it. >> static const char * >> elf_platform (void) >> { >> - int fd; >> + static const char *cpu = NULL; > > Add a comment here please, static funtion-scope variables are confusing > (but handy, in cases like this). Will do. >> + /* The kernel returned an AT_PLATFORM name we do not support. */ >> + s = XALLOCAVEC (char, len); > > I don't think building up the list of names in a string buys you anything? > >> + fatal_error ( >> + input_location, >> + "Unsupported cpu name returned from kernel for -mcpu=native: %s\n" >> + "Please use an explicit cpu name. Valid cpu names are: %s", >> + cpu, s); > > "Valid cpu names are:\n" and then a loop printing each name? Or get > fancy and throw in newlines too so it even looks good. Well, this isn't fprintf that I can call multiple times to emit my entire error message. Once you call fatal_error(), it never returns, so I copied the way opts-common.c:cmdline_handle_error() emits its error message which is to build it up and then emit it altogether like this....however, I now see I copied GCC 5's version of this code. Doh! :-) The current version of that code looks like the following, which I should copy instead. Unless you have a different suggestion? char *s; if (e->unknown_error) error_at (loc, e->unknown_error, arg); else error_at (loc, "unrecognized argument in option %qs", opt); auto_vec <const char *> candidates; for (i = 0; e->values[i].arg != NULL; i++) { if (!enum_arg_ok_for_language (&e->values[i], lang_mask)) continue; candidates.safe_push (e->values[i].arg); } const char *hint = candidates_list_and_hint (arg, s, candidates); if (hint) inform (loc, "valid arguments to %qs are: %s; did you mean %qs?", option->opt_text, s, hint); else inform (loc, "valid arguments to %qs are: %s", option->opt_text, s); XDELETEVEC (s); Peter