https://sourceware.org/bugzilla/show_bug.cgi?id=18900
Bug ID: 18900
Summary: Unnecessary PLT entry for function pointer
initialization
Product: binutils
Version: 2.26 (HEAD)
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-tools-1 no-plt-3]$ cat x.c
extern void foo (void);
void (*p) (void) = &foo;
int
main ()
{
p ();
return 0;
}
[hjl@gnu-tools-1 no-plt-3]$ cat foo.c
#include <stdio.h>
void
foo (void)
{
printf ("OK\n");
}
[hjl@gnu-tools-1 no-plt-3]$ make
gcc -g -c -o x.o x.c
gcc -g -fPIC -c -o foo.o foo.c
ld -shared -o libfoo.so foo.o
gcc -o x x.o libfoo.so -Wl,-rpath,.
./x
OK
readelf -r x
Relocation section '.rela.dyn' at offset 0x3d0 contains 1 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000600958 000200000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ +
0
Relocation section '.rela.plt' at offset 0x3e8 contains 2 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000600978 000100000007 R_X86_64_JUMP_SLO 0000000000000000
__libc_start_main@GLIBC_2.2.5 + 0
000000600980 000400000007 R_X86_64_JUMP_SLO 0000000000400460 foo + 0
[hjl@gnu-tools-1 no-plt-3]$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils