bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/19609] New: Load weak undefined symbol isn't optimized


From: hjl.tools at gmail dot com
Subject: [Bug ld/19609] New: Load weak undefined symbol isn't optimized
Date: Thu, 11 Feb 2016 11:04:31 +0000

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: ---

address@hidden weakundef-1]$ cat x.c
extern void bar (void) __attribute__((weak));

void *
_start (void)
{
  return bar;
}
address@hidden 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   
address@hidden 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]