On Thu, Feb 5, 2015 at 2:23 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Thu, Feb 5, 2015 at 2:05 PM, Sriraman Tallam <tmsri...@google.com> wrote: >> On Thu, Feb 5, 2015 at 11:59 AM, Richard Henderson <r...@redhat.com> wrote: >>> On 02/05/2015 11:01 AM, H.J. Lu wrote: >>>> Can you elaborate why it depends on COPY relocation? There >>>> is no COPY relocation on x86-64. >>> >>> Ho hum, we appear to have switched topics mid-thread. >>> >>> I agree that we cannot override a weak symbol in the executable with even a >>> non-weak symbol in a shared library. >> >> Hi HJ, >> >> Is your patch supposed to fix weak symbols too? Will >> SYMBOL_REF_LOCAL_P evaluate to true for weak defined symbols with this >> patch? I tested this in gcc-4_9 and it didnt seem to do that. > > I am working on a comprehensive patch. I will post it > after testing is finished.
Thanks! Sri > > -- > H.J. > -- > [hjl@gnu-6 copyreloc-3]$ cat initweak.i > __attribute__((weak)) > int xxxxxxxxxxxx = -1; > > int > foo () > { > return xxxxxxxxxxxx; > } > [hjl@gnu-6 copyreloc-3]$ cat commonweak.i > __attribute__((weak)) > int xxxxxxxxxxxx; > > int > foo () > { > return xxxxxxxxxxxx; > } > [hjl@gnu-6 copyreloc-3]$ make initweak.s commonweak.s > /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc > -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -pie -fpie -O3 > -fuse-ld=gold -S initweak.i > /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc > -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -pie -fpie -O3 > -fuse-ld=gold -S commonweak.i > [hjl@gnu-6 copyreloc-3]$ cat commonweak.s initweak.s > .file "commonweak.i" > .section .text.unlikely,"ax",@progbits > .LCOLDB0: > .text > .LHOTB0: > .p2align 4,,15 > .globl foo > .type foo, @function > foo: > .LFB0: > .cfi_startproc > movl xxxxxxxxxxxx(%rip), %eax > ret > .cfi_endproc > .LFE0: > .size foo, .-foo > .section .text.unlikely > .LCOLDE0: > .text > .LHOTE0: > .weak xxxxxxxxxxxx > .bss > .align 4 > .type xxxxxxxxxxxx, @object > .size xxxxxxxxxxxx, 4 > xxxxxxxxxxxx: > .zero 4 > .ident "GCC: (GNU) 5.0.0 20150205 (experimental)" > .section .note.GNU-stack,"",@progbits > .file "initweak.i" > .section .text.unlikely,"ax",@progbits > .LCOLDB0: > .text > .LHOTB0: > .p2align 4,,15 > .globl foo > .type foo, @function > foo: > .LFB0: > .cfi_startproc > movl xxxxxxxxxxxx(%rip), %eax > ret > .cfi_endproc > .LFE0: > .size foo, .-foo > .section .text.unlikely > .LCOLDE0: > .text > .LHOTE0: > .weak xxxxxxxxxxxx > .data > .align 4 > .type xxxxxxxxxxxx, @object > .size xxxxxxxxxxxx, 4 > xxxxxxxxxxxx: > .long -1 > .ident "GCC: (GNU) 5.0.0 20150205 (experimental)" > .section .note.GNU-stack,"",@progbits > [hjl@gnu-6 copyreloc-3]$