OMF records (Developers)
Oberon/M (direct link) 1.2 for DOS is an old 16-bit Oberon-1 compiler circa 1991. So old, in fact, that it was expected to be used with MS LINK, which at the time (MS-DOS 4.0?) came bundled with the OS. Unfortunately, it uses at least one problematic ("obsolete") OMF .OBJ record in its output: REGINT. This chokes most linkers. For various obscure reasons, I very very lightly decided to look into the matter.
If you read ftp://ftp.openwatcom.org/devel/docs/omf.pdf , you will see that the "official" (?) standard for OMF was later defined by TIS circa early '90s to be version 1.1, and it explicitly mentions how some OMF records have changed or been obsoleted. Which is annoying as this compiler requires such an old linker. Actually, I think MS LINK just ignores the REGINT record (which begs the obvious question, "why did the author bother then??").
I'm honestly not sure what 16-bit object formats exist. I think OpenWatcom uses OMF probably because of its segmentation support, which (AFAIK) other formats (ELF, COFF) don't support. It's a bit complex and seemingly designed for quick two-pass handling in minimal memory. If someone were to write a compiler today, I'm not sure OMF would be ideal, even with the 32-bit extensions. Perhaps a homebrew format would be simpler, dunno, but that may be wishful thinking.
Anyways, as I said, the "Main" .OBJ of a project from Oberon/M is generated with a REGINT record right before the (mandatory) MODEND, which ends the file. This chokes most linkers (except for a very few, which I don't rely upon for various minor reasons). Yesterday I whipped up a quick patch in .C (presumably portable in case of cross-compilation or patching or whatever). It seems to work, though I didn't too heavily test it.
If anybody cares, some simple feedback would be welcome as it's kinda a confusing subject.
/* HACKOMF.C -- util to patch old Oberon/M .OBJ output for some linkers */
#include <stdio.h>
#include <stdlib.h>
enum omf {
REGINT=0x70, /* obsolete, unsupported record to patch out */
MAINOBJ=0x80, /* if main object file for program */
MODEND=0x8A, /* always last OMF record */
COMENT=0x88 /* replace with a harmless comment */
};
int main(int argc, char** argv) {
int rc=EXIT_FAILURE, count=0;
FILE* fp;
unsigned char buf[32];
if (argc > 1) {
fp = fopen(argv[1],"rb+");
if (fp == NULL) {
fprintf(stderr,"\nCouldn't open %s !\n",argv[1]);
}
else {
fseek(fp,-5L,SEEK_END);
fread(buf,1,5,fp);
if ((buf[0] == MODEND) && (buf[3] & MAINOBJ)) {
fseek(fp,-21L,SEEK_END);
fread(buf,1,21,fp);
printf("'0x%02X' should be 0x%02X (REGINT)\n",buf[0],REGINT);
if (buf[0] == REGINT) {
buf[0] = COMENT;
for (count=3; count < 15; count++) buf[count] = ' ';
buf[15] = '\0'; /* empty chksum */
fseek(fp,-21L,SEEK_END);
fflush(fp);
if (fwrite(buf,1,21,fp) == 21) {
fflush(fp);
printf("...patching...\n");
rc=EXIT_SUCCESS;
}
else fprintf(stderr,"\nOops! Couldn't write file.\n");
}
else fprintf(stderr,"\nREGINT OMF record not found.\n");
}
else fprintf(stderr,"\nWrong OBJ detected (or already done).\n");
fclose(fp);
}
}
else fprintf(stderr,"\nNo .OBJ specified!\n");
return rc;
}
/* EOF */
Complete thread:
- OMF records - Rugxulo, 15.02.2012, 16:14 (Developers)
- Just some research about the name "E. R. Videki" - rr, 15.02.2012, 21:09
- Just some research about the name "E. R. Videki" - Arjay, 15.02.2012, 22:08
- Just some research about the name "E. R. Videki" - Rugxulo, 15.02.2012, 23:19
- Just some research about the name "E. R. Videki" - Arjay, 16.02.2012, 00:47
- Just some research about the name "E. R. Videki" - Rugxulo, 15.02.2012, 23:19
- Just some research about the name "E. R. Videki" - Arjay, 15.02.2012, 22:08
- OMF records - Arjay, 15.02.2012, 22:36
- OMF records - Rugxulo, 15.02.2012, 23:29
- OMF records - Arjay, 16.02.2012, 01:09
- OMF records - Rugxulo, 16.02.2012, 08:00
- OMF records - rr, 16.02.2012, 09:51
- OMF records - Arjay, 16.02.2012, 21:37
- OMF records - marcov, 18.02.2012, 17:16
- OMF records - Rugxulo, 18.02.2012, 17:32
- OMF records - Rugxulo, 18.02.2012, 17:54
- OMF records - marcov, 19.02.2012, 16:47
- OMF records - RayeR, 19.02.2012, 17:19
- OMF records - marcov, 20.02.2012, 10:33
- OMF records - Rugxulo, 19.02.2012, 21:33
- OMF records - marcov, 20.02.2012, 18:23
- OMF records - RayeR, 19.02.2012, 17:19
- OMF records - marcov, 19.02.2012, 16:47
- OMF records - marcov, 19.02.2012, 16:43
- OMF records - Rugxulo, 19.02.2012, 21:15
- OMF records - marcov, 20.02.2012, 10:54
- OMF records - Rugxulo, 20.02.2012, 17:50
- OMF records - marcov, 20.02.2012, 18:54
- OMF records - Rugxulo, 20.02.2012, 20:09
- OMF records - marcov, 20.02.2012, 18:54
- OMF records - Rugxulo, 20.02.2012, 17:50
- OMF records - marcov, 20.02.2012, 10:54
- OMF records - Rugxulo, 19.02.2012, 21:15
- OMF records - Rugxulo, 18.02.2012, 17:54
- OMF records - Rugxulo, 18.02.2012, 17:32
- OMF records - rr, 16.02.2012, 09:51
- OMF records - Rugxulo, 16.02.2012, 08:00
- OMF records - Arjay, 16.02.2012, 01:09
- OMF records - Rugxulo, 15.02.2012, 23:29
- OMF records - Japheth, 16.02.2012, 18:08
- OMF records - Rugxulo, 16.02.2012, 19:48
- OMF records - Arjay, 16.02.2012, 21:27
- OMF records - Arjay, 16.02.2012, 21:52
- OMF records - Rugxulo, 16.02.2012, 23:09
- OMF records - Arjay, 16.02.2012, 21:52
- OMF records - Arjay, 16.02.2012, 21:27
- OMF records - Rugxulo, 17.02.2012, 02:15
- OMF records - Japheth, 17.02.2012, 08:08
- OMF records - Rugxulo, 17.02.2012, 20:21
- OMF records - Japheth, 18.02.2012, 09:05
- OMF records - Rugxulo, 18.02.2012, 16:39
- OMF records - Japheth, 18.02.2012, 17:55
- jwlinkd updated - Japheth, 20.02.2012, 14:31
- Oberon subtyping (was: JWlinkD updated) - Rugxulo, 20.02.2012, 20:14
- BEFI 3H (Oberon-M fully supported) - Rugxulo, 06.03.2012, 23:30
- Oberon subtyping (was: JWlinkD updated) - Rugxulo, 20.02.2012, 20:14
- jwlinkd updated - Japheth, 20.02.2012, 14:31
- OMF records - Japheth, 18.02.2012, 17:55
- OMF records - Rugxulo, 18.02.2012, 16:39
- OMF records - processing SYS.OBJ with tdstrip - Arjay, 18.02.2012, 14:22
- OMF records - processing SYS.OBJ with tdstrip - Arjay, 18.02.2012, 15:47
- OMF records - processing SYS.OBJ with tdstrip - Rugxulo, 18.02.2012, 17:12
- OMF records - processing SYS.OBJ with tdstrip - Rugxulo, 18.02.2012, 16:56
- OMF records - processing SYS.OBJ with tdstrip - Arjay, 19.02.2012, 10:16
- OMF records - processing SYS.OBJ with tdstrip - Rugxulo, 19.02.2012, 17:58
- OMF records - processing SYS.OBJ with tdstrip - Arjay, 19.02.2012, 10:16
- OMF records - processing SYS.OBJ with tdstrip - Arjay, 18.02.2012, 15:47
- OMF records - Japheth, 18.02.2012, 09:05
- OMF records - Rugxulo, 17.02.2012, 20:21
- OMF records - Japheth, 17.02.2012, 08:08
- OMF records - Rugxulo, 16.02.2012, 19:48
- Oberon 1.2 OC (compiler) patch - Arjay, 18.02.2012, 23:37
- Oberon/M 1.2 (OMF output) ... die, REGINT, die! - Rugxulo, 19.02.2012, 00:54
- Oberon/M 1.2 (OMF output) ... die, REGINT, die! - Arjay, 19.02.2012, 10:05
- Oberon/M 1.2 (OMF output) ... die, REGINT, die! - Rugxulo, 19.02.2012, 00:54
- Just some research about the name "E. R. Videki" - rr, 15.02.2012, 21:09