🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Bob Sutterfield Fri, 08 Dec 1989 19:27
ld alignment, padding problems; a little arg count toejam too
#586
Author: Bob Sutterfield
Date: Fri, 08 Dec 1989 19:27
167 lines
5209 bytes
In making ld.c work with our  cross-compiler environment (gcc 1.36 and
gas 1.34 running on SPARC, targeting standalone 680[02]0  and 803[78]6
boards), the following changes were needed.  Only the header change (I
think) is a  local configuration  issue, some are  lint,  and some are
alignment and padding problems that will affect any similar situation.

*** binutils/ld.c.dist	Tue Oct 17 12:50:24 1989
--- binutils/ld.c	Tue Dec  5 17:02:57 1989
***************
*** 32,35 ****
--- 32,53 ----
  #else
  #include <a.out.h>
+ #ifdef MST68K
+ /********************
+  * mods for MST
+  */
+ # define m68020
+ # undef is68k
+ # undef sparc
+ # undef N_DATADDR
+ # undef N_TXTADDR
+ # define N_TXTADDR(x) (sizeof(struct exec))
+ # define N_DATADDR(x) \
+ 	(N_TXTADDR(x)+(x).a_text)
+ #endif /* MST68K */
+ #endif /* COFF_ENCAPSULATE */
+ 
+ #ifdef sparc
+ #define relocation_info reloc_info_sparc
+ #define r_symbolnum r_index
  #endif
  
***************
*** 137,141 ****
--- 155,163 ----
  #endif
  #ifndef INITIALIZE_HEADER
+ #ifdef MST68K
+ #define INITIALIZE_HEADER outheader.a_magic = OMAGIC
+ #else /* MST68K */
  #define INITIALIZE_HEADER outheader.a_machtype = M_68020
+ #endif /* MST68K */
  #endif
  #endif
***************
*** 2454,2458 ****
--- 2476,2484 ----
    /* Make sure bss starts out aligned as much as anyone can want.  */
  
+ #ifdef MST68K
+   data_size = (data_size + sizeof(long) - 1) & ~(sizeof(long)-1);
+ #else /* MST68K */
    data_size = (data_size + sizeof(double) - 1) & ~(sizeof(double)-1);
+ #endif /* MST68K */
  
    /* Set up the set element vector */
***************
*** 3443,3447 ****
      fprintf (stderr, "Copying and relocating text:\n\n");
  
!   each_full_file (copy_text);
    file_close ();
  
--- 3469,3473 ----
      fprintf (stderr, "Copying and relocating text:\n\n");
  
!   each_full_file (copy_text, 0);
    file_close ();
  
***************
*** 3464,3468 ****
  read_relocation ()
  {
!   each_full_file (read_file_relocation);
  }
  
--- 3490,3494 ----
  read_relocation ()
  {
!   each_full_file (read_file_relocation, 0);
  }
  
***************
*** 3570,3574 ****
      fprintf (stderr, "Copying and relocating data:\n\n");
  
!   each_full_file (copy_data);
    file_close ();
  
--- 3596,3600 ----
      fprintf (stderr, "Copying and relocating data:\n\n");
  
!   each_full_file (copy_data, 0);
    file_close ();
  
***************
*** 3665,3669 ****
--- 3691,3698 ----
  
        if (addr >= data_size)
+ 	{
+ 	printf("perform_relocation(0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X): addr 0x%X\n", data, pc_relocation, data_size, reloc_info, reloc_size, entry, addr);
  	fatal_with_file ("relocation address out of range in ", entry);
+ 	}
  
        if (RELOC_EXTERN_P(p))
***************
*** 3784,3793 ****
  
  	case 2:
  	  if (RELOC_MEMORY_SUB_P(p))
! 	    relocation -= mask & *(long *) (data + addr);
  	  else if (RELOC_MEMORY_ADD_P(p))
! 	    relocation += mask & *(long *) (data + addr);
  	  *(long *) (data + addr) &= ~mask;
  	  *(long *) (data + addr) |= relocation;
  	  break;
  
--- 3813,3833 ----
  
  	case 2:
+ #ifdef MST68K
  	  if (RELOC_MEMORY_SUB_P(p))
! 	       relocation -= mask & ((*(unsigned short *) (data + addr) << 16) | (*(unsigned short *)(data + addr + 2)));
  	  else if (RELOC_MEMORY_ADD_P(p))
! 	       relocation += mask & ((*(unsigned short *) (data + addr) << 16) | (*(unsigned short *)(data + addr + 2)));
! 	  *(short *) (data + addr) &= ~mask >> 16;
! 	  *(short *) (data + addr + 2) &= ~mask;
! 	  *(short *) (data + addr) |= relocation >> 16;
! 	  *(short *) (data + addr + 2) |= relocation;
! #else /* MST68K */
! 	  if (RELOC_MEMORY_SUB_P(p))
! 	       relocation -= mask & *(long *) (data + addr);
! 	  else if (RELOC_MEMORY_ADD_P(p))
! 	       relocation += mask & *(long *) (data + addr);
  	  *(long *) (data + addr) &= ~mask;
  	  *(long *) (data + addr) |= relocation;
+ #endif /* MST68K */
  	  break;
  
***************
*** 3838,3842 ****
    /* Write out the relocations of all files, remembered from copy_text.  */
  
!   each_full_file (coptxtrel);
  
    if (trace_files)
--- 3878,3882 ----
    /* Write out the relocations of all files, remembered from copy_text.  */
  
!   each_full_file (coptxtrel, 0);
  
    if (trace_files)
***************
*** 3843,3847 ****
      fprintf (stderr, "\nWriting data relocation:\n\n");
  
!   each_full_file (copdatrel);
  
    if (trace_files)
--- 3883,3887 ----
      fprintf (stderr, "\nWriting data relocation:\n\n");
  
!   each_full_file (copdatrel, 0);
  
    if (trace_files)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads