This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-fpatchable-function-entry: leverage multi-byte NOP on x86
- From: Fangrui Song <i at maskray dot me>
- To: gcc at gcc dot gnu dot org
- Cc: Jan Hubicka <hubicka at ucw dot cz>
- Date: Sat, 4 Jan 2020 12:48:43 -0800
- Subject: -fpatchable-function-entry: leverage multi-byte NOP on x86
-fpatchable-function-entry is used by Linux kernel arm64/parisc. The
feature works for x86, but does not leverage multi-byte NOP.
% cat a.c
int foo() { return 0; }
% gcc -fpatchable-function-entry=5,0 -c a.c
% objdump -d a.o
...
0000000000000000 <foo>:
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 55 push %rbp
6: 48 89 e5 mov %rsp,%rbp
9: b8 00 00 00 00 mov $0x0,%eax
e: 5d pop %rbp
f: c3 retq
(I am not sure who should be notified. I CCed x86-64-port maintainer
(Jan Hubicka <hubicka@ucw.cz>), as listed on gcc/MAINTAINERS.)