|
|
coherent
/usr/src/ld/Changes 1/25/90
Thu Jan 25 15:26:27 1990 PST
pass2.c
Executables built by the Inetco loader fail with a segmentation
violation when one of the linked objects ends with an odd-sized
segment. Because relocation and symbol segments follow the
code and data segments, this happens only when a module contains
no external symbols and defines an odd-sized last segment.
For the source foo.c module containing the single line
static char c[] = "12";
cc creates an object foo.o with PRVD segment of size 4 (not 3),
but it writes only the 3 data bytes '1', '2', '\0' to it.
Since no BSS, symbol or relocation segments follow, the object ends
after the '\0'. Similary for a source
static f() { int i; i++ }
which creates a PRVI segment of length 16 with 15 data bytes.
This bug could be fixed either in the compiler output writer
n2/i8086/outcoh.c or in the loader. I choose the latter approach,
changing the code which copies segments in pass2.c. In the process,
I made the code vastly more efficient.
Makefile
In CFLAGS, changed -DBREADBOX=$BREADBOX to -DBREADBOX=$(BREADBOX).
The old version was a mistake which produced -DBREADBOX=READBOX
during compilations rather than -DBREADBOX=16384.
Thu Mar 29 10:35:01 1990 PST
main.c
Removed RCS statics (including Inetco copyright) and recompiled.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.