Skip to contentSkip to conversation

varibles define

DISCUSSION horseriver 2 participants 2 messages Feb 13, 2013 – Feb 15, 2013

lore
Share & tools
lore

horseriver

author
#0 lore raw

hi:)

If define a byte in .text. then ,does this byte located into .data section in object file?

thanks!

#1 lore raw

Definition in .text will stay in .text at the same position you defined it. Of course when the code is executed the cpu doesn't know at all that he is reading a string for example or an executable code

You can do this:

...execution flow started...
jmp lb1: // jump to avoid the cpu
to interpret the variable definition as code
mystrind db "hello world!", 0h // definition of a variable here
lb1:
....execution flow continues here

else the best is to store you data after the exit of the program

Never do something like this below:

some instruction
some instruction
mystring db "Hello world!", 0h // definition here some instruction

In the example above the hexa version of "hello world!",0h will be read and executed by the cpu and it is not what we want

regards,

Sofiane Akermoun
[email protected]
[email protected]

2013/2/13 horseriver <[email protected]>:

Quoted 9 lines

hi:)

If define a byte in .text. then ,does this byte located into .data section in object file?

thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Sofiane AKERMOUN
[email protected]