How to just output unoptimized assembly code without any extra annotations?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

https://news.ycombinator.com/item?id=10773849

According to the above discussion, I use the following command to get
the unoptimized assembly code. But it still has things like .file,
.text, .globl, .type., .size, .ident, .section. If I delete them, the
resulted assembly code still can be compiled. So they are
nonessential. How to make gcc only generate the essential part of the
assembly code?

$ gcc -O0 -fno-asynchronous-unwind-tables -S -x c -o - - <<< 'int
f(int x1, int x2, int x3, int x4, int x5, int x6) { return 0; }'
  .file  ""
  .text
  .globl  f
  .type  f, @function
f:
  pushq  %rbp
  movq  %rsp, %rbp
  movl  %edi, -4(%rbp)
  movl  %esi, -8(%rbp)
  movl  %edx, -12(%rbp)
  movl  %ecx, -16(%rbp)
  movl  %r8d, -20(%rbp)
  movl  %r9d, -24(%rbp)
  movl  $0, %eax
  popq  %rbp
  ret
  .size  f, .-f
  .ident  "GCC: (Debian 10.2.1-6) 10.2.1 20210110"
  .section  .note.GNU-stack,"",@progbits

-- 
Regards,
Peng



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux