The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Re: Origins of the SGS (System Generation Software) and COFF (Common Object File Format)
@ 2023-02-26 15:51 Paul Winalski
  0 siblings, 0 replies; 23+ messages in thread
From: Paul Winalski @ 2023-02-26 15:51 UTC (permalink / raw)
  To: TUHS

On 2/25/23, Brian Walden <tuhs@cuzuco.com> wrote:
> It was originaly 205. See A.OUT(V) (the first page) at
> https://www.bell-labs.com/usr/dmr/www/man51.pdf it was documented as to
> why.
>
>
>      The header always contains 6 words:
>           1 "br .+14" instruction (205(8))
>           2 The size of the program text
>           3 The size of the symbol table
>           4 The size of the relocation bits area
>           5 The size of a data area
>           6 A zero word (unused at present)
>
> I always found this so elegant in it's simplicity. Just load and start
> execution at the start (simplifies exec(2) in the kernel) I always wondered
> if this has done anywhere else before, or invenetd first in unix.

IBM's Basic Program Support (BPS) for System/360 was a set of
stand-alone utilities for developing and running stand-alone programs.
BPS/360 wasn't really an operating system because there wasn't any
resident kernel.  You just IPLed (Initial Program Load; IBM-speak for
"boot") your application directly.  So the executable format for BPS
had a bootstrap loader as the "program header".  Not quite the same
thing as a.out's 205(8) magic number, but similar in concept.

I don't know of any other OS ABI that uses this trick to transfer
control to application programs.

Microsoft uses something similar in PECOFF.  A PECOFF executable for
x86 or X86-64 starts with a bit of code in MS-DOS MZ executable format
that prints the message "This program cannot be run in DOS mode".

-Paul W.

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [TUHS] Re: Origins of the SGS (System Generation Software) and COFF (Common Object File Format)
@ 2023-02-25 20:14 Brian Walden
  0 siblings, 0 replies; 23+ messages in thread
From: Brian Walden @ 2023-02-25 20:14 UTC (permalink / raw)
  To: tuhs

It was originaly 205. See A.OUT(V) (the first page) at https://www.bell-labs.com/usr/dmr/www/man51.pdf it was documented as to why.


     The header always contains 6 words:
          1 "br .+14" instruction (205(8))
          2 The size of the program text
          3 The size of the symbol table
          4 The size of the relocation bits area
          5 The size of a data area
          6 A zero word (unused at present)

I always found this so elegant in it's simplicity. Just load and start
execution at the start (simplifies exec(2) in the kernel) I always wondered
if this has done anywhere else before, or invenetd first in unix.

Theres was also a recent discussion of ar(1). That pdf also explains its magic
number a few pages later. It was simply choosen because it seemed unique.

     A file produced by ar has a "magic number" at the start,
     followed by the constituent files, each preceded by a file
     header. The magic number is -147(10), or 177555(8) (it was
     chosen to be unlikely to occur anywhere else).

-Brian

On Sat, 25 Feb 2023, Dave Horsfall wrote:

> On Thu, 23 Feb 2023, Paul Winalski wrote:
>
> > a.out was, as object file formats go, a throwback to the stone age from
> > the get-go.  Even the most primitive of IBM's link editors for
> > System/360 supported arbitrary naming of object file sections and the
> > ability for the programmer to arrange them in whatever order they
> > wished.  a.out's restriction to three sections (.text, .data, .bss) did
> > manage to get the job done, and even (with ZMAGIC) could support
> > demand-paged virtual memory, but only just.
>
> That may be so, but those guys didn't exactly have the resources of
> IBM behind them...
>
> And I wonder how many people here know the significance of the "407" magic
> number?
>
> -- Dave

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [TUHS] Re: Origins of the SGS (System Generation Software)  and COFF (Common Object File Format)
@ 2023-02-23 21:37 Paul Ruizendaal
  2023-02-23 22:11 ` segaloco via TUHS
  0 siblings, 1 reply; 23+ messages in thread
From: Paul Ruizendaal @ 2023-02-23 21:37 UTC (permalink / raw)
  To: tuhs


> Date: Thu, 23 Feb 2023 18:38:25 +0000
> Subject: [TUHS] Re: Origins of the SGS (System Generation Software)
> 	and COFF (Common Object File Format)
> 
> For the sake of timelines:
> 
> June 1980 - Publication date on the front page of the 3.0 manual in which the utilities are still very much research for PDP-11 and 32V-ish for VAX where distinctions matter.
> 
> June 1981 - Publication date on the front page of the 4.1 manual in which the man-pages very much refer to all of this as the "3B-20 object format"
> 
> June 1982 - Publication date on the front page of the 5.0 manual by which point these same pages had been edited and extended to describe the "common object file format"
> 
> Additions at the 1981 release include dump(1), list(1), and the ld-prefixed library routines for managing these object files.  These likewise persist in 5.0, SysV, and beyond as COFF-related tools.
> 
> So this puts the backstop of what would become COFF at at least '81.
> 
> - Matt G.


The surviving source code for SysV R2 supports this timeline:
- The header files (start from https://github.com/ryanwoodsmall/oldsysv/blob/master/sysvr2-vax/src/head/a.out.h) have dates of late ’82, early ’83.
- The source for exec() has a comment that refers to the 4xx magic formats as “pre 5.0 stuff”.
- The COFF format headers are #ifdef’ed for the 3B series.

Interestingly, the lowest magic numbers in the 5xx series are not for the 3B, but for the “Basic-16” and for the “x86”. That led me to this paper:

https://www.bell-labs.com/usr/dmr/www/otherports/newp.pdf

It seems that the roots of COFF go back to the initial portability effort for V7 and in particular the 8086 port (which was done in 1978 according to the paper).



^ permalink raw reply	[flat|nested] 23+ messages in thread
* [TUHS] Re: Origins of the SGS (System Generation Software) and COFF (Common Object File Format)
@ 2023-02-23 15:13 Noel Chiappa
  0 siblings, 0 replies; 23+ messages in thread
From: Noel Chiappa @ 2023-02-23 15:13 UTC (permalink / raw)
  To: tuhs; +Cc: jnc

    > From: Clem Cole

    > MIT had a modified a.out format for the NU machine ports - that might
    > have been called b.out.

Yes. Here's the man page output:

  http://ana-3.lcs.mit.edu/~jnc/tech/unix/help/b.out.lpt

(I don't have the source for that, alas.) It's basically just a.out with
32-bit fields instead of 16-bit. I have a .h file for the format too, if
anyone has any interest in it. It's all part of the MIT 68K workbench that
used PCC (the source for all of which I do have).

	 Noel

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [TUHS] Origins of the SGS (System Generation Software) and COFF (Common Object File Format)
@ 2023-02-22 20:16 segaloco via TUHS
  2023-02-22 22:20 ` [TUHS] " Clem Cole
  0 siblings, 1 reply; 23+ messages in thread
From: segaloco via TUHS @ 2023-02-22 20:16 UTC (permalink / raw)
  To: The Eunuchs Hysterical Society

