]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/i386/cpuinfo.c
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / i386 / cpuinfo.c
CommitLineData
792317cc 1/* Get CPU type and Features for x86 processors.
7adcbafe 2 Copyright (C) 2012-2022 Free Software Foundation, Inc.
792317cc
ST
3 Contributed by Sriraman Tallam (tmsriram@google.com)
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
46549c20
MK
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
792317cc
ST
25
26#include "cpuid.h"
27#include "tsystem.h"
aca06c90 28#include "auto-target.h"
1890f2f0
L
29#include "common/config/i386/i386-cpuinfo.h"
30#include "common/config/i386/cpuinfo.h"
792317cc 31
aca06c90
RO
32#ifdef HAVE_INIT_PRIORITY
33#define CONSTRUCTOR_PRIORITY (101)
34#else
35#define CONSTRUCTOR_PRIORITY
36#endif
37
38int __cpu_indicator_init (void)
39 __attribute__ ((constructor CONSTRUCTOR_PRIORITY));
792317cc 40
792317cc 41
31cfd832 42struct __processor_model __cpu_model = { };
ae6dca8c
JJ
43/* We want to move away from __cpu_model in libgcc_s.so.1 and the
44 size of __cpu_model is part of ABI. So, new features that don't
45 fit into __cpu_model.__cpu_features[0] go into extra variables
1890f2f0 46 in libgcc.a only, preferably hidden.
4f0e90fa 47
1890f2f0
L
48 NB: Since older 386-builtins.c accesses __cpu_features2 as scalar or
49 smaller array, it can only access the first few elements. */
50unsigned int __cpu_features2[SIZE_OF_CPU_FEATURES];
792317cc 51
792317cc
ST
52/* A constructor function that is sets __cpu_model and __cpu_features with
53 the right values. This needs to run only once. This constructor is
54 given the highest priority and it should run before constructors without
55 the priority set. However, it still runs after ifunc initializers and
56 needs to be called explicitly there. */
57
aca06c90 58int __attribute__ ((constructor CONSTRUCTOR_PRIORITY))
792317cc
ST
59__cpu_indicator_init (void)
60{
1890f2f0
L
61 struct __processor_model2 cpu_model2;
62 return cpu_indicator_init (&__cpu_model, &cpu_model2,
63 __cpu_features2);
792317cc 64}
abd0cdc9
L
65
66#if defined SHARED && defined USE_ELF_SYMVER
67__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
68__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
69#endif