[4.7][google]Support for getting CPU type and feature information at run-time. (issue4893046)

Sriraman Tallam tmsriram@google.com
Fri Aug 26 17:59:00 GMT 2011


On Thu, Aug 25, 2011 at 6:02 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 25, 2011 at 5:37 PM, Sriraman Tallam <tmsriram@google.com> wrote:
>> Hi,
>>
>>  Thanks for all the comments. I am attaching a new patch
>> incorporating all of the changes mentioned, mainly :
>>
>> 1) Make __cpu_indicator_init a constructor in libgcc and guard to call
>> it only once.
>
> This is unreliable and you don't need 3 symbols from libgcc. You can use

Do you mean it is unreliable because of the constructor ordering problem?

>
> static struct cpu_indicator
> {
>  feature
>  model
>  status
> } cpu_indicator;
>
> struct cpu_indicator *
> __get_cpu_indicator ()
> {
>   if cpu_indicator is uninitialized; then
>      initialize cpu_indicator;
>  return &cpu_indicator;
> }
>
> You can simply call __get_cpu_indicator to
> get a pointer to cpu_indicator;
>
> --
> H.J.
>



More information about the Gcc-patches mailing list