X86程序集:.text.startup节和.text节有什么区别

时间:2020-09-09 07:59:47

标签: assembly gcc x86 gnu-assembler sections

    .file   "test-instr.c"
    .text
.Ltext0:
    .section    .rodata.str1.1,"aMS",@progbits,1
.LC0:
    .string "Hum?"
.LC1:
    .string "Looks like a zero to me!"
.LC2:
    .string "A non-zero value? How quaint!"
    .section    .text.startup,"ax",@progbits
    .p2align 4,,15
    .globl  main
    .type   main, @function
main:
/* --- trampoline malloc shm space begin --- */ 

.align 4 

.section .data 
shmSize: .quad 8 * 4 * 0x10000 
.global shmptr
shmptr: .quad 0
.section .text
.extern malloc 
movq (shmSize), %rdi 
call malloc 
movq %rax, (shmptr) 
/* --- trampoline malloc shm spacd end --- */ 
 
.LFB52:
    .file 1 "test-instr.c"
    .loc 1 21 0
    .cfi_startproc
.LVL0:
    subq    $24, %rsp
    .cfi_def_cfa_offset 32
.LBB10:
.LBB11:
    .file 2 "/usr/include/x86_64-linux-gnu/bits/unistd.h"
    .loc 2 44 0
    xorl    %edi, %edi
.LVL1:
    movl    $8, %edx
    movq    %rsp, %rsi
.LVL2:

   movq %rax, %rbx
.LBE11:
.LBE10:
    .loc 1 21 0
    movq    %fs:40, %rax
    movq    %rax, 8(%rsp)
    xorl    %eax, %eax
.LVL3:
.LBB13:
.LBB12:
    .loc 2 44 0
    call    read@PLT
.LVL4:
.LBE12:
.LBE13:
    .loc 1 25 0
    testq   %rax, %rax
    jle .L8
    .loc 1 30 0
    cmpb    $48, (%rsp)
    je  .L9
.LVL5:
.LBB14:
.LBB15:
    .file 3 "/usr/include/x86_64-linux-gnu/bits/stdio2.h"
    .loc 3 104 0
    leaq    .LC2(%rip), %rdi
    call    puts@PLT
.LVL6:
.L4:
.LBE15:
.LBE14:
    .loc 1 35 0
    xorl    %edi, %edi
    call    exit@PLT
.LVL7:
.L9:
.LBB16:
.LBB17:
    .loc 3 104 0
    leaq    .LC1(%rip), %rdi
    call    puts@PLT
.LVL8:
    jmp .L4
.LVL9:
.L8:
.LBE17:
.LBE16:
.LBB18:
.LBB19:
    leaq    .LC0(%rip), %rdi
    call    puts@PLT
.LVL10:
.LBE19:
.LBE18:
    .loc 1 27 0
    movl    $1, %edi
    call    exit@PLT
.LVL11:
    .cfi_endproc
.LFE52:
    .size   main, .-main
    .text
.Letext0:
    .file 4 "/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h"
    .file 5 "/usr/include/x86_64-linux-gnu/bits/types.h"
    .file 6 "/usr/include/x86_64-linux-gnu/bits/libio.h"
    .file 7 "/usr/include/stdio.h"
    .file 8 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h"
    .file 9 "/usr/include/unistd.h"
    .file 10 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h"
    .file 11 "<built-in>"
    .file 12 "/usr/include/stdlib.h"
    .section    .debug_info,"",@progbits
.Ldebug_info0:
    .long   0x5bc
    .value  0x4
    .long   .Ldebug_abbrev0
    .byte   0x8
    .uleb128 0x1
    .long   .LASF73
    .byte   0xc
    .long   .LASF74
    .long   .LASF75
    .long   .Ldebug_ranges0+0x30
    .quad   0
    .long   .Ldebug_line0
    .uleb128 0x2
    .long   .LASF7
    .byte   0x4
    .byte   0xd8
    .long   0x34
    .uleb128 0x3
    .byte   0x8
    .byte   0x7
    .long   .LASF0
    .uleb128 0x3
    .byte   0x1
    .byte   0x8
    .long   .LASF1
    .uleb128 0x3
    .byte   0x2
    .byte   0x7
    .long   .LASF2
    .uleb128 0x3
    .byte   0x4
    .byte   0x7
    .long   .LASF3
    .uleb128 0x3
    .byte   0x1
    .byte   0x6
    .long   .LASF4
    .uleb128 0x3
    .byte   0x2
    .byte   0x5
    .long   .LASF5
    .uleb128 0x4
    .byte   0x4
    .byte   0x5
    .string "int"
    .uleb128 0x3
    .byte   0x8
    .byte   0x5
    .long   .LASF6
    .uleb128 0x2
    .long   .LASF8
    .byte   0x5
    .byte   0x8c
    .long   0x65
    .uleb128 0x2
    .long   .LASF9
    .byte   0x5
    .byte   0x8d
    .long   0x65
    .uleb128 0x5
    .byte   0x8
    .uleb128 0x2
    .long   .LASF10
    .byte   0x5
    .byte   0xb5
    .long   0x65
    .uleb128 0x6
    .byte   0x8
    .long   0x95
    .uleb128 0x3
    .byte   0x1
    .byte   0x6
    .long   .LASF11
    .uleb128 0x7
    .long   0x95
    .uleb128 0x8
    .long   .LASF41
    .byte   0xd8
    .byte   0x6
    .byte   0xf5
    .long   0x221
    .uleb128 0x9
    .long   .LASF12
    .byte   0x6
    .byte   0xf6
    .long   0x5e
    .byte   0
    .uleb128 0x9
    .long   .LASF13
    .byte   0x6
    .byte   0xfb
    .long   0x8f
    .byte   0x8
    .uleb128 0x9
    .long   .LASF14
    .byte   0x6
    .byte   0xfc
    .long   0x8f
    .byte   0x10
    .uleb128 0x9
    .long   .LASF15
    .byte   0x6
    .byte   0xfd
    .long   0x8f
    .byte   0x18
    .uleb128 0x9
    .long   .LASF16
    .byte   0x6
    .byte   0xfe
    .long   0x8f
    .byte   0x20
    .uleb128 0x9
    .long   .LASF17
    .byte   0x6
    .byte   0xff
    .long   0x8f
    .byte   0x28
    .uleb128 0xa
    .long   .LASF18
    .byte   0x6
    .value  0x100
    .long   0x8f
    .byte   0x30
    .uleb128 0xa
    .long   .LASF19
    .byte   0x6
    .value  0x101
    .long   0x8f
    .byte   0x38
    .uleb128 0xa
    .long   .LASF20
    .byte   0x6
    .value  0x102
    .long   0x8f
    .byte   0x40
    .uleb128 0xa
    .long   .LASF21
    .byte   0x6
    .value  0x104
    .long   0x8f
    .byte   0x48
    .uleb128 0xa
    .long   .LASF22
    .byte   0x6
    .value  0x105
    .long   0x8f
    .byte   0x50
    .uleb128 0xa
    .long   .LASF23
    .byte   0x6
    .value  0x106
    .long   0x8f
    .byte   0x58
    .uleb128 0xa
    .long   .LASF24
    .byte   0x6
    .value  0x108
    .long   0x259
    .byte   0x60
    .uleb128 0xa
    .long   .LASF25
    .byte   0x6
    .value  0x10a
    .long   0x25f
    .byte   0x68
    .uleb128 0xa
    .long   .LASF26
    .byte   0x6
    .value  0x10c
    .long   0x5e
    .byte   0x70
    .uleb128 0xa
    .long   .LASF27
    .byte   0x6
    .value  0x110
    .long   0x5e
    .byte   0x74
    .uleb128 0xa
    .long   .LASF28
    .byte   0x6
    .value  0x112
    .long   0x6c
    .byte   0x78
    .uleb128 0xa
    .long   .LASF29
    .byte   0x6
    .value  0x116
    .long   0x42
    .byte   0x80
    .uleb128 0xa
    .long   .LASF30
    .byte   0x6
    .value  0x117
    .long   0x50
    .byte   0x82
    .uleb128 0xa
    .long   .LASF31
    .byte   0x6
    .value  0x118
    .long   0x265
    .byte   0x83
    .uleb128 0xa
    .long   .LASF32
    .byte   0x6
    .value  0x11c
    .long   0x275
    .byte   0x88
    .uleb128 0xa
    .long   .LASF33
    .byte   0x6
    .value  0x125
    .long   0x77
    .byte   0x90
    .uleb128 0xa
    .long   .LASF34
    .byte   0x6
    .value  0x12d
    .long   0x82
    .byte   0x98
    .uleb128 0xa
    .long   .LASF35
    .byte   0x6
    .value  0x12e
    .long   0x82
    .byte   0xa0
    .uleb128 0xa
    .long   .LASF36
    .byte   0x6
    .value  0x12f
    .long   0x82
    .byte   0xa8
    .uleb128 0xa
    .long   .LASF37
    .byte   0x6
    .value  0x130
    .long   0x82
    .byte   0xb0
    .uleb128 0xa
    .long   .LASF38
    .byte   0x6
    .value  0x132
    .long   0x29
    .byte   0xb8
    .uleb128 0xa
    .long   .LASF39
    .byte   0x6
    .value  0x133
    .long   0x5e
    .byte   0xc0
    .uleb128 0xa
    .long   .LASF40
    .byte   0x6
    .value  0x135
    .long   0x27b
    .byte   0xc4
    .byte   0
    .uleb128 0xb
    .long   .LASF76
    .byte   0x6
    .byte   0x9a
    .uleb128 0x8
    .long   .LASF42
    .byte   0x18
    .byte   0x6
    .byte   0xa0
    .long   0x259
    .uleb128 0x9
    .long   .LASF43
    .byte   0x6
    .byte   0xa1
    .long   0x259
    .byte   0
    .uleb128 0x9
    .long   .LASF44
    .byte   0x6
    .byte   0xa2
    .long   0x25f
    .byte   0x8
    .uleb128 0x9
    .long   .LASF45
    .byte   0x6
    .byte   0xa6
    .long   0x5e
    .byte   0x10
    .byte   0
    .uleb128 0x6
    .byte   0x8
    .long   0x228
    .uleb128 0x6
    .byte   0x8
    .long   0xa1
    .uleb128 0xc
    .long   0x95
    .long   0x275
    .uleb128 0xd
    .long   0x34
    .byte   0
    .byte   0
    .uleb128 0x6
    .byte   0x8
    .long   0x221
    .uleb128 0xc
    .long   0x95
    .long   0x28b
    .uleb128 0xd
    .long   0x34
    .byte   0x13
    .byte   0
    .uleb128 0xe
    .long   .LASF77
    .uleb128 0xf
    .long   .LASF46
    .byte   0x6
    .value  0x13f
    .long   0x28b
    .uleb128 0xf
    .long   .LASF47
    .byte   0x6
    .value  0x140
    .long   0x28b
    .uleb128 0xf
    .long   .LASF48
    .byte   0x6
    .value  0x141
    .long   0x28b
    .uleb128 0x6
    .byte   0x8
    .long   0x9c
    .uleb128 0x7
    .long   0x2b4
    .uleb128 0x10
    .long   0x2b4
    .uleb128 0x2
    .long   .LASF49
    .byte   0x7
    .byte   0x47
    .long   0x84
    .uleb128 0x11
    .long   .LASF50
    .byte   0x7
    .byte   0x87
    .long   0x25f
    .uleb128 0x11
    .long   .LASF51
    .byte   0x7
    .byte   0x88
    .long   0x25f
    .uleb128 0x11
    .long   .LASF52
    .byte   0x7
    .byte   0x89
    .long   0x25f
    .uleb128 0x11
    .long   .LASF53
    .byte   0x8
    .byte   0x1a
    .long   0x5e
    .uleb128 0xc
    .long   0x2ba
    .long   0x306
    .uleb128 0x12
    .byte   0
    .uleb128 0x7
    .long   0x2fb
    .uleb128 0x11
    .long   .LASF54
    .byte   0x8
    .byte   0x1b
    .long   0x306
    .uleb128 0x3
    .byte   0x8
    .byte   0x5
    .long   .LASF55
    .uleb128 0x3
    .byte   0x8
    .byte   0x7
    .long   .LASF56
    .uleb128 0xc
    .long   0x95
    .long   0x334
    .uleb128 0xd
    .long   0x34
    .byte   0x7
    .byte   0
    .uleb128 0xf
    .long   .LASF57
    .byte   0x9
    .value  0x222
    .long   0x340
    .uleb128 0x6
    .byte   0x8
    .long   0x8f
    .uleb128 0x11
    .long   .LASF58
    .byte   0xa
    .byte   0x24
    .long   0x8f
    .uleb128 0x11
    .long   .LASF59
    .byte   0xa
    .byte   0x32
    .long   0x5e
    .uleb128 0x11
    .long   .LASF60
    .byte   0xa
    .byte   0x37
    .long   0x5e
    .uleb128 0x11
    .long   .LASF61
    .byte   0xa
    .byte   0x3b
    .long   0x5e
    .uleb128 0x13
    .long   .LASF78
    .byte   0x1
    .byte   0x15
    .long   0x5e
    .quad   .LFB52
    .quad   .LFE52-.LFB52
    .uleb128 0x1
    .byte   0x9c
    .long   0x4fb
    .uleb128 0x14
    .long   .LASF62
    .byte   0x1
    .byte   0x15
    .long   0x5e
    .long   .LLST0
    .uleb128 0x14
    .long   .LASF63
    .byte   0x1
    .byte   0x15
    .long   0x340
    .long   .LLST1
    .uleb128 0x15
    .string "buf"
    .byte   0x1
    .byte   0x17
    .long   0x324
    .uleb128 0x2
    .byte   0x91
    .sleb128 -32
    .uleb128 0x16
    .long   0x4fb
    .quad   .LBB10
    .long   .Ldebug_ranges0+0
    .byte   0x1
    .byte   0x19
    .long   0x410
    .uleb128 0x17
    .long   0x521
    .long   .LLST2
    .uleb128 0x17
    .long   0x516
    .long   .LLST3
    .uleb128 0x17
    .long   0x50b
    .long   .LLST4
    .uleb128 0x18
    .quad   .LVL4
    .long   0x54a
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x55
    .uleb128 0x1
    .byte   0x30
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x54
    .uleb128 0x2
    .byte   0x77
    .sleb128 0
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x51
    .uleb128 0x1
    .byte   0x38
    .byte   0
    .byte   0
    .uleb128 0x1a
    .long   0x52d
    .quad   .LBB14
    .quad   .LBE14-.LBB14
    .byte   0x1
    .byte   0x21
    .long   0x450
    .uleb128 0x17
    .long   0x53d
    .long   .LLST5
    .uleb128 0x18
    .quad   .LVL6
    .long   0x57c
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x55
    .uleb128 0x9
    .byte   0x3
    .quad   .LC2
    .byte   0
    .byte   0
    .uleb128 0x1a
    .long   0x52d
    .quad   .LBB16
    .quad   .LBE16-.LBB16
    .byte   0x1
    .byte   0x1f
    .long   0x490
    .uleb128 0x17
    .long   0x53d
    .long   .LLST6
    .uleb128 0x18
    .quad   .LVL8
    .long   0x57c
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x55
    .uleb128 0x9
    .byte   0x3
    .quad   .LC1
    .byte   0
    .byte   0
    .uleb128 0x1a
    .long   0x52d
    .quad   .LBB18
    .quad   .LBE18-.LBB18
    .byte   0x1
    .byte   0x1a
    .long   0x4d0
    .uleb128 0x17
    .long   0x53d
    .long   .LLST7
    .uleb128 0x18
    .quad   .LVL10
    .long   0x57c
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x55
    .uleb128 0x9
    .byte   0x3
    .quad   .LC0
    .byte   0
    .byte   0
    .uleb128 0x1b
    .quad   .LVL7
    .long   0x5b3
    .long   0x4e7
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x55
    .uleb128 0x1
    .byte   0x30
    .byte   0
    .uleb128 0x18
    .quad   .LVL11
    .long   0x5b3
    .uleb128 0x19
    .uleb128 0x1
    .byte   0x55
    .uleb128 0x1
    .byte   0x31
    .byte   0
    .byte   0
    .uleb128 0x1c
    .long   .LASF67
    .byte   0x2
    .byte   0x22
    .long   0x2c4
    .byte   0x3
    .long   0x52d
    .uleb128 0x1d
    .long   .LASF64
    .byte   0x2
    .byte   0x22
    .long   0x5e
    .uleb128 0x1d
    .long   .LASF65
    .byte   0x2
    .byte   0x22
    .long   0x82
    .uleb128 0x1d
    .long   .LASF66
    .byte   0x2
    .byte   0x22
    .long   0x29
    .byte   0
    .uleb128 0x1c
    .long   .LASF68
    .byte   0x3
    .byte   0x66
    .long   0x5e
    .byte   0x3
    .long   0x54a
    .uleb128 0x1d
    .long   .LASF69
    .byte   0x3
    .byte   0x66
    .long   0x2bf
    .uleb128 0x1e
    .byte   0
    .uleb128 0x1f
    .long   .LASF67
    .long   .LASF71
    .byte   0x2
    .byte   0x19
    .long   .LASF67
    .uleb128 0x20
    .uleb128 0x21
    .byte   0x9e
    .uleb128 0x1f
    .byte   0x41
    .byte   0x20
    .byte   0x6e
    .byte   0x6f
    .byte   0x6e
    .byte   0x2d
    .byte   0x7a
    .byte   0x65
    .byte   0x72
    .byte   0x6f
    .byte   0x20
    .byte   0x76
    .byte   0x61
    .byte   0x6c
    .byte   0x75
    .byte   0x65
    .byte   0x3f
    .byte   0x20
    .byte   0x48
    .byte   0x6f
    .byte   0x77
    .byte   0x20
    .byte   0x71
    .byte   0x75
    .byte   0x61
    .byte   0x69
    .byte   0x6e
    .byte   0x74
    .byte   0x21
    .byte   0xa
    .byte   0
    .uleb128 0x1f
    .long   .LASF70
    .long   .LASF72
    .byte   0xb
    .byte   0
    .long   .LASF70
    .uleb128 0x20
    .uleb128 0x1c
    .byte   0x9e
    .uleb128 0x1a
    .byte   0x4c
    .byte   0x6f
    .byte   0x6f
    .byte   0x6b
    .byte   0x73
    .byte   0x20
    .byte   0x6c
    .byte   0x69
    .byte   0x6b
    .byte   0x65
    .byte   0x20
    .byte   0x61
    .byte   0x20
    .byte   0x7a
    .byte   0x65
    .byte   0x72
    .byte   0x6f
    .byte   0x20
    .byte   0x74
    .byte   0x6f
    .byte   0x20
    .byte   0x6d
    .byte   0x65
    .byte   0x21
    .byte   0xa
    .byte   0
    .uleb128 0x20
    .uleb128 0x8
    .byte   0x9e
    .uleb128 0x6
    .byte   0x48
    .byte   0x75
    .byte   0x6d
    .byte   0x3f
    .byte   0xa
    .byte   0
    .uleb128 0x21
    .long   .LASF79
    .long   .LASF79
    .byte   0xc
    .value  0x266
    .byte   0
    .section    .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
    .uleb128 0x1
    .uleb128 0x11
    .byte   0x1
    .uleb128 0x25
    .uleb128 0xe
    .uleb128 0x13
    .uleb128 0xb
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x1b
    .uleb128 0xe
    .uleb128 0x55
    .uleb128 0x17
    .uleb128 0x11
    .uleb128 0x1
    .uleb128 0x10
    .uleb128 0x17
    .byte   0
    .byte   0
    .uleb128 0x2
    .uleb128 0x16
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x3
    .uleb128 0x24
    .byte   0
    .uleb128 0xb
    .uleb128 0xb
    .uleb128 0x3e
    .uleb128 0xb
    .uleb128 0x3
    .uleb128 0xe
    .byte   0
    .byte   0
    .uleb128 0x4
    .uleb128 0x24
    .byte   0
    .uleb128 0xb
    .uleb128 0xb
    .uleb128 0x3e
    .uleb128 0xb
    .uleb128 0x3
    .uleb128 0x8
    .byte   0
    .byte   0
    .uleb128 0x5
    .uleb128 0xf
    .byte   0
    .uleb128 0xb
    .uleb128 0xb
    .byte   0
    .byte   0
    .uleb128 0x6
    .uleb128 0xf
    .byte   0
    .uleb128 0xb
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x7
    .uleb128 0x26
    .byte   0
    .uleb128 0x49
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x8
    .uleb128 0x13
    .byte   0x1
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0xb
    .uleb128 0xb
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x9
    .uleb128 0xd
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x38
    .uleb128 0xb
    .byte   0
    .byte   0
    .uleb128 0xa
    .uleb128 0xd
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0x5
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x38
    .uleb128 0xb
    .byte   0
    .byte   0
    .uleb128 0xb
    .uleb128 0x16
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .byte   0
    .byte   0
    .uleb128 0xc
    .uleb128 0x1
    .byte   0x1
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0xd
    .uleb128 0x21
    .byte   0
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x2f
    .uleb128 0xb
    .byte   0
    .byte   0
    .uleb128 0xe
    .uleb128 0x13
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3c
    .uleb128 0x19
    .byte   0
    .byte   0
    .uleb128 0xf
    .uleb128 0x34
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0x5
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x3f
    .uleb128 0x19
    .uleb128 0x3c
    .uleb128 0x19
    .byte   0
    .byte   0
    .uleb128 0x10
    .uleb128 0x37
    .byte   0
    .uleb128 0x49
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x11
    .uleb128 0x34
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x3f
    .uleb128 0x19
    .uleb128 0x3c
    .uleb128 0x19
    .byte   0
    .byte   0
    .uleb128 0x12
    .uleb128 0x21
    .byte   0
    .byte   0
    .byte   0
    .uleb128 0x13
    .uleb128 0x2e
    .byte   0x1
    .uleb128 0x3f
    .uleb128 0x19
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x27
    .uleb128 0x19
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x11
    .uleb128 0x1
    .uleb128 0x12
    .uleb128 0x7
    .uleb128 0x40
    .uleb128 0x18
    .uleb128 0x2117
    .uleb128 0x19
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x14
    .uleb128 0x5
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x2
    .uleb128 0x17
    .byte   0
    .byte   0
    .uleb128 0x15
    .uleb128 0x34
    .byte   0
    .uleb128 0x3
    .uleb128 0x8
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x2
    .uleb128 0x18
    .byte   0
    .byte   0
    .uleb128 0x16
    .uleb128 0x1d
    .byte   0x1
    .uleb128 0x31
    .uleb128 0x13
    .uleb128 0x52
    .uleb128 0x1
    .uleb128 0x55
    .uleb128 0x17
    .uleb128 0x58
    .uleb128 0xb
    .uleb128 0x59
    .uleb128 0xb
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x17
    .uleb128 0x5
    .byte   0
    .uleb128 0x31
    .uleb128 0x13
    .uleb128 0x2
    .uleb128 0x17
    .byte   0
    .byte   0
    .uleb128 0x18
    .uleb128 0x4109
    .byte   0x1
    .uleb128 0x11
    .uleb128 0x1
    .uleb128 0x31
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x19
    .uleb128 0x410a
    .byte   0
    .uleb128 0x2
    .uleb128 0x18
    .uleb128 0x2111
    .uleb128 0x18
    .byte   0
    .byte   0
    .uleb128 0x1a
    .uleb128 0x1d
    .byte   0x1
    .uleb128 0x31
    .uleb128 0x13
    .uleb128 0x11
    .uleb128 0x1
    .uleb128 0x12
    .uleb128 0x7
    .uleb128 0x58
    .uleb128 0xb
    .uleb128 0x59
    .uleb128 0xb
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x1b
    .uleb128 0x4109
    .byte   0x1
    .uleb128 0x11
    .uleb128 0x1
    .uleb128 0x31
    .uleb128 0x13
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x1c
    .uleb128 0x2e
    .byte   0x1
    .uleb128 0x3f
    .uleb128 0x19
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x27
    .uleb128 0x19
    .uleb128 0x49
    .uleb128 0x13
    .uleb128 0x20
    .uleb128 0xb
    .uleb128 0x34
    .uleb128 0x19
    .uleb128 0x1
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x1d
    .uleb128 0x5
    .byte   0
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x49
    .uleb128 0x13
    .byte   0
    .byte   0
    .uleb128 0x1e
    .uleb128 0x18
    .byte   0
    .byte   0
    .byte   0
    .uleb128 0x1f
    .uleb128 0x2e
    .byte   0
    .uleb128 0x3f
    .uleb128 0x19
    .uleb128 0x3c
    .uleb128 0x19
    .uleb128 0x6e
    .uleb128 0xe
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0xb
    .uleb128 0x6e
    .uleb128 0xe
    .byte   0
    .byte   0
    .uleb128 0x20
    .uleb128 0x36
    .byte   0
    .uleb128 0x2
    .uleb128 0x18
    .byte   0
    .byte   0
    .uleb128 0x21
    .uleb128 0x2e
    .byte   0
    .uleb128 0x3f
    .uleb128 0x19
    .uleb128 0x3c
    .uleb128 0x19
    .uleb128 0x6e
    .uleb128 0xe
    .uleb128 0x3
    .uleb128 0xe
    .uleb128 0x3a
    .uleb128 0xb
    .uleb128 0x3b
    .uleb128 0x5
    .byte   0
    .byte   0
    .byte   0
    .section    .debug_loc,"",@progbits
