How do labels and dd declarations work in NASM? What's the C equivalent?

前端 未结 2 974
隐瞒了意图╮
隐瞒了意图╮ 2021-01-25 01:12

I\'m trying to understand what\'d be the C equivalent of some nasm idioms like these ones:

%define CONSTANT1 1
%define CONSTANT2 2

1) section name_section data          


        
2条回答
  •  北海茫月
    2021-01-25 01:39

    The NASM global label directive does not actually declare label. It just modifies what scope it will have when you do declare it, with label:.

    It's the opposite of C, where global is the default and you have to use static to get non-exported symbols that are private to this compilation unit.


    v4: is empty, what does that mean?

    Think of labels as zero-width pointers. The label itself has no size, it just labels that position in the binary. (And you can have multiple labels at the same location).

    NASM has no types, so it's really quite similar to void*.

提交回复
热议问题