Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STINKR - Linker for C programs #418

Merged
merged 1 commit into from
Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SRC = system syseng sysen1 sysen2 sysen3 sysnet kshack dragon channa \
bawden _mail_ l lisp libdoc comlap lspsrc nilcom rwk \
inquir acount gz sys decsys ecc alan sail
DOC = info _info_ sysdoc kshack _teco_ emacs emacs1
BIN = sysbin device emacs _teco_ lisp liblsp alan inquir sail comlap
BIN = sys2 sysbin device emacs _teco_ lisp liblsp alan inquir sail comlap

# These directories are put on the minsys tape.
MINSYS = _ sys
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ A list of [known ITS machines](doc/machines.md).
- SPELL, ESPELL spell checker.
- SRCCOM, Compares/merges source files, compares binary files.
- STINK, linker.
- STINKR, new linker (binary only).
- STY, pseudo-terminal for multiple sessions.
- STYLOG, convert PTY output file into ascii file.
- SUPDUP, Supdup client.
Expand Down
Binary file added bin/sys2/ts.stinkr
Binary file not shown.
88 changes: 88 additions & 0 deletions doc/_info_/stinkr.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
----- STINKR INFO ----- 20 April 1977 ----- AS@DM -----

STINKR is a new loader that accepts RELOCATABLE output produced by
MIDAS. It does not implement all of the features implemented by
STINK (see below). However, it has some features of its own, namely:

1. multiple (up to 16) segments (location counters)
2. automatic segment allocation
3. loads into an inferior, so that there are no loading
restrictions
4. can invoke an initialization routine
5. does its own PDUMPing

The following STINK features are not implemented:

a) fancy FAIL stuff (e.g. fixups)
b) global relocation
c) global offset
d) local symbols (they are ignored)
e) load-time conditionals
f) load-time operations
g) libraries
h) COMMON
i) 1PASS assembly
j) shifted relocation by globals

-- JCL Format --

JCL to STINKR is optional. If present, it should consist of a
sequence of arguments separated by spaces. An argument can be
an option string or a file name. An option string has the form
-abc, where a, b, and c are option names. The existing options are:

s - print symbol table
p - print description of RELOCATABLE files loaded
d - print additional STINKR debugging info

A file name is either loaded or xfiled, depending upon its format.
If no second file name is given, it is assumed to be STINKR.
Patterns using * (matches any sequence of characters) and ? (matches
any single character) can be given. If no file names are specified,
command input is taken from the terminal.

-- Command Format --

STINKR takes commands from files or the terminal in a manner similar
to STINK. A command consists of a single line, beginning with the
command name, optionally followed by arguments. The commands are:

s <o0>,<o1>,<o2>,... define segments (see below)
l <file> load file <file>
x <file> execute command file <file>
i <name> specify initialization routine
o <file> specify output file name
; <anything> a comment

Blank command lines are ignored.

The basic operation of STINKR is to read all of the commands, loading
specified files and remembering the other information. When the
basic command file is finished (or ^@ is typed, if terminal input),
STINKR then does the following:

a) print list of undefined symbols, if any
b) print segment map
c) print symbol table, if desired (-s option)
d) call initialization routine, if any
e) PDUMP to output file, if any

-- Segments --

In order to use multiple segments, one must use the macros in the
file SYSENG;MULSEG INSERT while assembling. If more than one segment
is to be used, the s command must be given, before any files are
loaded. The arguments to the s command are a list of OCTAL
addresses, which specify the origins of all of the segments,
starting with segment 0. Instead of giving a particular origin,
one may also specify either N (next location) or P (next page);
in order for these to work, the MULSEG macros MUST be used.

-- Initialization Routine --

One may specify an initialization routine to be run immediately
before PDUMPing. This routine could, for example, purify read-only
segments. When invoked, locations 20 to 20+N-1 will contain the
FIRST,,LAST locations of the N segments. The initialization routine
should return with a .BREAK 16,0 if successful or a .VALUE if
unsuccessful.
74 changes: 74 additions & 0 deletions src/syseng/mulseg.insert
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
; THIS INSERT FILE ALLOWS USE OF STINKR MULTIPLE SEGMENT FEATURE

; MACROS:
;
; .MSEG o1,o2,o3,...
;
; This macro should come after the RELOCATABLE and any RADIX
; command and before any code. The arguments are the virtual
; origins of the segments other than segment 0. The virtual
; origin of segment 0 is always 0. The virtual origins are used
; internally to distinguish the various segments. For example,
; if one has done .MSEG 400000, then relocatable addresses in
; segment 1 will start from relocatable 400000. The choice
; of virtual segment origins is important only in that it
; limits the maximum size of the various segments.
;
; .SEG n
;
; This macro switches to segment n, where n ranges from 0 to
; one less than the number of segments. Initially, the current
; segment is 0.
;

IF1,[

DEFINE MS%AS *PREFIX*,#SEGNO,*SUFFIX*
PREFIX!SEGNO!SUFFIX
TERMIN

DEFINE .MSEG ARGS/
MS%NS==1
MS%O0==0
MS%L0==.
IRP ARG,,[ARGS]
MS%AS /MS%O/,MS%NS,/==ARG/
MS%AS /MS%L/,MS%NS,/==.+ARG/
MS%AS /.KILL MS%O/,MS%NS
MS%AS /.KILL MS%L/,MS%NS
MS%NS==MS%NS+1
TERMIN
MS%CS==0
TERMIN

DEFINE .SEG N
IFN N-MS%CS,[
MS%AS /MS%L/,MS%CS,/==./
MS%CS==N
MS%AS /LOC MS%L/,MS%CS
]
TERMIN

EQUALS MS%END END
EXPUNGE END
DEFINE END ENDLOC
MS%AS /MS%L/,MS%CS,/==./
EQUALS END MS%END
END ENDLOC
TERMIN
]

IF2,[
WORD <24._25.>+<MS%NS_18.>
MS%CS==0
REPEAT MS%NS,[
MS%AS /MS%TMP==.ABSP MS%L/,MS%CS,
MS%AS /MS%TMP==MS%TMP-MS%O/,MS%CS
MS%AS /WORD <MS%TMP,,MS%O/,MS%CS,/>/
MS%CS==MS%CS+1
]
WORD 0 ; CHECKSUM
MS%CS==0

.KILL MS%NS,MS%CS,MS%TMP,MS%L0,MS%O0
]