.Ldebug_loc0:
.LLST0:
    .quad   .LVL0
    .quad   .LVL1
    .value  0x1
    .byte   0x55
    .quad   .LVL1
    .quad   .LFE52
    .value  0x4
    .byte   0xf3
    .uleb128 0x1
    .byte   0x55
    .byte   0x9f
    .quad   0
    .quad   0
.LLST1:
    .quad   .LVL0
    .quad   .LVL2
    .value  0x1
    .byte   0x54
    .quad   .LVL2
    .quad   .LFE52
    .value  0x4
    .byte   0xf3
    .uleb128 0x1
    .byte   0x54
    .byte   0x9f
    .quad   0
    .quad   0
.LLST2:
    .quad   .LVL3
    .quad   .LVL4
    .value  0x2
    .byte   0x38
    .byte   0x9f
    .quad   0
    .quad   0
.LLST3:
    .quad   .LVL3
    .quad   .LVL4-1
    .value  0x1
    .byte   0x54
    .quad   .LVL4-1
    .quad   .LVL4
    .value  0x1
    .byte   0x57
    .quad   0
    .quad   0
.LLST4:
    .quad   .LVL3
    .quad   .LVL4
    .value  0x2
    .byte   0x30
    .byte   0x9f
    .quad   0
    .quad   0
