Linux assembly list
 help / color / mirror / Atom feed
* varibles define
@ 2013-02-13  4:34 horseriver
  2013-02-15  1:21 ` Sofiane Akermoun
  0 siblings, 1 reply; 2+ messages in thread
From: horseriver @ 2013-02-13  4:34 UTC (permalink / raw)
  To: linux-assembly

hi:)

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

thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: varibles define
  2013-02-13  4:34 varibles define horseriver
@ 2013-02-15  1:21 ` Sofiane Akermoun
  0 siblings, 0 replies; 2+ messages in thread
From: Sofiane Akermoun @ 2013-02-15  1:21 UTC (permalink / raw)
  To: horseriver; +Cc: linux-assembly

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
sofiane.akermoun@datalabsecurity.com
akersof@gmail.com

2013/2/13 horseriver <horserivers@gmail.com>:
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Sofiane AKERMOUN
akersof@gmail.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-15  1:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13  4:34 varibles define horseriver
2013-02-15  1:21 ` Sofiane Akermoun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox