From: Ben Pfaff <blp@cs.stanford.edu>
To: linux-kernel@vger.kernel.org
Subject: Re: Easier way to generate stuff like asm-offsets.
Date: Fri, 20 Nov 2009 20:43:16 -0800 [thread overview]
Message-ID: <87aaygfpy3.fsf@blp.benpfaff.org> (raw)
In-Reply-To: 3f43f78b0911201656o6d222e6fkf5ef8533c8ee6e16@mail.gmail.com
Kaz Kylheku <kkylheku@gmail.com> writes:
> Then we can use the ``nm'' tool (the toolchain should have binutils in it):
>
> $ /path/to/toolchain/bin/arch-prefix-nm -t d -P foo.c # decimal
> output, posix format
> offsetof_foo_member C 00000044 00000044
If those numbers are in decimal...
> There we go, 44 bytes. Simple. This is almost an #include file;
> we just have to do some simple filtering, such as:
>
> $ /path/to/toolchain/bin/arch-prefix-nm -t d -P test.o | awk '{ print
> "#define", $1, $4 }'
> #define offsetof_foo_member 00000044
...then the #define is wrong because it's interpreted as octal
there.
Cool trick!
--
Ben Pfaff
http://benpfaff.org
next prev parent reply other threads:[~2009-11-21 4:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-21 0:56 Easier way to generate stuff like asm-offsets Kaz Kylheku
2009-11-21 4:43 ` Ben Pfaff [this message]
2009-11-21 6:10 ` Michal Jaegermann
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=87aaygfpy3.fsf@blp.benpfaff.org \
--to=blp@cs.stanford.edu \
--cc=linux-kernel@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