Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@calmyourtities the compiler does embed the variable names into nhe assembler file it generates... However, in assembler, "variables" are only a placeholder for a number, which represents the position relative to the beginning of the assembler file...
0. File begins
1. Section .data
2. Myvar: db "hi"
Blablabla
10. Mov Myvar, eax
This gets changed by the assembler to
0. File begins
1. Section .data
2.db "HI" ;notice how the line number represents bytes in assembler
5.blablabla ; it is required to skip these lines, else the linker wil allocate blablabla to the variable
10. Mov file_begins+2,eax ; in the beginning of the execution every programm gets assigned a number where its execution starts in the ram... It is stored in a special regiser; if you wanna go in for a segfault, you can wove something into it
So you see. Assembler just stores the values of the variables and the byte block number... Actually, a byte block number is 8 bytes wide... no space for typingg left -
@linuxer4fun
The assembler also does much more than shown above...
Anyway. The .o file doesnt even contain infos about how long the variables are, or if there are even variables. It doesnt even care about nomes, as it knows the byte bloks they start in...
You could do
Mov var, dword[var2]
Altough var2 is only a word long... It would just add the bytes of the next variable. It only sigsevs, when you try to access a pointer outside of the programm. This is caused by the operating system.
Ok... Wrote everythitg pfuuhhhh
Related Rants
-
localjoost51Last year I built the platform 'Tindex'. It was an index of Tinder profiles so people could search by name, ge...
-
woodworks34There was a problem with a server we were staging on, and I was providing DevOps help remote. As a joke I sa...
-
allankibet17Kenyans lost these great devs in a terror attack. A moment of silence
Me:
*decompiles swf*
*thinks: "what is this shit?"*
*scrolls down*
*finds variable named "randomShit"*
undefined
rip