+ // Starting after all pathnames, etc., copy .o file name to Ofile
+ temp = path_tail(fname);
+
+ // Check filename length
+ if (strlen(temp) > FNLEN - 1)
+ {
+ printf("File name too long: %s\n", temp);
+ return 1;
+ }
+
+ // Check archive name length
+ if (strlen(aname) > FNLEN - 1)
+ {
+ printf("Archive name too long: %s\n", aname);
+ return 1;
+ }
+
+ strcpy(Ofile->o_name, temp); // Store filename
+ strcpy(Ofile->o_arname, aname); // Store archive name
+
+ Ofile->o_next = NULL; // Initialise object record information
+ Ofile->o_tbase = 0;
+ Ofile->o_dbase = 0;
+ Ofile->o_bbase = 0;
+ Ofile->o_flags = flags;
+ Ofile->o_image = ptr;
+
+ // Don't do anything if this is just an ARCHIVE marker, just add the file to the olist
+ if (!(flags & O_ARCHIVE))
+ {
+ Ofile->o_header.magic = getlong(ptr);
+ Ofile->o_header.tsize = getlong(ptr+4);
+ Ofile->o_header.dsize = getlong(ptr+8);
+ Ofile->o_header.bsize = getlong(ptr+12);
+ Ofile->o_header.ssize = getlong(ptr+16);
+ Ofile->o_header.absrel.reloc.tsize = getlong(ptr+24);
+ Ofile->o_header.absrel.reloc.dsize = getlong(ptr+28);
+
+ // Round BSS off to alignment boundary
+ Ofile->o_header.bsize = (Ofile->o_header.bsize + secalign) & ~secalign;
+
+ if (Ofile->o_header.dsize & 7)
+ {
+ printf("Warning: data segment size of ");
+ put_name(Ofile);
+ printf(" is not a phrase multiple\n");
+ }
+
+ // Check for odd segment sizes
+ if ((Ofile->o_header.tsize & 1) || (Ofile->o_header.dsize & 1)
+ || (Ofile->o_header.bsize & 1))
+ {
+ printf("Error: odd-sized segment in ");
+ put_name(Ofile);
+ printf("; link aborted.\n");
+ return 1;
+ }
+
+ if (add_symbols(Ofile))
+ return 1;
+ }