Re: Help my understanding of compiled code

Alan Donovan <adonovan@imerge.co.uk>
16 Nov 1999 23:44:07 -0500

          From comp.compilers

Related articles
Help my understanding of compiled code nerkul@my-deja.com (1999-11-09)
Re: Help my understanding of compiled code ilya@math.ohio-state.edu (1999-11-16)
Re: Help my understanding of compiled code adonovan@imerge.co.uk (Alan Donovan) (1999-11-16)
Re: Help my understanding of compiled code christian.sell@netcologne.de (Christian Sell) (1999-11-16)
Re: Help my understanding of compiled code mwh@gradin.cis.upenn.edu (1999-11-18)
| List of all articles for this month |
From: Alan Donovan <adonovan@imerge.co.uk>
Newsgroups: comp.compilers
Date: 16 Nov 1999 23:44:07 -0500
Organization: Imerge Ltd.
References: 99-11-059
Keywords: code

nerkul@my-deja.com wrote:
>
> Okay, so an executable file, say one compiled by gcc, they call that a
> binary... But I look through it and their are clearly lots of
> human-readable strings and stuff. So my question is, what's in a
> compiled program? I want to automate a kind of
> platform-independent machine code searching thing, but I'm not sure
> quite where to begin.


Executable files, binary files, load modules -- whatever you call
them, can have a number of file formats. a.out, ELF, COFF and XCOFF
are a few. Each of them basically consists of a header, describing
the lengths of the following sections, and then the sections
themselves.


If you want to look at one, find a Windows box, and invoke Quick View
on an file of type .exe or .dll -- this will show the COFF header and
some other windowsy things.


The sections are typically: the "text" section which contains the
instructions of the program; the constants section which include
strings (in fact, in C, when you refer to "hello\n", it is in fact a
pointer to the address of the string within the constants section of
the load module); initialised static data, and any custom sections.


Search the web for ELF or COFF and you're bound to find something.


alan
------------------------------------------------------------------------
    Alan Donovan adonovan@imerge.co.uk http://www.imerge.co.uk
    Imerge Ltd. +44 1223 875265


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.