.LLST5:
    .quad   .LVL5
    .quad   .LVL6
    .value  0x6
    .byte   0xf2
    .long   .Ldebug_info0+1369
    .sleb128 0
    .quad   0
    .quad   0
.LLST6:
    .quad   .LVL7
    .quad   .LVL9
    .value  0x6
    .byte   0xf2
    .long   .Ldebug_info0+1419
    .sleb128 0
    .quad   0
    .quad   0
.LLST7:
    .quad   .LVL9
    .quad   .LVL10
    .value  0x6
    .byte   0xf2
    .long   .Ldebug_info0+1449
    .sleb128 0
    .quad   0
    .quad   0
    .section    .debug_aranges,"",@progbits
    .long   0x2c
    .value  0x2
    .long   .Ldebug_info0
    .byte   0x8
    .byte   0
    .value  0
    .value  0
    .quad   .LFB52
    .quad   .LFE52-.LFB52
    .quad   0
    .quad   0
    .section    .debug_ranges,"",@progbits
.Ldebug_ranges0:
    .quad   .LBB10
    .quad   .LBE10
    .quad   .LBB13
    .quad   .LBE13
    .quad   0
    .quad   0
    .quad   .LFB52
    .quad   .LFE52
    .quad   0
    .quad   0
    .section    .debug_line,"",@progbits
.Ldebug_line0:
    .section    .debug_str,"MS",@progbits,1
.LASF59:
    .string "optind"
.LASF58:
    .string "optarg"
.LASF72:
    .string "__builtin_puts"
.LASF41:
    .string "_IO_FILE"
.LASF53:
    .string "sys_nerr"
.LASF23:
    .string "_IO_save_end"
.LASF5:
    .string "short int"
.LASF7:
    .string "size_t"
.LASF33:
    .string "_offset"
.LASF64:
    .string "__fd"
.LASF17:
    .string "_IO_write_ptr"
.LASF12:
    .string "_flags"
.LASF47:
    .string "_IO_2_1_stdout_"
.LASF49:
    .string "ssize_t"
.LASF57:
    .string "__environ"
.LASF24:
    .string "_markers"
.LASF14:
    .string "_IO_read_end"
.LASF65:
    .string "__buf"
.LASF52:
    .string "stderr"
.LASF55:
    .string "long long int"
.LASF10:
    .string "__ssize_t"
.LASF32:
    .string "_lock"
.LASF73:
    .string "GNU C11 7.5.0 -mtune=generic -march=x86-64 -g -g -g -O0 -O3 -funroll-loops -fstack-protector-strong"
.LASF6:
    .string "long int"
.LASF68:
    .string "printf"
