- Ofile->o_flags = flags;
- Ofile->o_image = ptr;
- Ofile->isArchiveFile = 0;
-
- // 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) && wflag)
- {
- 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;
+ Ofile->o_flags = obj->o_flags;
+ Ofile->o_image = obj->o_image;
+ Ofile->isArchiveFile = obj->isArchiveFile;
+ Ofile->segSize[TEXT] = obj->segSize[TEXT];
+ Ofile->segSize[DATA] = obj->segSize[DATA];
+ Ofile->segSize[BSS] = obj->segSize[BSS];
+ char * ptr = obj->o_image;
+
+ 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 (??? isn't this already done ???)
+ Ofile->o_header.bsize = (Ofile->o_header.bsize + secalign) & ~secalign;
+
+ if ((Ofile->o_header.dsize & 7) && wflag)
+ {
+ printf("Warning: data segment size of ");
+ WriteARName(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 ");
+ WriteARName(Ofile);
+ printf("; link aborted.\n");
+ return 1;