Does GNU Assembler add its own entry point?

Let's say I have the following build code:

.section .text

.globl _start
_start:

If I created an executable file using the following commands:

as 1.s -o 1.o
ld 1.o -o 1

Will the GNU collector add its own entry point to my executable, which calls _startor will _startbe the actual entry point?

See question for details .

+4
source share
2 answers

The file crt0.o (or crt1.o or this file is called), which contains the startup code mentioned in another question, is also written in assembler.

, Linker ( "ld" ), ( "as" ) "_start" , .

, , crt0.o "ld" . , , "_start" , "main" :

.globl main
.text
main:
    ...

"ld" , "_start" , !

+1

:

objdump -x 1 # n.b. 1 is the name of your program

, :

start address 0x000000...

, , . , , .text, _start. , _start ELF.

0

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


All Articles