Re: [linux-assembly] Declare strings on stack, gas

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the stack could be any arbitrary place in memory, I'm afraid you don't got too many choice but set-up the content by yourself.

When a local array of char is declared in C, i.e. something like:
void foo()
{
  char s[] = "hello world";
}
The compiler does just the same thing as you by MOVL, and when the string is rather long, the compiler would place the string in .data and call memcpy() to copy it to stack.

On 04/18/2012 10:58 PM, Daniel Hilst wrote:
Is possible to declare strings on stack? I'm using mov + ebp offsets to
do something like that.. Is there an easier way to do it?

Here is an sample off how I'm doing it: http://sprunge.us/UUZI

The hex numbers are a "Hello World" string..
I have tried .assci without success :(

Thanks in advance!



--
Regards,
Zhongye
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Linux C Programming]     [Linux for Hams]     [DCCP]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux