From: JIA Zhongye <jia.zhongye@gmail.com>
To: Daniel Hilst <danielhilst@gmail.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: Declare strings on stack, gas
Date: Thu, 19 Apr 2012 02:14:36 +0800 [thread overview]
Message-ID: <4F8F048C.8010302@gmail.com> (raw)
In-Reply-To: <4F8ED685.2030408@gmail.com>
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
next prev parent reply other threads:[~2012-04-18 18:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-18 14:58 Declare strings on stack, gas Daniel Hilst
2012-04-18 18:14 ` JIA Zhongye [this message]
2012-04-18 19:34 ` Robert Plantz
2012-04-19 16:07 ` Daniel Hilst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F8F048C.8010302@gmail.com \
--to=jia.zhongye@gmail.com \
--cc=danielhilst@gmail.com \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).