Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 802930 | Differences between
and this patch

Collapse All | Expand All

(-)a/gcc/config/powerpcspe/driver-powerpcspe.c (-9 / +89 lines)
Lines 23-28 along with GCC; see the file COPYING3. If not see Link Here
23
#include "system.h"
23
#include "system.h"
24
#include "coretypes.h"
24
#include "coretypes.h"
25
#include "tm.h"
25
#include "tm.h"
26
#include "diagnostic.h"
27
#include "opts.h"
26
#include <stdlib.h>
28
#include <stdlib.h>
27
29
28
#ifdef _AIX
30
#ifdef _AIX
Lines 38-43 along with GCC; see the file COPYING3. If not see Link Here
38
# include <sys/sysctl.h>
40
# include <sys/sysctl.h>
39
#endif
41
#endif
40
42
43
#ifdef __linux__
44
/* Canonical GCC cpu name table.  */
45
static const char *rs6000_supported_cpu_names[] =
46
{
47
#define RS6000_CPU(NAME, CPU, FLAGS) NAME,
48
#include "powerpcspe-cpus.def"
49
#undef RS6000_CPU
50
};
51
52
/* This table holds a list of cpus where their Linux AT_PLATFORM name differs
53
   from their GCC canonical name.  The first column in a row contains the GCC
54
   canonical cpu name and the other columns in that row contain AT_PLATFORM
55
   names that should be mapped to the canonical name.  */
56
57
static const char *linux_cpu_translation_table[][4] = {
58
  { "403", "ppc403", NULL },
59
  { "405", "ppc405", NULL },
60
  { "440", "ppc440", "ppc440gp", NULL },
61
  { "476", "ppc470", NULL },
62
  { "601", "ppc601", NULL },
63
  { "603", "ppc603", NULL },
64
  { "604", "ppc604", NULL },
65
  { "7400", "ppc7400", NULL },
66
  { "7450", "ppc7450", NULL },
67
  { "750", "ppc750", NULL },
68
  { "823", "ppc823", NULL },
69
  { "8540", "ppc8540", NULL },
70
  { "8548", "ppc8548", NULL },
71
  { "970", "ppc970", NULL },
72
  { "cell", "ppc-cell-be", NULL },
73
  { "e500mc", "ppce500mc", NULL },
74
  { "e5500", "ppce5500", NULL },
75
  { "e6500", "ppce6500", NULL },
76
  { "power7", "power7+", NULL },
77
  { NULL } /* End of table sentinel.  */
78
};
79
#endif
80
41
const char *host_detect_local_cpu (int argc, const char **argv);
81
const char *host_detect_local_cpu (int argc, const char **argv);
42
82
43
#if GCC_VERSION >= 0
83
#if GCC_VERSION >= 0
Lines 158-171 detect_processor_freebsd (void) Link Here
158
198
159
#ifdef __linux__
199
#ifdef __linux__
160
200
161
/* Returns AT_PLATFORM if present, otherwise generic PowerPC.  */
201
/* Returns the canonical AT_PLATFORM if present, otherwise NULL.  */
162
202
163
static const char *
203
static const char *
164
elf_platform (void)
204
elf_platform (void)
165
{
205
{
166
  int fd;
206
  /* Used to cache the result we determine below.  */
207
  static const char *cpu = NULL;
167
208
168
  fd = open ("/proc/self/auxv", O_RDONLY);
209
  /* Use the cached AT_PLATFORM cpu name if we've already determined it.  */
210
  if (cpu != NULL)
211
    return cpu;
212
213
  int fd = open ("/proc/self/auxv", O_RDONLY);
169
214
170
  if (fd != -1)
215
  if (fd != -1)
171
    {
216
    {
Lines 179-193 elf_platform (void) Link Here
179
      if (n > 0)
224
      if (n > 0)
180
	{
225
	{
181
	  for (av = (ElfW(auxv_t) *) buf; av->a_type != AT_NULL; ++av)
226
	  for (av = (ElfW(auxv_t) *) buf; av->a_type != AT_NULL; ++av)
182
	    switch (av->a_type)
227
	    if (av->a_type == AT_PLATFORM)
183
	      {
228
	      {
184
	      case AT_PLATFORM:
229
		/* Cache the result.  */
185
		return (const char *) av->a_un.a_val;
230
		cpu = (const char *) av->a_un.a_val;
186
187
	      default:
188
		break;
231
		break;
189
	      }
232
	      }
190
	}
233
	}
234
235
      /* Verify that CPU is either a valid -mcpu=<cpu> option name, or is a
236
	 valid alternative name.  If it is a valid alternative name, then use
237
	 the canonical name.  */
238
      if (cpu != NULL)
239
	{
240
	  size_t i, j;
241
	  char *s;
242
243
	  /* Check if AT_PLATFORM is a GCC canonical cpu name.  */
244
	  for (i = 0; i < ARRAY_SIZE (rs6000_supported_cpu_names); i++)
245
	    if (!strcmp (cpu, rs6000_supported_cpu_names[i]))
246
	      return cpu;
247
248
	  /* Check if AT_PLATFORM can be translated to a canonical cpu name.  */
249
	  for (i = 0; linux_cpu_translation_table[i][0] != NULL; i++)
250
	    {
251
	      const char *canonical = linux_cpu_translation_table[i][0];
252
	      for (j = 1; linux_cpu_translation_table[i][j] != NULL; j++)
253
		if (!strcmp (cpu, linux_cpu_translation_table[i][j]))
254
		  {
255
		    /* Cache the result.  */
256
		    cpu = canonical;
257
		    return cpu;
258
		  }
259
	    }
260
261
	  /* The kernel returned an AT_PLATFORM name we do not support.  */
262
	  auto_vec <const char *> candidates;
263
	  for (i = 0; i < ARRAY_SIZE (rs6000_supported_cpu_names); i++)
264
	    candidates.safe_push (rs6000_supported_cpu_names[i]);
265
	  candidates_list_and_hint (cpu, s, candidates);
266
	  fatal_error (
267
	    input_location,
268
	    "Unsupported cpu name returned from kernel for -mcpu=native: %s\n"
269
	    "Please use an explicit cpu name.  Valid cpu names are: %s",
270
	    cpu, s);
271
	}
191
    }
272
    }
192
  return NULL;
273
  return NULL;
193
}
274
}
194
- 

Return to bug 802930