C Disassembly before ARMv6: point value (.) Before label

I took apart the C program to see how the structures were created, and I have a question. This is on raspberry PI using

gcc -S -o source.s mystruct.c

To get the source.

Questions:

I noticed in all the programs that I am parsing, there are .Lxx tags. What is the difference between tag c . front and mark without it? I guess I'm confused because the directives have a ".", For example .data .

code

 typedef struct { int x; int y; } point; int main( int argc, char *argv[] ){ point p = { 1, 2 }; px = 2; px = px - py; return px; } 

Deal with

  .arch armv6 .eabi_attribute 27, 3 .eabi_attribute 28, 1 .fpu vfp .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 6 .eabi_attribute 34, 1 .eabi_attribute 18, 4 .file "struct.c" .section .rodata .align 2 .LC0: .word 1 .word 2 .text .align 2 .global main .type main, %function main: @ args = 0, pretend = 0, frame = 16 @ frame_needed = 1, uses_anonymous_args = 0 @ link register save eliminated. str fp, [sp, #-4]! add fp, sp, #0 sub sp, sp, #20 str r0, [fp, #-16] str r1, [fp, #-20] ldr r2, .L3 sub r3, fp, #12 ldmia r2, {r0, r1} stmia r3, {r0, r1} mov r3, #3 str r3, [fp, #-12] mov r3, #0 mov r0, r3 add sp, fp, #0 ldmfd sp!, {fp} bx lr .L4: .align 2 .L3: .word .LC0 .size main, .-main .ident "GCC: (Debian 4.7.2-5+rpi1) 4.7.2" .section .note.GNU-stack,"",%progbits 
+6
source share
1 answer

The prefix .L denotes a local character, which is a character visible only in this source file (this character is not exported to the .o file unless you specify a special assembler).

You can say that these are labels, because the line ends with:; no directives.

For more information, see the GCC "Character Names" documentation:

A local character is any character that begins with specific local label prefixes. By default, the local label prefix .L for ELF systems or L for traditional a.out systems, but each target can have its own set of local label prefixes. On local characters, HPPAs begin with L$ .

+7
source

Source: https://habr.com/ru/post/986591/


All Articles