11
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Qiita株式会社Advent Calendar 2022

Day 7

Rustでアセンブリを出力したい

Last updated at Posted at 2022-12-19

この記事は Qiita株式会社のカレンダー | Advent Calendar 2022 - Qiita の7日目の記事です。

これはなに

以下の記事を読んで、Rustをビルドしたときのアセンブリを見てみたいと思い、アセンブリを出力する方法を調べたので書く。

結論

$ rustc --emit asm main.rs

Intel syntaxで出力したい場合は、

$ rustc --emit asm -C 'llvm-args=-x86-asm-syntax=intel' main.rs

アセンブリが出力されたことを確認。

$ head main.s
        .text
        .intel_syntax noprefix
        .file   "main.89363361-cgu.0"
        .section        .text._ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hbac26043a2d15d39E,"ax",@progbits
        .p2align        4, 0x90
        .type   _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hbac26043a2d15d39E,@function
_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hbac26043a2d15d39E:
        .cfi_startproc
        sub     rsp, 24
        .cfi_def_cfa_offset 32

Ref

11
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?