[Gc] Win64 GCC supprt

Kai Tietz ktietz70 at googlemail.com
Fri Jun 19 05:53:24 PDT 2009


2009/6/19 NightStrike <nightstrike at gmail.com>:
> On Fri, Jun 19, 2009 at 5:51 AM, Andrew Haley<aph at redhat.com> wrote:
>> NightStrike wrote:
>>> On Thu, Jun 18, 2009 at 4:52 PM, NightStrike<nightstrike at gmail.com> wrote:
>>>> On Thu, Jun 18, 2009 at 4:14 PM, Andrew Haley<aph at redhat.com> wrote:
>>>>>
>>>>>> Second, compiling yields this failure:
>>>>>>
>>>>>> ../mallocx.c:32:1: error: initializer element is not constant
>>>>>> ../mallocx.c:33:1: error: initializer element is not constant
>>>>>> ../mallocx.c:34:1: error: initializer element is not constant
>>>>>> ../mallocx.c:36:5: error: initializer element is not constant
>>>>>>
>>>>>>
>>>>>> It appears that certain things are being initialized by variables, and
>>>>>> this is not AFAIK supported.
>>>>> Can you expand that with gcc -E ?  Then we'll see what's wrong with the
>>>>> initializer.
>>
>>>>>
>>>> Adding -E to the commandline didn't work, so I added -save-temps.  For
>>>> some reason, -E made gcc return immediately with no output.
>>>>
>>>> I am attaching mallocx.i
>>
>> Well, I don't think we wanted all of it.
>
> Sorry :(
>
>> The problem is here.
>>
>> void ** const GC_objfreelist_ptr = GC_arrays._objfreelist;
>> void ** const GC_aobjfreelist_ptr = GC_arrays._aobjfreelist;
>> void ** const GC_uobjfreelist_ptr = GC_arrays._uobjfreelist;
>>
>>    void ** const GC_auobjfreelist_ptr = GC_arrays._auobjfreelist;
>>
>> Now, this is very strange.  The initialization works correctly
>> and as far as I can see it is legal:
>>
>> struct _GC_arrays {
>>  ...
>>     void *_objfreelist[((size_t)((((1 << 12)/2))>>4))+1];
>> ...
>> };
>>
>> void *GC_arrays._objfreelist[] should decay to a void**, and it
>> is a legitimate address constant by my reading of Section 6.6,
>> Constant Expressions.
>>
>> I wonder if the real problem may be this:
>>
>> __attribute__((dllimport)) struct _GC_arrays GC_arrays;
>>
>> Maybe the address if a dllimport isn't an address constant.  If so,
>> you'll have to initialize GC_objfreelist_ptr in an initializer
>> routine.
>
> I don't even know what that means..... Kai?
>

Hello,

no this is for sure an issue of GC's header definition here.The issue
about the dllimport here is, that it is declared always as imported
(even on implementation). And of course an imported variable can't be
modified in global scope as it looks for the compiler that it is
placed within foreign dll. The solution here is to use instead (for
implementation) the dllexport attribute.

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination



More information about the Gc mailing list