binutils usage

xxd

vim %! xxd

install

Ubuntu

1
apt install binutils

file main

objdump

inspect full assembly

1
objdump -D <.o> |less
1
objdump -S <.o> |less

对源代码和汇编一一对应,要加 -g 选项

readelf

readelf -h hello.o 看 elf header

readelf -SW hello.o 看 section header table( W 加变宽,好看一点)

readelf -lW main


qemu-riscv64 -L /usr/riscv64-linux-gnu ./main

qemu-riscv64 -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib ./main

Author

Helianthus

Posted on

2024-06-06

Updated on

2024-07-01

Licensed under