Re: Declare strings on stack, gas

JIA Zhongye <[email protected]>
Newsgroups gmane.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
--
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.