.LASF29:
    .string "_cur_column"
.LASF48:
    .string "_IO_2_1_stderr_"
.LASF77:
    .string "_IO_FILE_plus"
.LASF45:
    .string "_pos"
.LASF63:
    .string "argv"
.LASF79:
    .string "exit"
.LASF44:
    .string "_sbuf"
.LASF28:
    .string "_old_offset"
.LASF1:
    .string "unsigned char"
.LASF62:
    .string "argc"
.LASF67:
    .string "read"
.LASF4:
    .string "signed char"
.LASF56:
    .string "long long unsigned int"
.LASF46:
    .string "_IO_2_1_stdin_"
.LASF3:
    .string "unsigned int"
.LASF42:
    .string "_IO_marker"
.LASF31:
    .string "_shortbuf"
.LASF70:
    .string "puts"
.LASF16:
    .string "_IO_write_base"
.LASF40:
    .string "_unused2"
.LASF60:
    .string "opterr"
.LASF20:
    .string "_IO_buf_end"
.LASF11:
    .string "char"
.LASF78:
    .string "main"
.LASF43:
    .string "_next"
.LASF34:
    .string "__pad1"
.LASF35:
    .string "__pad2"
.LASF36:
    .string "__pad3"
.LASF37:
    .string "__pad4"
