[llvm-commits] [patch] Enable unnamed_addr in declarations again

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Fri Jan 14 23:47:57 PST 2011


> * module 1 has strong const unnamed_addr symbol foo and an internal
> unnamed_add const bar with the same init as foo
> * module 2 has weak symbols foo and its address matters
>
> We optimize 1 and constmerge does its job and bar is merged with foo. We
> now link 1 and 2, and 2's assumptions are already wrong.

Sorry for replying to myself, but this is still a bit confusing to me.

I think I understand you now. If we say that a symbol whose address 
matters is only guaranteed to have an address different from all other 
symbols whose address matters, we get a much simpler model. Maybe that 
is what you were thinking. Under these rules

* Constmerge *can* merge two constants as long as *one* of them is 
unnamed_addr. The resulting constant is unnamed_addr if and only if both 
original ones are.
* Weak symbols are really not an exception and the linker always uses an 
'and' in all cases.

I will give that a try, thanks a lot.

Cheers,
Rafael



More information about the llvm-commits mailing list