*** ld/Makefile.in.orig	Wed Nov 10 20:32:15 1993
--- ld/Makefile.in	Sat Feb 12 00:28:18 1994
***************
*** 367,373 ****
  	${GENSCRIPTS} alpha
  
  $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
! 	$(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
  
  # The generated emulation files mostly have the same dependencies.
  $(EMULATION_OFILES): ../bfd/bfd.h ../bfd/sysdep.h ld.h ldemul.h \
--- 367,373 ----
  	${GENSCRIPTS} alpha
  
  $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
! 	$(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES) -lfl
  
  # The generated emulation files mostly have the same dependencies.
  $(EMULATION_OFILES): ../bfd/bfd.h ../bfd/sysdep.h ld.h ldemul.h \
*** bfd/coffcode.h.orig	Fri Oct 29 02:01:31 1993
--- bfd/coffcode.h	Sat Feb 12 00:31:03 1994
***************
*** 291,298 ****
--- 291,305 ----
  
  */
  
+ #define ROUNDED_SECTIONS_ENABLED
+ 
  #include "seclet.h"
  #include "coffswap.h"
+ 
+ #if defined(ROUNDED_SECTIONS_ENABLED) && !defined(PAGE_SIZE)
+ #define PAGE_SIZE  4096    /* A very common size of pages */
+ #endif
+ 
  
  /* void warning(); */
  
***************
*** 1281,1286 ****
--- 1288,1294 ----
  #ifndef I960
    file_ptr	old_sofar;
  #endif
+ 
    if (bfd_get_start_address(abfd)) 
    {
      /*  A start address may have been added to the original file. In this
***************
*** 1321,1326 ****
--- 1329,1353 ----
  	 offset must match the low order bits of the virtual address.
  	 "Low order" is apparently implementation defined.  Add code
  	 here to round sofar up to match the virtual address.  */
+ 
+ #if defined(ROUNDED_SECTIONS_ENABLED) && defined(PAGE_SIZE)
+       if ((abfd->flags & EXEC_P) && (abfd->flags & (D_PAGED | WP_TEXT))) {
+ 	if (current->user_set_vma) {
+ 	  long new_sofar;
+ 	  /* Adjust the file to match the virtual address */
+ 	  new_sofar = (sofar & ~(PAGE_SIZE-1)) |
+ 	              ((PAGE_SIZE-1) & current->vma);
+ 	  /* Do not allow file to be over-written */
+ 	  if (new_sofar < sofar)
+ 	    new_sofar += PAGE_SIZE;
+ 	  sofar = new_sofar;
+ 	} else {
+ 	  /* Adjust virtual address of section to match the file */
+ 	  current->vma = (current->vma & ~(PAGE_SIZE-1)) |
+ 	                 ((PAGE_SIZE-1) & sofar);
+ 	}
+       }
+ #endif
  
        current->filepos = sofar;
  
*** bfd/ChangeLog.orig	Sat Feb 12 00:28:15 1994
--- bfd/ChangeLog	Sat Feb 12 00:28:23 1994
***************
*** 5,10 ****
--- 5,17 ----
  	allows systems which _require_ page-aligned executables, such as
  	Linux to work.
  
+ Tue Feb  8 22:43:12 1994  Al Longyear  (longyear@sii.com)
+ 
+ 	* coffcode.h (coff_compute_section_file_positions): Added support
+ 	to round section addresses to the proper page alignment. This
+ 	allows systems which _require_ page-aligned executables, such as
+ 	Linux to work.
+ 
  Fri Nov  5 15:20:18 1993  Ken Raeburn  (raeburn@rover.cygnus.com)
  
  	* VERSION: Updated to 2.3.