.LASF38:
    .string "__pad5"
.LASF2:
    .string "short unsigned int"
.LASF69:
    .string "__fmt"
.LASF0:
    .string "long unsigned int"
.LASF18:
    .string "_IO_write_end"
.LASF9:
    .string "__off64_t"
.LASF26:
    .string "_fileno"
.LASF66:
    .string "__nbytes"
.LASF25:
    .string "_chain"
.LASF8:
    .string "__off_t"
.LASF75:
    .string "/home/syacer/Desktop/afl-2.52b"
.LASF22:
    .string "_IO_backup_base"
.LASF50:
    .string "stdin"
.LASF19:
    .string "_IO_buf_base"
.LASF27:
    .string "_flags2"
.LASF39:
    .string "_mode"
.LASF15:
    .string "_IO_read_base"
.LASF30:
    .string "_vtable_offset"
.LASF74:
    .string "test-instr.c"
.LASF21:
    .string "_IO_save_base"
.LASF54:
    .string "sys_errlist"
.LASF61:
    .string "optopt"
.LASF71:
    .string "__read_alias"
.LASF13:
    .string "_IO_read_ptr"
.LASF51:
    .string "stdout"
.LASF76:
    .string "_IO_lock_t"
    .ident  "GCC: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0"
    .section    .note.GNU-stack,"",@progbits

