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

            Bug ID: 17640
           Summary: [i386] Convert load to lea
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at google dot com
          Reporter: hjl.tools at gmail dot com
                CC: ian at airs dot com

For i386, we should convert

    mov foo@GOT(%reg), %reg

to

   lea foo@GOTOFF(%reg), %reg

if foo is a local symbol.  This is the result from ld:

[hjl@gnu-6 lea-1]$ cat lea2.s
    .text
    .type    foo, @function
foo:
    ret
    .size    foo, .-foo
    .globl    bar
    .type    bar, @function
bar:
    movl    foo@GOT(%ecx), %eax
    .size    bar, .-bar
[hjl@gnu-6 lea-1]$ gcc -c -m32 lea2.s
[hjl@gnu-6 lea-1]$ ld -m elf_i386 -shared lea2.o
[hjl@gnu-6 lea-1]$ objdump -dw a.out 

a.out:     file format elf32-i386


Disassembly of section .text:

00000129 <foo>:
 129:    c3                       ret    

0000012a <bar>:
 12a:    8d 81 a1 ef ff ff        lea    -0x105f(%ecx),%eax
[hjl@gnu-6 lea-1]$

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

Reply via email to