# relink the linker
#
proc ld_start { ld target } {
- default_ld_start $ld $target
+ #
}
+
+#
+# ld_relocate
+# link an object using relocation
+#
+proc ld_relocate { ld target objects } {
+ default_ld_relocate $ld $target $objects
+}
+
+#
+# ld_link
+# link a program using ld
+#
+proc ld_link { ld target objects } {
+ default_ld_link $ld $target $objects
+}
+
+#
+# ld_compile
+# compile an object using $cc
+#
+proc ld_compile { cc source object } {
+ default_ld_compile $cc $source $object
+}
+
+#
+# ld_exec
+# execute ithe target
+#
+proc ld_exec { target output } {
+ default_ld_exec $target $output
+}
+
set tmpdir /tmp
set stage 0
-# link the target with itself
-ld_start $objdir/ld.new $tmpdir/ld.$stage
+
+#
+# link an object using relocation
+#
+
+ld_relocate $objdir/ld.new $tmpdir/ld-partial.o $OFILES
+
+ld_link $objdir/ld.new $tmpdir/ld.partial $tmpdir/ld-partial.o
+
+ld_link $tmpdir/ld.partial $tmpdir/ld.full $OFILES
+
+ld_link $tmpdir/ld.full $tmpdir/ld.$stage $OFILES
#
# main test loop
verbose "### stage is now $stage\n" 1
# link the target with itself
- ld_start $ld_old $ld_new
+ ld_link $ld_old $ld_new $OFILES
# load (compare) the target
if ![file exists $ld_old] then {
verbose "### EXEC rm -f $ld_old $ld_new"
catch "exec rm -f $ld_old $ld_new" result
ld_exit
-
-