23
14

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 5 years have passed since last update.

Mac (OS X) 環境に binutils を入れる

Posted at

何がしたかったか

Mac (OS X) 環境に、Linux のバイナリ解析用コマンド群 (binutils) を入れたい。
ELFファイルの解析・逆アセンブルをしたい。

  • objdump
  • readelf

このあたりが使いたかったんです。
bunutilの詳細はこちら

環境

  • homebrew が install されていること

検証環境

macOS Mojave version 10.14.3

手順

  1. bunutil の intall

    $ brew update && brew install binutils
    
  2. path の設定 (bashの場合)

    $ echo 'export PATH="/usr/local/opt/binutils/bin:$PATH"' >> ~/.bash_profile
    
  3. terminal の再起動 or source ~/.bash_profile

この手順で私の環境では動作しました。
1 の手順だけだと、PATHが通っておらず、

$ greadelf --version
-bash: greadelf: command not found

など、binutilの中のコマンドを使おうとすると Not found になってしまっていました。

使ってみる

mac版 binutils のコマンド群は、binutils の頭に g が付きます。
ELFファイルの中身の概要が知りたい場合

$ greadelf -l {target_file}

逆アセンブル結果が出力したい場合

$ gobjdump -d {target_file}
23
14
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
23
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?