[gnu.g++.bug] COFF encapsulation vs ld -A

eirik@labs.labs.tek.com (Eirik Fuller) (11/19/89)

With the enclosed patches I can run libg++/tests/test0 to successful
completion on a sun386 with g++ using COFF encapsulation.  Your line
numbers will probably be different; I started with ld.c from
g++-1.36.1, but I added patches for 68020 UTek (tek4300).

I have also run all of the other tests in libg++/tests/ through sun386
g++; only tRandom generates output different from what a sparc
generates; apparently tRandom's results are machine-dependent.  My
recent postings to bug-gnu-utils and bug-gcc (gnu.utils.bug and
gnu.gcc.bug) contain most of what is necessary to build COFF
encapsulation g++ on a sun386, beyond the relevant GNU sources.


*** ld.c~	Tue Nov  7 13:58:42 1989
--- ld.c	Sun Nov 19 02:41:07 1989
***************
*** 1022,1028 ****
  
    text_size = sizeof (struct exec);
  #ifdef COFF_ENCAPSULATE
!   if (relocatable_output == 0)
      {
        need_coff_header = 1;
        /* set this flag now, since it will change the values of N_TXTOFF, etc */
--- 1022,1028 ----
  
    text_size = sizeof (struct exec);
  #ifdef COFF_ENCAPSULATE
!   if (relocatable_output == 0 && file_table[0].just_syms_flag == 0)
      {
        need_coff_header = 1;
        /* set this flag now, since it will change the values of N_TXTOFF, etc */
***************
*** 1644,1649 ****
--- 1644,1653 ----
    struct exec *loc = (struct exec *) &entry->header;
  
    lseek (desc, entry->starting_offset, 0);
+ #ifdef COFF_ENCAPSULATE
+   if (entry->just_syms_flag)
+     lseek (desc, sizeof(coffheader), 1);
+ #endif
    len = read (desc, loc, sizeof (struct exec));
    if (len != sizeof (struct exec))
      fatal_with_file ("failure reading header of ", entry);
***************
*** 1753,1758 ****
--- 1757,1767 ----
    struct exec hdr;
  
    desc = file_open (entry);
+ 
+ #ifdef COFF_ENCAPSULATE
+   if (entry->just_syms_flag)
+     lseek (desc, sizeof(coffheader),0);
+ #endif
  
    len = read (desc, &hdr, sizeof hdr);
    if (len != sizeof hdr)