Reputation: 525
.data
ENTRY(sys_call_table)
.long SYMBOL_NAME(sys_ni_call) /* 0 */
.long SYMBOL_NAME(sys_exit)
.long SYMBOL_NAME(sys_fork)
...
.long SYMBOL_NAME(sys_vfork) /* 190 */
I read this source code. I can't find .data
or .long
definition in the source.
Upvotes: 0
Views: 164
Reputation: 400384
They are assembler directives—special directions to the assembler which tell it to do something different, rather than inserting a processor instruction into the compiled machine code.
The .data
directive tells the assembler to emit the following instructions onto the end of one of the subsections of the data
section of the executable. Normally, machine code is emitted into the so-called text
section of executables, whereas non-executable data such as global variables are stored in one of the so-called data
sections. The different sections have different memory permissions at runtime, among other features.
The .long
directive is equivalent to the .int
directive, which just says to insert a literal numeric value into the machine code. So .long SYMBOL_NAME(sys_ni_call)
inserts the numeric value of the location of the sys_ni_call
symbol.
So putting these together, a .data
directive followed by a .long
directive results in the assembler putting specific integer values into one of the data
sections of the resulting object code. These values will be non-executable, and they may be read-only or read-write, depending on how the permissions of the sys_call_table
subsection of the data
section are configured.
Upvotes: 3