Re: [PATCH] tools: Use fputc() calls in some functions

From: Steven Rostedt

Date: Thu Jul 23 2026 - 10:39:06 EST


On Thu, 23 Jul 2026 06:47:00 -0700
Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:

> > The source code was transformed by using the Coccinelle software.
>
> gcc already does this transformation automatically.

Yep, I showed this in my talk[1] that looked at what printf("Hello World!")
does. Doing an objdump of:

#include <stdio.h>

int main(void) {
printf("Hello World!\n");
return 0;
}

has:

0000000000001139 <main>:
1139: 55 push %rbp
113a: 48 89 e5 mov %rsp,%rbp
113d: 48 8d 05 c0 0e 00 00 lea 0xec0(%rip),%rax # 2004 <_IO_stdin_used+0x4>
1144: 48 89 c7 mov %rax,%rdi
1147: e8 e4 fe ff ff call 1030 <puts@plt> <<<--- puts and not printf
114c: b8 00 00 00 00 mov $0x0,%eax
1151: 5d pop %rbp
1152: c3 ret

-- Steve

[1] https://www.youtube.com/watch?v=JRyrhsx-L5Y