リスト30 リスト31


〔リスト30〕アセンブラ中で名前を変更した例のCソース(test101.c)
#include <stdio.h>
int hensu[10] asm ("hensu_asm");
int tbl[10];
extern int  kansu () asm ("asm_kansu");
	
int main(void)
{
    hensu[0]    =   1;
    tbl[0]      =   kansu();
    return 0;
}
int kansu (void)
{
    return  0;
}


〔リスト31〕アセンブラ中で名前を変更した例のCソースから生成したアセンブラ(test101.s)
    .file       "test101.c"
    .version    "01.01"
gcc2_compiled.:
.text
    .align  4
.globl  main
    .type   main,@function
main:
    pushl   %ebp
    movl    %esp,%ebp
    subl    $8,%esp
    movl    $1,hensu_asm
    call    asm_kansu
    movl    %eax,%eax
    movl    %eax,tbl
    xorl    %eax,%eax
    jmp .L2
    .p2align    4,,7
.L2:
    movl    %ebp,%esp
    popl    %ebp
    ret
.Lfe1:
    .size   main,.Lfe1-main
    .align  4
.globl  asm_kansu
    .type   asm_kansu,@function
asm_kansu:
    pushl   %ebp
    movl    %esp,%ebp
    xorl    %eax,%eax
    jmp .L3
    .p2align    4,,7
.L3:
    movl    %ebp,%esp
    popl    %ebp
    ret
.Lfe2:
    .size   asm_kansu,.Lfe2-asm_kansu
    .comm   hensu_asm,40,32
    .comm   tbl,40,32
    .ident  "GCC: (GNU) 2.95.3 20010315 (release)"