linux 终端gcc运行asm,如何编译GCC生成的asm?

I'm playing around with some asm code, and something is bothering me.

I compile this:

#include

int main(int argc, char** argv){

printf("Hello World\n");

return 0;

}

with gcc file.c -S -o file.S this generates a nice little piece of asm code:

.cstring

LC0:

.ascii "Hello World\0"

.text

.globl _main

_main:

LFB3:

pushq %rbp

LCFI0:

movq %rsp, %rbp

LCFI1:

subq $16, %rsp

LCFI2:

movl %edi, -4(%rbp)

movq %rsi, -16(%rbp)

leaq LC0(%rip), %rdi

call _puts

movl $0, %eax

leave

ret

LFE3:

.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support

EH_frame1:

.set L$set$0,LECIE1-LSCIE1

.long L$set$0

LSCIE1:

.long 0x0

.byte 0x1

.ascii "zR\0"

.byte 0x1

.byte 0x78

.byte 0x10

.byte 0x1

.byte 0x10

.byte 0xc

.byte 0x7

.byte 0x8

.byte 0x90

.byte 0x1

.align 3

LECIE1:

.globl _main.eh

_main.eh:

LSFDE1:

.set L$set$1,LEFDE1-LASFDE1

.long L$set$1

LASFDE1:

.long LASFDE1-EH_frame1

.quad LFB3-.

.set L$set$2,LFE3-LFB3

.quad L$set$2

.byte 0x0

.byte 0x4

.set L$set$3,LCFI0-LFB3

.long L$set$3

.byte 0xe

.byte 0x10

.byte 0x86

.byte 0x2

.byte 0x4

.set L$set$4,LCFI1-LCFI0

.long L$set$4

.byte 0xd

.byte 0x6

.align 3

LEFDE1:

.subsections_via_symbols

My next problem is really, how do I compile this output, and can I make GCC do it for me?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值