[K42-discussion] genConstants.c on x86_64/gcc4.1

Patrick G. Bridges bridges at cs.unm.edu
Sat Sep 8 13:25:59 EST 2007


Managed to make something work. Stored the address of the generated  
variable to a volatile
extern pointer after generating the reference, to force it to be live.

-Patrick

On Sep 7, 2007, at 6:20 PM, Paul H. Hargrove wrote:

> Patrick G. Bridges wrote:
>> I'm slowly working through the x86_64/gcc4 port right now, and have
>> run into a roadblock with genConstants.s. As a reminder,
>> genConstants.C defines a function, genConstants, which is marked as a
>> friend function of a number of k42 classes, which itself defines an
>> initialized static unsigned long for each constant that a script
>> later pulls out of the generated assembly to create a header file of
>> constants that assembly code can use. This lets us have assembly
>> constants for, for example, offsets into classes.
>>
>> The problem I'm having on x86_64/gcc4.1 is that the generated code,
>> even with -O0 -g, doesn't generate symbols and data for these local
>> static variables, presumably because they're dead by static analysis?
>> We also cannot pull all of these definitions out to extern variables
>> without changing a number of class variables to being public (since
>> you can't "friend" global scope). I've also tried marking them as
>> volatile static, which doesn't help.
>>
>> Any suggestions on how to deal with this?
>> _______________________________________________
>> K42-discussion mailing list
>> K42-discussion at ozlabs.org
>> https://ozlabs.org/mailman/listinfo/k42-discussion
>>
> You might try various gcc attribute()s to achieve what you had hoped
> volatile would.
> -Paul
>
> -- 
> Paul H. Hargrove                          PHHargrove at lbl.gov
> Future Technologies Group
> HPC Research Department                   Tel: +1-510-495-2352
> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>
> _______________________________________________
> K42-discussion mailing list
> K42-discussion at ozlabs.org
> https://ozlabs.org/mailman/listinfo/k42-discussion



More information about the K42-discussion mailing list