Skip to content

Cross-linker, porting PDP-11 LINK to C/C++, WIP 🚧

License

Notifications You must be signed in to change notification settings

nzeemin/pclink11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pclink11

License: LGPL v3 Build status Build Status CodeFactor

Attempt to port PDP-11 LINKer to PC C/C++ — learning how the linker works, the hard way.

The code (partially) ported from MACRO-11 sources to C/C++. Port source: RT-11 LINK V05.45.

Authors

  • Nikita Zimin (@nzeemin)
  • Vladimir Voroshilov (@voroshil)

Status: Work in Progress 🚧

Currently the PCLINK11 links most of test OBJ files properly, but we have some troubles linking tests with libraries.

Usage

The source code is able to compile under Windows (VS2013/VS2015), and also under Linux/MacOS (gcc/clang, use the Makefile).

Command line:

pclink11 <input files and options>

Options (both / and - prefixes are allowed):

  • -EXECUTE:filespec — Specifies the name of the memory image file
  • -NOBITMAP -X — Do not emit bit map
  • -WIDE -W — Produces a load map that is 132-columns wide
  • -ALPHABETIZE -A — Lists global symbols on the link map in alphabetical order
  • -SYMBOLTABLE -STB — Generates a symbol table file (.STB file)
  • -MAP — Generates map file
  • -FORLIB -F — Include FORLIB.OBJ
  • -Q:section=address — Set section to absolute address
  • --version — Show the program version information
  • --help — Show quick help on the command line options

Input files and options are space-separated.

Examples:

  • pclink11 HELLO.OBJ — link the object file, will produce HELLO.SAV executable
  • pclink11 -MAP -SYMBOLTABLE -EXECUTE:LD.SYS LD.OBJ SYSLIB.OBJ -X — link object file with system library, produce map file and symbol file, save output as LD.SYS, do not put bitmap in the first block
  • pclink11 TEST1.OBJ TEST2.OBJ -MAP -WIDE -A — link two object files, generate map file with wide format, alphabetize list of symbols

Testing Strategy

Folder tests contains more than 100 sub-folders with .OBJ files.

First, we use RT-11 simulator written by Dmitry Patronov to produce "etalon" or "original" output files, they renamed with -11 suffix — see !runtest11.cmd command file. Then, we run the pclink11 with to produce "our" output files, they renamed with -my suffix — see !runtestmy.cmd command file and testrunner utility. And finally, we compare "original" files with "our" files, line-to-line or byte-to-byte, using testanalyzer utility.

"Our" MAP files differs in the first line (program name, date/time, no page number), and there's no paging, so no page header lines. SAV/SYS/REL and STB files are binary, compared byte-to-byte, should be no differences. Log files are absolutely different, we're not comparing them, but in "our" log files we're looking for "SUCCESS"/"ERROR" and so on.

TODO

First priority:

  • Fix bugs for the failing test cases

Second priority:

  • Need more tests, currently we have 120 test cases
  • Reduce amount of logging, add option for verbosity level
  • Process other command-line options, including file-specific ones

Not implemented now, and not sure we will:

  • Link for foreground execution with -R or -FOREGROUND option, produce .REL file
  • LDA output — produce a file in absolute binary loader format (option -L)
  • Overlays
  • Linkage with separated instructions/data spaces

Links

Releases

No releases published