------- Comment #29 from iains at gcc dot gnu dot org  2010-08-27 17:38 -------
(In reply to comment #12)
> Subject: Re:  m32 lto produces non-relocatable subtraction
>         expression errors
> 
> Hmm, actually the symbol is not changed, since it is externally visible 
> symbol.
> I guess the problem would be that the symbol is used by 2 units, so both of
> them gets the declaration, but both of them gets the declaration with
> initializer (not extern).  To avoid duplicate definitions, varpool.c is 
> testing
> in_other_partition and prevents calling assemble_variable on them. 

so one gets emitted and the other doesn't?

This works
> just fine on ELF since extern vars don't need to be announced.  

we don't need to announce them either ... (assemble_external() is a no-op).

Here we
> apparently need to get it assembled, but it is not getting via
> assemble_external.

we need to get the right entry into the machopic tables - if the var is local
to the TU ... 
> 
> Rebuilding the decl to DECL_EXTERN is probably possible, but somewhat hackish.

I guess this is just allowing it to be assembled... 

===

It is possible that the following is the root of the problem; 

when deciding how to output a var darwin/macho-pic takes the presence of an
initializer as evidence that the var is defined in the current TU and that,
therefore, it can reference it locally and doesn't need to output the other
stuff.  unless the var passes through assemble_var () this will not get done.

assemble_external () seems a bit hackish too...

I'm not clear why the two instances are not coalesced by the whopr process?
Is that to cater for file-scope vars?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44812

Reply via email to