On Dec 11, 2005, Alexandre Oliva <[EMAIL PROTECTED]> wrote:

> On Dec  1, 2005, [EMAIL PROTECTED] (Geoffrey Keating) wrote:

>> The easiest solution to this is to require that weakrefs must be
>> 'static', because the name that they define is not visible outside
>> this translation unit.

> While this is true, not all properties of static names hold for
> weakrefs.  If the name they refer to is not itself static, none of the
> local-binding analysis properties will apply correctly if the wekaref
> is marked as static.  I felt it was safer to keep it extern.

As evidenced by the following testcase:

extern int i;
static int j __attribute__((weakref("i")));
int f() {
  return j;
}

whose output assembly for AMD64 is:
[...]
        movl    j(%rip), %eax
[...]
        .weakref        j,i
[...]

So you see, j(%rip) is only valid when a symbol is known to be defined
in the same loadable module, but this is definitely not known for the
testcase above.

I thus propose your change to be reverted, and request you to explain
what you were trying to fix with this patch so that I can try to do
something about it.

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   [EMAIL PROTECTED], gcc.gnu.org}
Free Software Evangelist  [EMAIL PROTECTED], gnu.org}

Reply via email to