This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Flat Binaries for i386
- From: Ian Lance Taylor <iant at google dot com>
- To: "Gary Partis" <gary at partis dot co dot uk>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 31 Oct 2008 07:07:25 -0700
- Subject: Re: Flat Binaries for i386
- References: <056301c93ae8$1a081210$4e183630$@co.uk>
"Gary Partis" <gary@partis.co.uk> writes:
> I am creating a large number of executables for i386 based systems (not a
> standard PC, nor does it run an off-the-shelf operating system), and require
> the binary executable to contain _all_ information required (and allocated
> space) within the file.
>
> This is not ordinarily a problem, using a linker script and stipulating a
> 'binary' output from the linker.
>
> However, I'd like the BSS section to also be included in the file, as a
> place holder, such that the file contains all areas of memory required by
> the executable. All sections (text, data, read-only and bss) are
> concatenated and not spread through memory.
>
> The map file shows all address are correct, but I really do need the bss
> section within the binary file.
>
> How does one do this?
This question would be better directed to the mailing list
binutils@sourceware.org. See http://sourceware.org/binutils .
Normally the procedure is to explicitly zero out the bss section in
the startup code. I don't know of any standard way to do this in a
linker script. Since you are generating binary format, it might work
to simply put something like "BYTE(1)" after the .bss section.
Ian