[Bug target/67400] New: -fno-plt doesn't work with function pointers
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Aug 30 15:05:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67400
Bug ID: 67400
Summary: -fno-plt doesn't work with function pointers
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
[hjl@gnu-mic-2 gcc]$ cat /tmp/foo.c
extern void abort (void);
int
main (void)
{
return &abort;
}
[hjl@gnu-mic-2 gcc]$ ./xgcc -B./ -fno-plt -fno-pic -O2 /tmp/foo.c
/tmp/foo.c: In function \u2018main\u2019:
/tmp/foo.c:6:10: warning: return makes integer from pointer without a cast
[-Wint-conversion]
return &abort;
^
[hjl@gnu-mic-2 gcc]$ readelf -r a.out
Relocation section '.rela.dyn' at offset 0x330 contains 1 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000600880 000300000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ +
0
Relocation section '.rela.plt' at offset 0x348 contains 2 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
0000006008a0 000100000007 R_X86_64_JUMP_SLO 00000000004003b0 abort@GLIBC_2.2.5
+ 0
0000006008a8 000200000007 R_X86_64_JUMP_SLO 0000000000000000
__libc_start_main@GLIBC_2.2.5 + 0
[hjl@gnu-mic-2 gcc]$
More information about the Gcc-bugs
mailing list