bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/11791] New: Garbage collection for STT_GNU_IFUNC symbols


From: stephen dot clarke at st dot com
Subject: [Bug ld/11791] New: Garbage collection for STT_GNU_IFUNC symbols
Date: 5 Jul 2010 16:15:29 -0000

$ cat test.s
        .section .text.foo,"ax",@progbits
        .type foo, @function
foo:
        .global foo
        movl address@hidden(%ecx), %eax
        ret

        .section .text.bar,"ax",@progbits
        .type bar, @function
bar:
        .global bar
        ret

        .section .text.ifunc,"ax",@progbits
        .type ifunc, @gnu_indirect_function
ifunc:
        ret

$ as -o test.o test.s
$ ld -e bar --gc-sections test.o

If I use a recent version of binutils:
$ ld -v
GNU ld (GNU Binutils) 2.20.51.20100702

then for the ld command I get segv, i.e.
$ ld -e bar --gc-sections test.o
Segmentation fault

but if I hack out the cause of that, then I get an executable in
which garbage collection has removed all the original sections that
refer to the ifunc symbol, but there is still a plt entry, got entry
and  dynamic relocation for the ifunc symbol.

$ objdump -h -d a.out

a.out:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .rel.plt      00000008  08048074  08048074  00000074  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .plt          00000010  0804807c  0804807c  0000007c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .text         00000001  0804808c  0804808c  0000008c  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .got.plt      00000010  08049090  08049090  00000090  2**2
                  CONTENTS, ALLOC, LOAD, DATA

Disassembly of section .plt:

0804807c <.plt>:
 804807c:       ff 25 9c 90 04 08       jmp    *0x804909c
 8048082:       68 00 00 00 00          push   $0x0
 8048087:       e9 00 00 00 00          jmp    804808c <bar>

Disassembly of section .text:

0804808c <bar>:
 804808c:       c3                      ret

-- 
           Summary: Garbage collection for STT_GNU_IFUNC symbols
           Product: binutils
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: stephen dot clarke at st dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11791

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



reply via email to

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