aboutsummaryrefslogtreecommitdiff
path: root/ld/PORTING
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-02-15 23:13:00 +0000
committerPer Bothner <per@bothner.com>1992-02-15 23:13:00 +0000
commit7e5c1057bb33fb6be25ada95ba7f58066d88de80 (patch)
tree7c9c733b223dcb3ab608e93fd9c0f13afffee7ff /ld/PORTING
parent15c5ec2e272c81d2358a96a21dd9cd038f18d61b (diff)
downloadgdb-7e5c1057bb33fb6be25ada95ba7f58066d88de80.zip
gdb-7e5c1057bb33fb6be25ada95ba7f58066d88de80.tar.gz
gdb-7e5c1057bb33fb6be25ada95ba7f58066d88de80.tar.bz2
* Makefile.in: Major changes. Removed some the sed
magic to converts scripts, since that is now handled by genscripts.sh and the *.sc-sh scipt generators. * config.h: Remove a bunch of macros defining emulations and targets. This becomes one less file to edit when adding emulations or targets. * ldemul.h (struct ld_emulation_xfer_struct): Add emulation_name and target_name fields. * ldemul.c, ldemul.h: Define some default functions used by most emulations (and remove from the *.em scripts). * ldemul.c (ldemul_choose_target): Search the new ld_emulations array using a loop (instead of a hardwired nested if statement). Define the ld_emulation from the automatically-geenrated ldemul-list.h. This means you no longer have to edit ldemul.c to add a new emulation. * ldmain.c: Replace {GLD,LNK}960_EMULATION_NAME by their expansions, since the former no longer exist. * PORTING: A very rough first draft of a porting guide.
Diffstat (limited to 'ld/PORTING')
-rw-r--r--ld/PORTING63
1 files changed, 63 insertions, 0 deletions
diff --git a/ld/PORTING b/ld/PORTING
new file mode 100644
index 0000000..706172b
--- /dev/null
+++ b/ld/PORTING
@@ -0,0 +1,63 @@
+Some incomplete notes about porting GNU ld
+-----------------------------------------
+
+Before porting ld itself, you will need to port the BFD library.
+
+We tarlk about the 'host' system as the machine and software
+nevironment where ld runs (generates an execuitble *on*),
+while the 'target' is the machine ld generates an executable *for*.
+Most often, host==target, but ld supports cross-linking
+(and to some extent the same ld binary can be used a linker
+for multiple target rachitectures).
+
+Doing a 'host' port means working around broken or missing
+include files or libraries. ...
+
+Porting to a new target
+-----------------------
+
+Writing a new script script
+---------------------------
+
+You may need to write a new script file for your emulation.
+
+The variable RELOCATING is only set if relocation is happening
+(i.e. unless the linker is invoked with -r).
+Thus your script should has an action ACTION
+that should only be done when relocating,
+express that as:
+ ${RELOCATING+ ACTION}
+In general, this is the case for most assignments, which should look like:
+ ${RELOCATING+ _end = .}
+
+Also, you should assign absolute addresses to sections only
+when relocating, so:
+ .text ${RELOCATING+ ${TEXT_START_ADDR}}:
+
+The forms:
+ .section { ... } > section
+should be:
+ .section { ... } > ${RELOCATING+ section}
+
+Old Makefile comments (re-write - FXIME!)
+-----------------------------------------
+
+# The .xn script is used if the -n flag is given (write-protect text)..
+# Sunos starts the text segment for demand-paged binaries at 0x2020
+# and other binaries at 0x2000, since the exec header is paged in
+# with the text. Some other Unix variants do the same.
+# For -n and -N flags the offset of the exec header must be removed.
+# This sed script does this if the master script contains
+# a line of the form ".text 0xAAAA BLOCK(0xBBBB):" - the
+# output will contain ".text 0xBBBB:". (For Sunos AAAA=2020 and BBBB=2000.)
+.x.xn:
+ sed -e '/text/s/\.text .* BLOCK(\([^)]*\)):/.text \1:/' < $< >$*.xn
+
+# The .xN script is used if the -N flag is given (don't write-protect text).
+# This is like -n, except that the data segment need not be page-aligned.
+# So get rid of commands for page-alignment: We assume these use ALIGN
+# with a hex constant that end with 00, since any normal page size is be
+# at least divisible by 256. We use the 00 to avoid matching
+# anything that tries to align of (say) 8-byte boundaries.
+.xn.xN:
+ sed -e '/ALIGN/s/ALIGN( *0x[0-9a-fA-F]*00 *)/./' < $< >$*.xN