https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117049

            Bug ID: 117049
           Summary: [RISC-V]internal labels are present in asm and
                    executable.
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: akhilesh.k at samsung dot com
  Target Milestone: ---

Hi 

`.LFB`, `.LVL`, `.LBB`, and `.LBE` are internal labels is expected in compiler
generated asm file since these are internal labels i was expecting not to be
present in objdump. 

using open source risc-v and ARM toolchain observed these are visible in
objdump. 

Is this related with architecture, compiler settings ?



1. For ARM in asm internal labels are present but on executable these are
removed by compiler. 

akhilesh.k@B0110LHG:~/Activity/L_sections$ armv7l-unknown-linux-gnueabi-gcc -S
akhi.c 
akhilesh.k@B0110LHG:~/Activity/L_sections$ cat akhi.s | grep ".L"
        bgt     .L2
        b       .L3
.L2:
.L3:
.LC0:
        movw    r0, #:lower16:.LC0
        movt    r0, #:upper16:.LC0
akhilesh.k@B0110LHG:~/Activity/L_sections$ armv7l-unknown-linux-gnueabi-gcc -o
akhi akhi.c    
akhilesh.k@B0110LHG:~/Activity/L_sections$ armv7l-unknown-linux-gnueabi-objdump
-d akhi | grep ".L"

2. For RISC-V internal labels are present in asm and executable also 

akhilesh.k@B0110LHG:~/Activity/L_sections$ riscv64-unknown-linux-gnu-gcc -S
akhi.c
akhilesh.k@B0110LHG:~/Activity/L_sections$ cat akhi.s | grep ".L"               
        bgt     a4,a5,.L2
        j       .L3
.L2:
.L3:
.LC0:
        lla     a0,.LC0
20221130"
akhilesh.k@B0110LHG:~/Activity/L_sections$ riscv64-unknown-linux-gnu-gcc -o
akhi akhi.c          
akhilesh.k@B0110LHG:~/Activity/L_sections$ cat akhi.s | grep ".L"               
        bgt     a4,a5,.L2
        j       .L3
.L2:
.L3:
.LC0:
        lla     a0,.LC0
20221130"
akhilesh.k@B0110LHG:~/Activity/L_sections$ 

akhilesh.k@B0110LHG:~/Activity/L_sections$ cat akhi.c  
#include <stdio.h>

int factorial(int n) {
        if (n <= 1)
                return 1;
        else
                return n * factorial(n - 1);
}

int main() {
        int num = 5;
        printf("Factorial of %d is %d\n", num, factorial(num));
        return 0;
}

Reply via email to