[comp.sys.ibm.pc.rt] Patch for /usr/src/bin/ld.c

brunner@bullhead.uucp (08/09/89)

Subject: Fix for ld(1) stabs relocation error
Index: /usr/src/bin/ld.c

Description:
	correct relocation error on stabs for functions

Fix:
	Apply the following patch

*** ld.c	Tue Aug  8 14:16:03 1989
--- ld.c.fix	Tue Aug  8 14:16:17 1989
***************
*** 1,5 ****
  /*
!  * P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1988
   * LICENSED MATERIALS - PROPERTY OF IBM
   * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
   */
--- 1,5 ----
  /*
!  * P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1988,1989
   * LICENSED MATERIALS - PROPERTY OF IBM
   * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
   */
***************
*** 9,15 ****
   * specifies the terms and conditions for redistribution.
   */
  #ifndef lint
! static char rcsid[] = "$Header: ld.c,v 12.0 88/11/09 16:36:26 root dec88 $";
  #endif
  /* $Source: /site/src/bin/RCS/ld.c,v $ */
  
--- 9,15 ----
   * specifies the terms and conditions for redistribution.
   */
  #ifndef lint
! static char rcsid[] = "$Header: ld.c,v 12.1 89/04/06 12:41:54 james Exp $";
  #endif
  /* $Source: /site/src/bin/RCS/ld.c,v $ */
  
***************
*** 1738,1745 ****
                         cursym.n_un.n_name = curstr + cursym.n_un.n_strx;
                 }
  /* inline expansion of symreloc() */
-                switch (cursym.n_type & 017) {
  
                 case N_TEXT:
                 case N_EXT+N_TEXT:
                         cursym.n_value += ctrel;
--- 1738,1754 ----
                         cursym.n_un.n_name = curstr + cursym.n_un.n_strx;
                 }
  /* inline expansion of symreloc() */
  
+ #ifndef ibm370
+ /* In the RT linkage, function addresses are in data, not text.
+  * The following kluge on n_type relocates function stabs into data
+  * rather than text.  0x24 would have been N_FUN had we included stabs.h.
+  */
+ 		switch ((cursym.n_type == 0x24) ? N_DATA : cursym.n_type & 0x0f) {
+ #endif ibm370
+ #ifdef  ibm370
+ 		switch (cursym.n_type & 0x0f) {
+ #endif ibm370
                 case N_TEXT:
                 case N_EXT+N_TEXT:
                         cursym.n_value += ctrel;
***************
*** 2543,2551 ****
  
  symreloc()
  {
!        if(funding) return;
!        switch (cursym.n_type & 017) {
! 
         case N_TEXT:
         case N_EXT+N_TEXT:
                 cursym.n_value += ctrel;
--- 2552,2568 ----
  
  symreloc()
  {
! 	if(funding) return;
! #ifndef ibm370
! /* In the RT linkage, function addresses are in data, not text.
!  * The following kluge on n_type relocates function stabs into data
!  * rather that text.  0x24 would have been N_FUN had we included stabs.h.
!  */
! 	switch ((cursym.n_type == 0x24) ? N_DATA : cursym.n_type & 0x0f) {
! #endif ibm370
! #ifdef ibm370
! 	switch (cursym.n_type & 0x0f) {
! #endif ibm370
         case N_TEXT:
         case N_EXT+N_TEXT:
                 cursym.n_value += ctrel;