https://sourceware.org/bugzilla/show_bug.cgi?id=29655

--- Comment #12 from Andreas Krebbel <krebbel at linux dot ibm.com> ---
So do I understand it correctly that for the Qt case the example would look
more like this:

test2.c:

#include <stdio.h>

void alias () __attribute__ ((weak, alias ("bar")));
void bar() { printf("bar=%p alias=%p\n", bar, alias); }

test1.c:

void bar();
// void *get_bar_addr() { return bar; }
int main() { bar(); }


which gives the expected result on x86 (with line 2 commented out):
bar=0x7f1e4cdb4109 alias=0x7f1e4cdb4109

but not on s390x because we always resolve to the PLT slot:
bar=0x10004b8 alias=0x3fffdf00640

On the other hand the behavior Qt is relying on depends on whether the address
of bar is taken in main. So by uncommenting line 2 the problem occurs also on
x86:

bar=0x401030 alias=0x7f63ae84a109

Neither target appears to guarantee that aliases behave the same wrt pointer
equality. On non-s390x targets it only works because Qt happens to trigger a
case where it accidentally matches.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to