[英]How to get the binary code of part of the source code while compiling with LLVM
例如,我有一個名為 test.cpp 的 C++ 文件:
#include <iostream>
int main(){
int a = 0;
int b = 1;
char c = '3';
cout<< a <<endl; // We want to get the binary code from here
cout<< b <<endl; // to here
cout<< c <<endl;
}
當我用 LLVM 編譯它時(我猜應該修改 LLVM),我怎樣才能得到上面注釋所說的二進制代碼?
我是否需要插入額外的標志以將它們與其他標志區分開來?
首先添加using namespace std;
以便您的代碼編譯,然后嘗試
g++ -S <your file here> -o result
。 現在打開結果文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.