Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 801665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:28:38+00:00 2026-05-14T23:28:38+00:00

Pasted below is unoptimized GCC assembly output for "int main(){}". I’m relatively good with

  • 0

Pasted below is unoptimized GCC assembly output for "int main(){}". I’m relatively good with x86 assembly, but some of this is unfamiliar. Could someone please do a line-by-line walk-through of what’s going on here?

    .text
.globl _main
_main:
LFB2:
    pushq   %rbp
LCFI0:
    movq    %rsp, %rbp
LCFI1:
    leave
    ret
LFE2:
    .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
    .set L$set$0,LECIE1-LSCIE1
    .long L$set$0
LSCIE1:
    .long   0x0
    .byte   0x1
    .ascii "zR\0"
    .byte   0x1
    .byte   0x78
    .byte   0x10
    .byte   0x1
    .byte   0x10
    .byte   0xc
    .byte   0x7
    .byte   0x8
    .byte   0x90
    .byte   0x1
    .align 3
LECIE1:
.globl _main.eh
_main.eh:
LSFDE1:
    .set L$set$1,LEFDE1-LASFDE1
    .long L$set$1
LASFDE1:
    .long   LASFDE1-EH_frame1
    .quad   LFB2-.
    .set L$set$2,LFE2-LFB2
    .quad L$set$2
    .byte   0x0
    .byte   0x4
    .set L$set$3,LCFI0-LFB2
    .long L$set$3
    .byte   0xe
    .byte   0x10
    .byte   0x86
    .byte   0x2
    .byte   0x4
    .set L$set$4,LCFI1-LCFI0
    .long L$set$4
    .byte   0xd
    .byte   0x6
    .align 3
LEFDE1:
    .subsections_via_symbols
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:28:38+00:00Added an answer on May 14, 2026 at 11:28 pm

    Tell the linker to put this into the executable’s .text section:

        .text
    

    Export main as a external symbol:

    .globl _main
    

    Define the main function itself:

    _main:
    LFB2:
    

    Save the previous frame pointer:

        pushq   %rbp
    LCFI0:
    

    Set up a new frame pointer:

        movq    %rsp, %rbp
    LCFI1:
    

    Restore the old frame pointer and return to caller:

        leave
        ret
    

    The following directives are setting up an .eh_frame section, containing information required by the C++ runtime for exception handling.

    LFE2:
        .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
    

    This is the Common Information Entry table:

    EH_frame1:
    

    It starts with a length, calculated from the difference of the LSCIE1 and LECIE1 labels:

        .set L$set$0,LECIE1-LSCIE1
        .long L$set$0
    

    (The .long, .byte, .ascii and .quad cause a value of the appropriate type to be directly emitted by the assembler). Then follows the CIE table itself:

    LSCIE1:
        .long   0x0
        .byte   0x1
        .ascii "zR\0"
        .byte   0x1
        .byte   0x78
        .byte   0x10
        .byte   0x1
        .byte   0x10
        .byte   0xc
        .byte   0x7
        .byte   0x8
        .byte   0x90
        .byte   0x1
        .align 3
    LECIE1:
    

    Another external symbol, this one for the main function’s Frame Description Entry (still part of the exception handling information):

    .globl _main.eh
    _main.eh:
    

    Again, the FDE starts with a length:

    LSFDE1:
        .set L$set$1,LEFDE1-LASFDE1
        .long L$set$1
    

    ..and continues with the rest of the FDE table.

    LASFDE1:
        .long   LASFDE1-EH_frame1
        .quad   LFB2-.
        .set L$set$2,LFE2-LFB2
        .quad L$set$2
        .byte   0x0
        .byte   0x4
        .set L$set$3,LCFI0-LFB2
        .long L$set$3
        .byte   0xe
        .byte   0x10
        .byte   0x86
        .byte   0x2
        .byte   0x4
        .set L$set$4,LCFI1-LCFI0
        .long L$set$4
        .byte   0xd
        .byte   0x6
        .align 3
    LEFDE1:
        .subsections_via_symbols
    

    Those exception handling tables are mostly uninteresting, but if you want to know then information on the format is available here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code pasted below, works on my PC, but not on my hosting (which
The code I have pasted below is meant to display images on the middle
I just pasted some generated javadoc into an eclipse project, to discover none of
i am sure this is something obvious, but i cant seem to figure it
I posted a similar question on how scalable linq is. There were so many
Someone posted a great little function here the other day that separated the full
I posted this question yesterday evening, which has led me to discover a huge
I posted this question: https://stackoverflow.com/questions/418597/java-and-net-for-php-programmer and the answers I was given didn't really help
Originaly posted a while back on a different forum, hope I can find a
Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.