https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78253
Christophe Lyon <clyon at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2016-11-08
Ever confirmed|0 |1
--- Comment #4 from Christophe Lyon <clyon at gcc dot gnu.org> ---
With gcc 4.9, the generated code looks like:
save_weak_func_pointer:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
@ link register save eliminated.
str fp, [sp, #-4]!
add fp, sp, #0
ldr r3, .L7
.LPIC1:
add r3, pc, r3
ldr r2, .L7+4
ldr r2, [r3, r2]
ldr r1, .L7+8
ldr r3, [r3, r1]
str r3, [r2]
sub sp, fp, #0
@ sp needed
ldr fp, [sp], #4
bx lr
.L8:
.align 2
.L7:
.word _GLOBAL_OFFSET_TABLE_-(.LPIC1+8)
.word __weak_func_ptr(GOT)
.word some_weak_func(GOT)
With gcc 5.3:
save_weak_func_pointer:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
@ link register save eliminated.
str fp, [sp, #-4]!
add fp, sp, #0
ldr r2, .L7
.LPIC1:
add r2, pc, r2
ldr r3, .L7+4
ldr r3, [r2, r3]
ldr r2, .L7+8
.LPIC2:
add r2, pc, r2
str r2, [r3]
nop
sub sp, fp, #0
@ sp needed
ldr fp, [sp], #4
bx lr
.L8:
.align 2
.L7:
.word _GLOBAL_OFFSET_TABLE_-(.LPIC1+8)
.word __weak_func_ptr(GOT)
.word some_weak_func-(.LPIC2+8)
That is, some_weak_func is not referenced through the got anymore.
I've noticed that r220674 introduced a new param to default_binds_local_p:
weak_dominates, which is true when called via default_binds_local_p_2.
I am not sure what "weak_dominates", and I couldn't find a description in the
gcc-patches thread where r220674 and more recent updates were discussed.
I am wondering whether have weak_dominates=false on arm is the right fix, as it
does not explain why the sample code works on x86_64 and aarch64.