[comp.unix.i386] Patches for GNU G++ 1.37.1 collect on SCO Unix 3.2

chip@tct.uucp (Chip Salzenberg) (08/07/90)

These changes allow G++ 1.37.1 "collect" to work with the SCO Unix
assembler.  The primary change is that the ".text" section number
is two instead of one.

In addition, this patch implements a feature that collect is supposed
to have:  Destructors are now called in reverse order of constructors.

Index: collect.c
***************
*** 315,320 ****
      }
      else {
!       new->next = dtor_chain;
!       dtor_chain = new;
        dtor_chain_length++;
      }
--- 315,328 ----
      }
      else {
!       new -> next = NULL;
!       if ( dtor_chain == NULL )
! 	dtor_chain = new;
!       else {
! 	struct ctor_dtor_list_elem *last = dtor_chain;
! 
! 	while ( last -> next )
! 	  last = last -> next;
! 	last -> next = new;
!       }
        dtor_chain_length++;
      }
***************
*** 356,360 ****
      }
    ASM_OUTPUT_INT_CONST (outfile, 0);
-   ASM_OUTPUT_INT_CONST (outfile, 0);
  
    fclose (outfile);
--- 364,367 ----
***************
*** 382,385 ****
--- 389,400 ----
  #endif
  
+ #ifndef TEXT_SECTION
+ # ifdef M_UNIX
+ #  define TEXT_SECTION 2
+ # else
+ #  define TEXT_SECTION 1
+ # endif
+ #endif
+ 
  #if defined(EXTENDED_COFF)
  #   define GCC_SYMBOLS(X) (SYMHEADER(X).isymMax+SYMHEADER(X).iextMax)
***************
*** 393,397 ****
  #   define GCC_OK_SYMBOL(X) (!(((X).n_type & N_TMASK) != (DT_NON << N_BTSHFT)))
  #else
! #   define GCC_OK_SYMBOL(X) ((X).n_scnum == 1 && (X).n_sclass == C_EXT)
  #endif
  #   define GCC_SYMINC(X) ((X).n_numaux+1)
--- 408,413 ----
  #   define GCC_OK_SYMBOL(X) (!(((X).n_type & N_TMASK) != (DT_NON << N_BTSHFT)))
  #else
! #   define GCC_OK_SYMBOL(X) \
! 	((X).n_scnum == TEXT_SECTION && (X).n_sclass == C_EXT)
  #endif
  #   define GCC_SYMINC(X) ((X).n_numaux+1)
-- 
Chip Salzenberg at ComDev/TCT     <chip@tct.uucp>, <uunet!ateng!tct!chip>