[-- Attachment #1: Type: text/plain, Size: 4711 bytes --]

Good day all, figured I'd start a thread on this matter as I'm starting to piece enough together to articulate the questions arising in my research.

So based on my analysis of the 3B20S UNIX 4.1 manual I've been working through, all evidence points to the formalized SGS package and COFF originating tightly coupled to the 3B-20 line, then growing legs to support VAX, but never quite absorbing PDP-11 in entirety. That said, there are bits and pieces of the manual pages for the object format libraries that suggest there was some providence for PDP-11 in the development of COFF as well.

Where this has landed though is a growing curiosity regarding:

- Whether SGS and COFF were tightly coupled to one another from the outset, with SGS being supported by the general library routines being developed for the COFF format
- Whether COFF was envisioned as a one-size-fits-all object format from its inception or started as an experiment in 3B-20 development that wound up being general enough for other platforms

- If, prior to this format, there were any other efforts to produce a unifying binary format and set of development tools, or if COFF was a happy accident from what were a myriad of different architectural toolset streams

One of the curious things is how VAX for a brief moment did have its own set of tools and a.out particulars before SGS/COFF. For instance, many of the VAX-targeted utilities in 3.0/System III bear little in common option/manual-wise with the general common SGS utilities in System V. The "not on PDP-11" pages for various SGS components in System V much more closely resemble the 3B-20 utilities in 4.1 than any of the non PDP-11/VAX-only bits in System III.

Some examples:

- The VAX assembler in System III contains a -dN option indicating the number of bytes to set aside for forward/external references for the linker to fill in.
- The VAX assembler in System V contains among others the -n and -m options from 4.1 which indicate to disable address optimization and use m4 respectively
- The System V assembler goes on to also include -R (remove input file after completion) -r (VAX only, add .data contents to .text instead) and options -b, -w, and -l to replace the -d1, -d2, and -d4 options indicated in the previous VAX assembler
- System V further adds a -V to all the SGS software indicating the version of the software. This is new circa 5.0, absent from the 4.1 manual like the R, r, b, w, and l options

- The 4.1 manual's singular ar(1) entry still agrees with the System III version. No arcv(1) is listed, implying the old ar format never made it to 3B-20
- The System V manual has both this ar(1) version as well as the new COFF-supporting version. Not sure if this implies the VAX ar format was expanded to support the COFF stuff for a little while until they decided on a new one or what.

- The System III ld (which is implied to support PDP and VAX) survives in System V, but is cut down to supporting PDP-11 only
- The COFF-ish ld shows up in 4.1, is then extended to VAX presumably in the same breath as the other COFF-supporting bits by Sys V, leading to two copies like many others, PDP-11-specific stuff and then COFF-specific stuff

The picture that starts to form in the context of all of this is, for a little while in the late 70s/early 80s, the software development environments for PDP-11, VAX-11, and 3B-20 were interplaying with each other in often times inconsistent ways. Taking a peek at the 32V manuals, the VAX tools in System III appear to originate with that project, which makes sense. If I'm understanding the timeline, COFF starts to emerge from the 3B-20 project and USG probably decides that's the way to go, a unified format, but with PDP-11 pretty much out the door support wise already, there was little reason to apply that to PDP-11 as well, so the PDP-11 tools get their swan song in System V, original VAX-11 tools from 32V are likely killed off in 4.x, and the stuff that started with the 3B-20 group goes on to dominate the object file format and development software stuff until ELF comes along some time later.

I guess other questions this raises are:

- Were the original VAX tools built with any attention to compatibility with the PDP-11 bits Ken and Dennis wrote many years prior (based on some option discrepancies, possibly not?)
- Do the VAX utilities derive from the Interdata 8/32 work or if there was actually another stream of tools as part of that project?
- Was there any interplay between the existing tool streams (original PDP-11, 32V's VAX utilities, possibly Interdata 8/32) and the eventual COFF/SGS stuff, or was the latter pretty well siloed in 3B-20 land until deployment with 4.1?

- Matt G.

[-- Attachment #2: Type: text/html, Size: 6440 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-02-26 15:51 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-26 15:51 [TUHS] Re: Origins of the SGS (System Generation Software) and COFF (Common Object File Format) Paul Winalski
  -- strict thread matches above, loose matches on Subject: below --
2023-02-25 20:14 Brian Walden
2023-02-23 21:37 Paul Ruizendaal
2023-02-23 22:11 ` segaloco via TUHS
2023-02-24  0:07   ` segaloco via TUHS
2023-02-23 15:13 Noel Chiappa
2023-02-22 20:16 [TUHS] " segaloco via TUHS
2023-02-22 22:20 ` [TUHS] " Clem Cole
2023-02-23  0:17   ` segaloco via TUHS
2023-02-23  6:30   ` Lars Brinkhoff
2023-02-23 14:25     ` KenUnix
2023-02-23 19:37     ` Warner Losh
2023-02-24 17:01       ` Rich Salz
2023-02-23 16:49   ` Paul Winalski
2023-02-23 18:38     ` segaloco via TUHS
2023-02-23 20:40       ` Paul Winalski
2023-02-24 12:45     ` arnold
2023-02-24 13:13       ` Arno Griffioen via TUHS
2023-02-25 19:28         ` arnold
2023-02-25 19:34           ` Steffen Nurpmeso
2023-02-24 14:01       ` Harald Arnesen
2023-02-25  2:07     ` Dave Horsfall
2023-02-25 15:30       ` Clem Cole
2023-02-25 17:29         ` Paul Winalski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).