This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ld: Simple Linker Script Example
- From: Barry Rountree <rountree at uga dot edu>
- To: <binutils at sources dot redhat dot com>
- Date: Thu, 6 Nov 2003 20:50:50 -0500
- Subject: ld: Simple Linker Script Example
- Organization: Computer Science Dept.
I'm puzzling my way through the ld documentation and I think I'm in need of
the "hello, world!" of linker scripts -- the minimal linker script that will
link two C files together into an executable.
gcc -Wl,--verbose gives the default script, of course, but it's moderately
large and as I change things I'm getting some opaque (to me) interactions.
The documentation gives the example
SECTIONS
{
. = 0x10000;
.text : { *(.text) }
. = 0x8000000;
.data : { *(.data) }
.bss : { *(.bss) }
}
with the comment "The simplest possible linker script has just one command:
SECTIONS. .... That's it! That's a simple and complete linker script." It
doesn't work by itself, of course, and while I got rid of the link errors by
cutting and pasting a few lines from the default script, the resulting binary
segfaulted.
The two machines I'm working on are:
Linux 2.4.21-0.13mdk i686
SunOS 5.9 sun4u sparc SUNW,Sun-Fire-880
Both have gcc 3.2 and binutils 2.14.
Thanks,
Barry Rountree