[EMAIL PROTECTED] wrote:
If I want to see what a program looks like in memory,
is there a way to either get that "raw memory binary" from an ELF file
or make GNU's as (assembler) output this raw non-ELF format?

The tools you want are kinda split across a couple of things.

The assembler probably isn't far enough along the chain to give you what you want. You need the stuff surrounding the linker and the linkerscripts.

The central focal point is: ld -- the main linker

There are a suite of tools surrounding that which give different information:

nm - list symbols from object files
objcopy - copy and translate object files
objdump - display information from object files
readelf - display information about ELF files

These may also be useful:
ar - create, modify and extract from archives
ranlib - generate index to archive

You may also have to go groveling around the linkerscripts. These are generally poorly documented and fairly obscure. Generally, you have to go hunting for them. A quick look at my cross-compiler tool chain shows:

Extension -- Function of linkerscript
.specs -- looks like it handles preambles/postambles and initial points
.ld -- seems to have the actual memory map and tables
.s & .o -- probably the source and obj for the preambles/postambles

.x -- unknown, but seem to be linkerscripts for different flags
.xbn
.xc
.xn
.xr
.xs
.xsc
.xsw
.xu
.xw

I know this is a lot of information, and probably not directly helpful, but at least it can help focus your search. The last time I went looking for information on this kind of stuff, it was pretty painful to even find good hooks to start searching.

Hopefully this will help point you in the right direction. Be aware, there aren't going to be too many people who can help you on this stuff. You're starting to grovel in some fairly esoteric portions of gcc that most people simply regard as "Black Magic(tm)".

Also be aware that gcc has apparently gotten a new linker recently. Some of this stuff may change in the near future.

Good luck,
-a

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to