标题:.cfi_startproc作用是什么
只看楼主
PopToPush
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2020-11-14
 问题点数:0 回复次数:1 
.cfi_startproc作用是什么
void *fxcg_memset(void *dest, int c, unsigned int n) {
    char* d = (char*)dest;
    while (n-- > 0) { *d++ = (char)c; }

    return dest;
}
下面是gcc生成的汇编代码:
__Z11fxcg_memsetPvij:                                                                                                                                           .LFB0:                                                                                                                                                                  .cfi_startproc                                                                                                                                                  tst     r6,r6                                                                                                                                                   bt      .L6                                                                                                                                                     sts.l   pr,@-r15                                                                                                                                                .cfi_def_cfa_offset 4                                                                                                                                           .cfi_offset 17, -4                                                                                                                                              mov.l   .L10,r0                                                                                                                                                 jsr     @r0                                                                                                                                                     exts.b  r5,r5                                                                                                                                                   lds.l   @r15+,pr                                                                                                                                                .cfi_restore 17                                                                                                                                                 .cfi_def_cfa_offset 0                                                                                                                                           rts                                                                                                                                                             nop                                                                                                                                                             .align 1                                                                                                                                                .L6:                                                                                                                                                                    rts                                                                                                                                                             mov     r4,r0                                                                                                                                           .L11:                                                                                                                                                                   .align 2                                                                                                                                                .L10:                                                                                                                                                                   .long   _memset                                                                                                                                                 .cfi_endproc                                                                                                                                            .LFE0:                                                                                                                                                                  .size   __Z11fxcg_memsetPvij, .-__Z11fxcg_memsetPvij                                                                                                            .section        .text.startup.main,"ax",@progbits                                                                                                               .align 1                                                                                                                                                        .align 2                                                                                                                                                        .global _main                                                                                                                                                   .type   _main, @function

对于汇编我并不熟悉,as汇编也缺乏资料。比如.cfi_startproc .cfi_endproc作用是什么?它们总是用在函数里
搜索更多相关主题的帖子: 汇编 align void mov char 
2020-11-14 18:54
PopToPush
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2020-11-14
得分:0 
__Z11fxcg_memsetPvij:                                                                                                                                           .LFB0:                                                                                                                                                                  .cfi_startproc                                                                                                                                                  tst     r6,r6                                                                                                                                                   bt      .L6                                                                                                                                                     sts.l   pr,@-r15                                                                                                                                                .cfi_def_cfa_offset 4                                                                                                                                           .cfi_offset 17, -4                                                                                                                                              mov.l   .L10,r0                                                                                                                                                 jsr     @r0                                                                                                                                                     exts.b  r5,r5                                                                                                                                                   lds.l   @r15+,pr                                                                                                                                                .cfi_restore 17                                                                                                                                                 .cfi_def_cfa_offset 0                                                                                                                                           rts                                                                                                                                                             nop                                                                                                                                                             .align 1                                                                                                                                                .L6:                                                                                                                                                                    rts                                                                                                                                                             mov     r4,r0                                                                                                                                           .L11:                                                                                                                                                                   .align 2                                                                                                                                                .L10:                                                                                                                                                                   .long   _memset                                                                                                                                                 .cfi_endproc                                                                                                                                            .LFE0:                                                                                                                                                                  .size   __Z11fxcg_memsetPvij, .-__Z11fxcg_memsetPvij                                                                                                            .section        .text.startup.main,"ax",@progbits                                                                                                               .align 1                                                                                                                                                        .align 2                                                                                                                                                        .global _main                                                                                                                                                   .type   _main, @function     
2020-11-14 19:02
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
.cfi_startproc is used at the beginning of each function that should have an entry in .eh_frame. It initializes some internal data structures. Don’t forget to close the function by .cfi_endproc.
2021-08-10 10:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-503894-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.241724 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved