Gnu Assembler (GAS) 中的 CFI 指令用于什么? [英] What are CFI directives in Gnu Assembler (GAS) used for?

查看:39
本文介绍了Gnu Assembler (GAS) 中的 CFI 指令用于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎每一行后面都有一个 .CFI 指令,而且这些指令也有很多种,例如,.cfi_startproc.cfi_endproc 等等.更多信息.

There seem to be a .CFI directive after every line and also there are wide varities of these ex.,.cfi_startproc , .cfi_endproc etc.. more here.

    .file   "temp.c"
    .text
.globl main
    .type   main, @function
main:
.LFB0:
    .cfi_startproc
    pushq   %rbp
    .cfi_def_cfa_offset 16
    movq    %rsp, %rbp
    .cfi_offset 6, -16
    .cfi_def_cfa_register 6
    movl    $0, %eax
    leave
    ret
    .cfi_endproc
.LFE0:
    .size   main, .-main
.globl func
    .type   func, @function
func:
.LFB1:
    .cfi_startproc
    pushq   %rbp
    .cfi_def_cfa_offset 16
    movq    %rsp, %rbp
    .cfi_offset 6, -16
    .cfi_def_cfa_register 6
    movl    %edi, -4(%rbp)
    movl    %esi, %eax
    movb    %al, -8(%rbp)
    leave
    ret
    .cfi_endproc
.LFE1:
    .size   func, .-func
    .ident  "GCC: (Ubuntu 4.4.1-4ubuntu9) 4.4.1"
    .section    .note.GNU-stack,"",@progbits

我没有明白这些的目的.

I didn't get the purpose of these.

推荐答案

我有一种感觉,它代表 Call Frame Information 是管理调用帧的 GNU AS 扩展.来自 DeveloperWorks:

I've got a feeling it stands for Call Frame Information and is a GNU AS extension to manage call frames. From DeveloperWorks:

在某些架构上,例外必须使用 Call 管理处理帧信息指令.这些指令在程序集中用于直接异常处理.这些指令在 Linux 上可用POWER,如果出于任何原因(便携性的代码库,例如),GCC 生成的异常处理信息不充分.

On some architectures, exception handling must be managed with Call Frame Information directives. These directives are used in the assembly to direct exception handling. These directives are available on Linux on POWER, if, for any reason (portability of the code base, for example), the GCC generated exception handling information is not sufficient.

看起来这些是在某些平台上根据异常处理的需要生成的.

It looks like these are generated on some platforms depending on need for exception handling.

如果您想禁用这些,请参阅大卫的回答.

If you are looking to disable these, please see David's answer.

这篇关于Gnu Assembler (GAS) 中的 CFI 指令用于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