[gnu.g++.bug] fixes to ld.c needed for hp-ux

glenne%hplsla@HPLABS.HP.COM (Glenn Engel) (10/13/88)

The following diffs add support to ld.c distributed with the g++1.27.0
distribution for the hp9000s300 machines.  I hope these can be integrated
with future releases.

Thanks,

--
 |  Glenn R. Engel
 |  Hewlett-Packard 
 |  (206) 335-2066
 |  glenne%hplsla@hplabs.hp.com


*** ../../dist/src-g++/ld.c	Tue Sep  6 04:46:29 1988
--- ld.c	Wed Oct 12 20:10:12 1988
***************
*** 146,151
  
  #define min(a,b) ((a) < (b) ? (a) : (b))
  
  #ifdef sun
  #if TARGET == SUN4
  #define relocation_info reloc_info_sparc

--- 146,155 -----
  
  #define min(a,b) ((a) < (b) ? (a) : (b))
  
+ #ifdef hp9000s300
+ #define getpagesize() EXEC_PAGESIZE
+ #endif
+ 
  #ifdef sun
  #if TARGET == SUN4
  #define relocation_info reloc_info_sparc
***************
*** 439,444
  #endif
  
  /* Standard directories to search for files specified by -l.  */
  char *standard_search_dirs[] = {"/lib", "/usr/lib", "/usr/local/lib",
  DEFAULT_SEARCH_PREFIX};
  

--- 443,452 -----
  #endif
  
  /* Standard directories to search for files specified by -l.  */
+ #ifdef hp9000s300
+   /* hp-ux has special path since it's a.out format is not the same as gnu */
+ char *standard_search_dirs[] = {"/usr/local/lib/gnu",DEFAULT_SEARCH_PREFIX};
+ #else
  char *standard_search_dirs[] = {"/lib", "/usr/lib", "/usr/local/lib",
  DEFAULT_SEARCH_PREFIX};
  #endif
***************
*** 441,446
  /* Standard directories to search for files specified by -l.  */
  char *standard_search_dirs[] = {"/lib", "/usr/lib", "/usr/local/lib",
  DEFAULT_SEARCH_PREFIX};
  
  /* Actual vector of directories to search;
     this contains those specified with -L plus the standard ones.  */

--- 449,455 -----
  #else
  char *standard_search_dirs[] = {"/lib", "/usr/lib", "/usr/local/lib",
  DEFAULT_SEARCH_PREFIX};
+ #endif
  
  /* Actual vector of directories to search;
     this contains those specified with -L plus the standard ones.  */
***************
*** 565,570
  #endif
  #endif
  
    /* Initialize the data about options.  */
  
    specified_data_size = 0;

--- 574,583 -----
  #endif
  #endif
  
+ #ifdef hp9000s300
+   outheader.a_machtype = HP9000S200_ID;
+ #endif
+ 
    /* Initialize the data about options.  */
  
    specified_data_size = 0;
***************
*** 577,582
    force_common_definition = 0;
    T_flag_specified = 0;
    magic = ZMAGIC;
    make_executable = 1;
  
    /* Initialize the cumulative counts of symbols.  */

--- 590,598 -----
    force_common_definition = 0;
    T_flag_specified = 0;
    magic = ZMAGIC;
+   #ifdef hp9000s300
+     magic = NMAGIC;  /* hp-ux bug screws ZMAGIC */
+   #endif
    make_executable = 1;
  
    /* Initialize the cumulative counts of symbols.  */
***************
*** 1827,1832
    header->a_machtype = M_SPARC;
  #endif
  #endif
    header->a_magic = OMAGIC;
    header->a_text = this_text_size;
    header->a_data = this_data_size;

--- 1843,1852 -----
    header->a_machtype = M_SPARC;
  #endif
  #endif
+ 
+ #ifdef hp9000s300
+   header->a_machtype = HP9000S200_ID;
+ #endif 
    header->a_magic = OMAGIC;
    header->a_text = this_text_size;
    header->a_data = this_data_size;
***************
*** 2422,2427
  #if TARGET == SUN2
    outheader.a_machtype = M_68010;
  #endif
  #endif
    outheader.a_text = text_size;
    outheader.a_data = data_size;

--- 2442,2450 -----
  #if TARGET == SUN2
    outheader.a_machtype = M_68010;
  #endif
+ #endif
+ #ifdef hp9000s300
+   outheader.a_machtype = HP9000S200_ID;
  #endif
    outheader.a_text = text_size;
    outheader.a_data = data_size;