[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87aaygfpy3.fsf@blp.benpfaff.org>
Date: Fri, 20 Nov 2009 20:43:16 -0800
From: Ben Pfaff <blp@...stanford.edu>
To: linux-kernel@...r.kernel.org
Subject: Re: Easier way to generate stuff like asm-offsets.
Kaz Kylheku <kkylheku@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists