Hi Peter,

On Thu, Jan 25, 2018 at 09:39:39PM -0600, Peter Bergner wrote:
> Ok, here is a separate translation table like you wanted.  I still use the
> RS6000_CPU table to hold entire list of canonical cpu names, the new
> translation table in driver-rs6000.c only contains cpus whose AT_PLATFORM
> names do not match their GCC canonical names.  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.

> Is this better?  I did the same unit testing by forcing unknown names
> and names that need translation and I've verified it works.  Bootstrap
> and regtesting is still running though.

Looks much better, thanks.  Some smaller things:

> +#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).

>  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).

> +       /* 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.

Thanks,


Segher

Reply via email to