https://sourceware.org/bugzilla/show_bug.cgi?id=19609
Bug ID: 19609 Summary: Load weak undefined symbol isn't optimized Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-6 weakundef-1]$ cat x.c extern void bar (void) __attribute__((weak)); void * _start (void) { return bar; } [hjl@gnu-6 weakundef-1]$ make gcc -O2 -fPIC -c -o x.o x.c ld -o x x.o objdump -dw x x: file format elf64-x86-64 Disassembly of section .text: 00000000004000f0 <_start>: 4000f0: 48 8b 05 31 00 20 00 mov 0x200031(%rip),%rax # 600128 <_start+0x200038> 4000f7: c3 retq [hjl@gnu-6 weakundef-1]$ Since the address of bar won't change at run-time, mov should be optimized to lea. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils