[Bug target/67400] -fno-plt doesn't work with function pointers
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 31 15:31:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67400
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-31
Target Milestone|--- |6.0
Ever confirmed|0 |1
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Another pointer bug:
[hjl@gnu-6 pr18900]$ cat y.c
extern void foo (void);
typedef void (*func_p) (void);
const func_p p1 = &foo;
[hjl@gnu-6 pr18900]$ make y.o
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -B./ -O2 -fno-plt -c -o y.o
y.c
[hjl@gnu-6 pr18900]$ readelf -SW y.o
There are 11 section headers, starting at offset 0x1e8:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX
0 0 1
[ 2] .data PROGBITS 0000000000000000 000040 000000 00 WA
0 0 1
[ 3] .bss NOBITS 0000000000000000 000040 000000 00 WA
0 0 1
[ 4] .rodata PROGBITS 0000000000000000 000040 000008 00 A
0 0 8
[ 5] .rela.rodata RELA 0000000000000000 000178 000018 18 I
9 4 8
[ 6] .comment PROGBITS 0000000000000000 000048 00002a 01 MS
0 0 1
[ 7] .note.GNU-stack PROGBITS 0000000000000000 000072 000000 00
0 0 1
[ 8] .shstrtab STRTAB 0000000000000000 000190 000052 00
0 0 1
[ 9] .symtab SYMTAB 0000000000000000 000078 0000f0 18
10 8 8
[10] .strtab STRTAB 0000000000000000 000168 00000c 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
[hjl@gnu-6 pr18900]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -B./ -O2 -fno-plt -c -o y.o
y.c -fpie
[hjl@gnu-6 pr18900]$ readelf -SW y.o
There are 11 section headers, starting at offset 0x1e8:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX
0 0 1
[ 2] .data PROGBITS 0000000000000000 000040 000000 00 WA
0 0 1
[ 3] .bss NOBITS 0000000000000000 000040 000000 00 WA
0 0 1
[ 4] .data.rel.ro PROGBITS 0000000000000000 000040 000008 00 WA
0 0 8
[ 5] .rela.data.rel.ro RELA 0000000000000000 000178 000018 18 I
9 4 8
[ 6] .comment PROGBITS 0000000000000000 000048 00002a 01 MS
0 0 1
[ 7] .note.GNU-stack PROGBITS 0000000000000000 000072 000000 00
0 0 1
[ 8] .shstrtab STRTAB 0000000000000000 000190 000057 00
0 0 1
[ 9] .symtab SYMTAB 0000000000000000 000078 0000f0 18
10 8 8
[10] .strtab STRTAB 0000000000000000 000168 00000c 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
[hjl@gnu-6 pr18900]$
-fno-plt should use .data.rel.ro section, not .rodata section for
function pointer.
More information about the Gcc-bugs
mailing list