Re: Declare strings on stack, gas
JIA Zhongye <[email protected]> Thu, 19 Apr 2012 02:14:36 +0800
| Newsgroups | org.kernel.vger.linux-assembly |
|---|---|
| Message-ID | <[email protected]> |
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