本文内容无意间搜到,正好之前也有这个困惑,所以转来做个备份:
引入问题;
我写了一个简单的汇编语言例程,text.s
section .text
.globl _start
_start:
movq $1, %rax
movq $0, %rbx
int $0x80
用下面的ld脚本test.lds进行链接
SECTIONS
{
. = 0x10;
label_1 = .;
custom_section : {
. = 0x20;
label_2 = . ;
label_3 = ABSOLUTE(.) ;
*(.text) ;
}
}
链接命令为:
as test.c...
location counter阅读全文