Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are .seh_* assembly commands that gcc outputs?

I use gcc -S for a hello world program. What are the 5 .seh_ commands? I can't seem to find much info at all about them when I search.

    .file   "hi.c"
    .def    __main; .scl    2;  .type   32; .endef
    .section .rdata,"dr"
.LC0:
    .ascii "Hello World\0"
    .text
    .globl  main
    .def    main;   .scl    2;  .type   32; .endef
    .seh_proc   main
main:
    pushq   %rbp
    .seh_pushreg    %rbp
    movq    %rsp, %rbp
    .seh_setframe   %rbp, 0
    subq    $32, %rsp
    .seh_stackalloc 32
    .seh_endprologue
    call    __main
    leaq    .LC0(%rip), %rcx
    call    puts
    movl    $0, %eax
    addq    $32, %rsp
    popq    %rbp
    ret
    .seh_endproc
    .ident  "GCC: (rubenvb-4.8.0) 4.8.0"
    .def    puts;   .scl    2;  .type   32; .endef
like image 902
Josh Avatar asked Dec 28 '13 22:12

Josh


People also ask

What is SEH in assembly?

Structured exception handling (SEH) is a Microsoft extension to C to handle certain exceptional code situations, such as hardware faults, gracefully. Although Windows and Microsoft C++ support SEH, we recommend that you use ISO-standard C++ exception handling.

What kind of assembly does GCC generate?

GCC always produces asm output that the GNU assembler can assemble, on any platform.


1 Answers

I stopped them from being output by using:

gcc -S -fno-asynchronous-unwind-tables hi.c

so I can look that up. But I'm happy with just not having them output anymore.

like image 134
Josh Avatar answered Oct 26 '22 13:10

Josh