C反汇编到ARMv6:Dot(.)在Label之前的含义

Jer*_*naw 8 c assembly arm

我反汇编了一个C程序,看看结构是如何创建的,我有一个问题.这是在Raspberry PI上使用的

gcc -S -o source.s mystruct.c

获取来源.

问题:

我注意到在我拆卸的所有程序中都有标签.Lxx..前面的标签和没有标签的标签有什么区别?我想我很困惑,因为指令有'.',就像.data.

码

typedef struct {
    int x;
    int y;
} point;

int main( int argc, char *argv[] ){
    point p = { 1, 2 };

    p.x = 2;
    p.x = p.x - p.y;

    return p.x;
}
Run Code Online (Sandbox Code Playgroud)

拆卸到

        .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
Run Code Online (Sandbox Code Playgroud)

nne*_*neo 10

该.L前缀是指一个局部符号,这是只有在源文件中看到一个符号(这些符号都没有导出到.o,除非你指定一个特殊的选项来汇编文件).

你可以说它们是标签,因为这条线以:; 指令没有.

有关更多信息,请参阅GCC 符号名称文档:

本地符号是以某些本地标签前缀开头的任何符号.默认情况下,本地标签前缀适用.L于ELF系统或L传统的a.out系统,但每个目标可能有自己的一组本地标签前缀.在HPPA上,本地符号以L$.