当我编译这段代码时,gcc会给出以下错误:错误:main的.size表达式不能求出常量

如果我将.section .text切换为.section .text.startup。编译器没有给出错误。

蹦床部分已插入.s文件。

所以我的第一个问题是.text和.text.startup有什么区别以及何时使用它们?

第二个问题是,更改为.text.startup是否有意义?请解释原因?

谢谢!

1 个答案:

答案 0 :(得分:3)

在仪器中的各节之间切换时,请使用.pushsection / .popsection这样可以使您返回到汇编程序当前位于代码之前的任何节。 (GAS manual


GCC使用.text.startup将“ main”之类的“冷”启动组合在一起,以便可以在程序启动后将其从缓存/ iTLB中逐出,甚至从内存中调出页面。和/或为了使程序的实际启动阶段具有更好的局部性/性能,因此可以从磁盘带来的更少页面上获得更多的进展。 (大概_start也进入.text.startup

它和.text都链接到文本 segment (read + exec)中,但是.text.startup中的所有功能都在一端分组在一起。


类似地,__attribute__((cold))将使GCC知道放置在.text.unlikely中的其他功能,这些功能也被分组在一起。

或者使用-fprofile-generate / -fprofile-use PGO让GCC识别“冷”功能(要么仅在启动时使用,仅在关闭时使用,否则在与您一起使用的非错误典型情况下完全不使用) PGO)。 (海湾合作委员会function attributes

要覆盖GCC选择的部分,请使用
__attribute__((section(".text"))) int main() { ... }

https://godbolt.org/z/z5c7zo

相关问题