Distribution of functions

Where are functions stored in a C ++ program?

for instance

int abc()
{
   //where am I stored? 
}

I know that we can take the address of the function, that is, the functions are stored somewhere in memory. But I already read in many places that memory allocation for functions does not occur.

I'm confused. My question may seem vague to many of you, but I cannot help.

+3
source share
4 answers

Before starting, your program is loaded into memory and includes loading code that implements functions.

As soon as the program starts working, memory allocation for functions does not occur; this is done before the program is launched by the loader of the system program.

"" , , ROM, .

+9

.

. , , , - . ..

, () , *.map, .

+2

:

( ) , , . , . COFF, PE ELF, , .text. .data .bss.

. , ( ld-linux.so Linux) , . , MMU, , x86. , . .

0

, . . " ".

. . , - Flash .

, . " ", .

0
source

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


All Articles