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

  • Home
  • SEARCH
  • 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 7778847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:30:04+00:00 2026-06-01T18:30:04+00:00

I’m currently a total beginner with assembly and am learning how to use assembly

  • 0

I’m currently a total beginner with assembly and am learning how to use assembly inline with C for a class. That being said, I’m having a hard time with this particular error when I’m compiling my file:

/tmp/cckHnU89.s: Assembler messages:
/tmp/cckHnU89.s:550: Error: symbol `.L16' is already defined
/tmp/cckHnU89.s:571: Error: symbol `.L18' is already defined
/tmp/cckHnU89.s:576: Error: symbol `.L17' is already defined

I tried replacing the names of the labels with other names since I noticed from the .s file that the labels .L16, .L17, and .L18 are used in my main method as well as in one of my functions. However, when did that I just ended up with a segmentation fault from running the program. Is there a way to change the names of the labels or something else to fix which apparently seems to be a naming conflict?

As far as my CPU, I’m running an Intel Pentium T4500 processor and I’m compiling with gcc version 4.4.3. My code is 300+ lines for the inline assembly portion so I’ll spare whoever reads this. Essentially, I’m just looking for a general answer on how one would normally fix the naming conflict that produces the error above. Anything insight would be greatly appreciated.

  • 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-06-01T18:30:05+00:00Added an answer on June 1, 2026 at 6:30 pm

    My hunch here is (and I just verified it with g++ -S and gcc -S) that your own labels are exactly mimicking the naming scheme (.L<num>) for labels automatically assigned to assembler code in GCC.

    Do the following:

    # for C:
    gcc -S source.c
    # for C++
    g++ -S source.cpp
    

    … and then cat (or less) the resulting .s file (same base name, .s suffix, e.g. source.s). You will find numerous labels of that scheme (.L<num>). Now, if you yourself create inline assembly containing the same names as already automatically created labels (from your C code), that would obviously lead to clashes.

    So the gist: don’t use .L<num> as your naming scheme for labels, because it will clash.

    Generally names starting with .L seem to ask for trouble here.


    Example (test.cpp), compile with g++ -S test.cpp:

    #include <cstdio>
    
    int main(int argc, char**argv)
    {
            switch(argc)
            {
                    case 0:
                            printf("test 0\n");
                            break;
                    case 1:
                            printf("test %d\n", argc);
                            break;
                    case 2:
                            printf("test %d -> %s\n", argc, argv[0]);
                            break;
                    default:
                            printf("Default\n");
                            break;
            }
            return 0;
    }
    

    Compiled on x64 (contents of test.s):

            .file   "test.cpp"
            .section        .rodata
    .LC0:
            .string "test 0"
    .LC1:
            .string "test %d\n"
    .LC2:
            .string "test %d -> %s\n"
    .LC3:
            .string "Default"
            .text
    .globl main
            .type   main, @function
    main:
    .LFB0:
            .cfi_startproc
            .cfi_personality 0x3,__gxx_personality_v0
            pushq   %rbp
            .cfi_def_cfa_offset 16
            movq    %rsp, %rbp
            .cfi_offset 6, -16
            .cfi_def_cfa_register 6
            subq    $16, %rsp
            movl    %edi, -4(%rbp)
            movq    %rsi, -16(%rbp)
            movl    -4(%rbp), %eax
            cmpl    $1, %eax
            je      .L4
            cmpl    $2, %eax
            je      .L5
            testl   %eax, %eax
            jne     .L8
    .L3:
            movl    $.LC0, %edi
            call    puts
            jmp     .L6
    .L4:
            movl    -4(%rbp), %eax
            movl    %eax, %esi
            movl    $.LC1, %edi
            movl    $0, %eax
            call    printf
            jmp     .L6
    .L5:
            movq    -16(%rbp), %rax
            movq    (%rax), %rdx
            movl    -4(%rbp), %eax
            movl    %eax, %esi
            movl    $.LC2, %edi
            movl    $0, %eax
            call    printf
            jmp     .L6
    .L8:
            movl    $.LC3, %edi
            call    puts
    .L6:
            movl    $0, %eax
            leave
            ret
            .cfi_endproc
    .LFE0:
            .size   main, .-main
            .ident  "GCC: (Debian 4.4.5-8) 4.4.5"
            .section        .note.GNU-stack,"",@progbits
    

    Observe the names starting with .L in the resulting assembler file.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build

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.