i386-pc-nto-qnx patch re-submission

Graeme Peterson gp@qnx.com
Thu May 30 09:25:00 GMT 2002


Hi all.

Here is an updated patch for consideration for inclusion in the GNU
Binutils to support i386-pc-nto-qnx6.  I have also attached a set of
updated ChangeLog entries.

Thanks very much to Alan Modra for his online and offline help on
this.  Very much appreciated.

Cheers.
GP
-------------- next part --------------
bfd/ChangeLog
===================================================================
2002-05-30  Graeme Peterson  <gp@qnx.com>
 
 	* Makefile.am: Add elf32-i386qnx.lo and elf32-i386qnx.c.
 	* Makefile.in: Same.
 	* config.bfd: Add i[3456]86-*-nto*) support
 	* configure: Add bfd_elf32_i386qnx_vec support.
 	* configure.in: Same.
 	* elf-bfd.h (struct elf_backend_data): Add 3 new backend functions
	elf_backend_set_nonloadable_filepos, 
	elf_backend_is_contained_by_filepos, and 
	elf_backend_do_copy_private_bfd_data.
 	* elf.c (assign_file_positions_for_segments): Add call to
 	elf_backend_set_nonloadable_filepos.
 	* elf.c (copy_private_bfd_data): Add new macro IS_CONTAINED_BY_FILEPOS
	which calls elf_backend_is_contained_by_filepos if it is defined.
 	* elf.c (_bfd_elf_copy_private_section_data): Test for 
 	elf_backend_do_copy_private_bfd_data function, and if defined use it 
	to test if copy_private_bfd_data should be called.
 	* elf32-i386.c: Add #ifndef ELF32_I386_C_INCLUDED before including
 	elf32-target.h to facilitate including elf32-i386.c in other backend 
	files.
 	* elf32-i386qnx.c: New QNX elf backend file.
 	* elfxx-target.h: Add elf_backend_set_nonloadable_filepos,
	elf_backend_is_contained_by_filepos, and 
	elf_backend_do_copy_private_bfd_data.
 	* targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
 
gas/ChangeLog
===================================================================
2002-05-30  Graeme Peterson  <gp@qnx.com>
 
 	* configure: Add i[3456]86-*-nto-qnx*.
 	* configure.in: Same.
 
ld/ChangeLog
===================================================================
2002-05-30  Graeme Peterson  <gp@qnx.com>
 
 	* Makefile.in: Add ei386nto.c.
 	* configure.tgt: Add i[3456]86-*-nto*).
 	* i386nto.sh: New QNX file.

-------------- next part --------------
diff -rc3p -N src/bfd/Makefile.am src.qnx/bfd/Makefile.am
*** src/bfd/Makefile.am	Tue May 28 10:05:08 2002
--- src.qnx/bfd/Makefile.am	Wed May 29 10:33:44 2002
*************** BFD32_BACKENDS = \
*** 207,212 ****
--- 207,213 ----
  	elf32-hppa.lo \
  	elf32-i370.lo \
  	elf32-i386.lo \
+ 	elf32-i386qnx.lo \
  	elf32-i860.lo \
  	elf32-i960.lo \
  	elf32-ia64.lo \
*************** BFD32_BACKENDS_CFILES = \
*** 357,362 ****
--- 358,364 ----
  	elf32-hppa.c \
  	elf32-i370.c \
  	elf32-i386.c \
+ 	elf32-i386qnx.c \
  	elf32-i860.c \
  	elf32-i960.c \
  	elf32-m32r.c \
*************** elf32-i370.lo: elf32-i370.c $(INCDIR)/fi
*** 1111,1116 ****
--- 1113,1122 ----
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
    $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
  elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+   $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
+   elf32-target.h
+ elf32-i386qnx.lo: elf32-i386qnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
    $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
    elf32-target.h
diff -rc3p -N src/bfd/Makefile.in src.qnx/bfd/Makefile.in
*** src/bfd/Makefile.in	Tue May 28 10:05:09 2002
--- src.qnx/bfd/Makefile.in	Wed May 29 10:33:44 2002
*************** BFD32_BACKENDS = \
*** 335,340 ****
--- 335,341 ----
  	elf32-hppa.lo \
  	elf32-i370.lo \
  	elf32-i386.lo \
+ 	elf32-i386qnx.lo \
  	elf32-i860.lo \
  	elf32-i960.lo \
  	elf32-ia64.lo \
*************** BFD32_BACKENDS_CFILES = \
*** 486,491 ****
--- 487,493 ----
  	elf32-hppa.c \
  	elf32-i370.c \
  	elf32-i386.c \
+ 	elf32-i386qnx.c \
  	elf32-i860.c \
  	elf32-i960.c \
  	elf32-m32r.c \
*************** elf32-i370.lo: elf32-i370.c $(INCDIR)/fi
*** 1640,1645 ****
--- 1642,1651 ----
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
    $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
  elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+   $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
+   elf32-target.h
+ elf32-i386qnx.lo: elf32-i386qnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
    $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
    elf32-target.h
diff -rc3p -N src/bfd/config.bfd src.qnx/bfd/config.bfd
*** src/bfd/config.bfd	Tue May 28 10:05:13 2002
--- src.qnx/bfd/config.bfd	Wed May 29 10:33:57 2002
*************** case "${targ}" in
*** 345,350 ****
--- 345,354 ----
      targ_defvec=bfd_elf32_i386_vec
      targ_selvecs=i386coff_vec
      ;;
+   i[3456]86-*-nto-qnx*)
+     targ_defvec=bfd_elf32_i386qnx_vec
+     targ_selvecs=i386coff_vec
+     ;;
    i[3456]86-*-chorus*)
      targ_defvec=bfd_elf32_i386_vec
      ;;
diff -rc3p -N src/bfd/configure src.qnx/bfd/configure
*** src/bfd/configure	Tue May 28 10:05:14 2002
--- src.qnx/bfd/configure	Wed May 29 10:34:10 2002
*************** do
*** 6072,6077 ****
--- 6072,6078 ----
      bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
      bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
      bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+     bfd_elf32_i386qnx_vec)	tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
      bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
      bfd_elf32_i860_vec)		tb="$tb elf32-i860.lo elf32.lo $elf" ;;
      bfd_elf32_i960_vec)		tb="$tb elf32-i960.lo elf32.lo $elf" ;;
diff -rc3p -N src/bfd/configure.in src.qnx/bfd/configure.in
*** src/bfd/configure.in	Tue May 28 10:05:17 2002
--- src.qnx/bfd/configure.in	Wed May 29 10:34:10 2002
*************** do
*** 573,578 ****
--- 573,579 ----
      bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
      bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
      bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+     bfd_elf32_i386qnx_vec)	tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
      bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
      bfd_elf32_i860_vec)		tb="$tb elf32-i860.lo elf32.lo $elf" ;;
      bfd_elf32_i960_vec)		tb="$tb elf32-i960.lo elf32.lo $elf" ;;
diff -rc3p -N src/bfd/elf-bfd.h src.qnx/bfd/elf-bfd.h
*** src/bfd/elf-bfd.h	Thu May 23 09:12:47 2002
--- src.qnx/bfd/elf-bfd.h	Wed May 29 10:34:14 2002
*************** struct elf_backend_data
*** 760,765 ****
--- 760,781 ----
    boolean (*elf_backend_write_section)
      PARAMS ((bfd *, asection *, bfd_byte *));
  
+   /* This function, if defined, sets  up the file positions for non PT_LOAD
+      segments, especially for segments containing non-allocated sections.  */
+   void (*elf_backend_set_nonloadable_filepos)
+     PARAMS ((bfd *, Elf_Internal_Phdr *));
+ 
+   /* This function, if defined, returns true if the segment is contained
+      within the section.  File positions are compared.  */
+   boolean (*elf_backend_is_contained_by_filepos)
+     PARAMS ((asection *, Elf_Internal_Phdr *));
+ 
+   /* This function, if defined, returns true if copy_private_bfd_data()
+      should be called.  It provides a way of overriding default 
+      test conditions in _bfd_elf_copy_private_section_data().  */
+   boolean (*elf_backend_do_copy_private_bfd_data)
+     PARAMS ((bfd *, asection *, bfd *, asection *));
+ 
    /* The level of IRIX compatibility we're striving for.
       MIPS ELF specific function.  */
    irix_compat_t (*elf_backend_mips_irix_compat)
diff -rc3p -N src/bfd/elf.c src.qnx/bfd/elf.c
*** src/bfd/elf.c	Thu May 23 09:12:43 2002
--- src.qnx/bfd/elf.c	Wed May 29 10:34:25 2002
*************** Error: First section in segment (%s) sta
*** 3716,3721 ****
--- 3716,3726 ----
  	}
      }
  
+   /* If additional nonloadable filepos adjustments are required,
+      do them now. */
+   if (bed->elf_backend_set_nonloadable_filepos)
+     bed->elf_backend_set_nonloadable_filepos(abfd, phdrs);
+ 
    /* Clear out any program headers we allocated but did not use.  */
    for (; count < alloc; count++, p++)
      {
*************** copy_private_bfd_data (ibfd, obfd)
*** 4309,4314 ****
--- 4314,4327 ----
       && (section->lma + section->_raw_size)		\
       <= SEGMENT_END (segment, base))
  
+   /* Returns true if the given section is contained within the
+      given segment.  Filepos addresses are compared in an elf
+      backend function. */
+ #define IS_CONTAINED_BY_FILEPOS(section, segment)              \
+     (get_elf_backend_data (ibfd)->elf_backend_is_contained_by_filepos \
+      ? get_elf_backend_data (ibfd)->elf_backend_is_contained_by_filepos(section, segment) \
+      : 0)
+ 
    /* Special case: corefile "NOTE" section containing regs, prpsinfo etc.  */
  #define IS_COREFILE_NOTE(p, s)                          \
  	    (p->p_type == PT_NOTE                       \
*************** copy_private_bfd_data (ibfd, obfd)
*** 4343,4349 ****
         : IS_CONTAINED_BY_VMA (section, segment))			\
        || IS_SOLARIS_PT_INTERP (segment, section))			\
       && (section->flags & SEC_ALLOC) != 0)				\
!     || IS_COREFILE_NOTE (segment, section))				\
     && section->output_section != NULL					\
     && section->segment_mark == false)
  
--- 4356,4364 ----
         : IS_CONTAINED_BY_VMA (section, segment))			\
        || IS_SOLARIS_PT_INTERP (segment, section))			\
       && (section->flags & SEC_ALLOC) != 0)				\
!     || IS_COREFILE_NOTE (segment, section)				\
!     || (IS_CONTAINED_BY_FILEPOS (section, segment)			\
!      && (section->flags & SEC_ALLOC) == 0))				\
     && section->output_section != NULL					\
     && section->segment_mark == false)
  
--- 4370,4375 ----
*************** copy_private_bfd_data (ibfd, obfd)
*** 4572,4577 ****
--- 4586,4592 ----
  	      /* Match up the physical address of the segment with the
  		 LMA address of the output section.  */
  	      if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
+                 || IS_CONTAINED_BY_FILEPOS (section, segment)
  		  || IS_COREFILE_NOTE (segment, section))
  		{
  		  if (matching_lma == 0)
*************** copy_private_bfd_data (ibfd, obfd)
*** 4641,4647 ****
  	}
  
        /* Step Three: Loop over the sections again, this time assigning
! 	 those that fit to the current segment and remvoing them from the
  	 sections array; but making sure not to leave large gaps.  Once all
  	 possible sections have been assigned to the current segment it is
  	 added to the list of built segments and if sections still remain
--- 4656,4662 ----
  	}
  
        /* Step Three: Loop over the sections again, this time assigning
! 	 those that fit to the current segment and removing them from the
  	 sections array; but making sure not to leave large gaps.  Once all
  	 possible sections have been assigned to the current segment it is
  	 added to the list of built segments and if sections still remain
*************** copy_private_bfd_data (ibfd, obfd)
*** 4805,4810 ****
--- 4820,4826 ----
  #undef SEGMENT_END
  #undef IS_CONTAINED_BY_VMA
  #undef IS_CONTAINED_BY_LMA
+ #undef IS_CONTAINED_BY_FILEPOS
  #undef IS_COREFILE_NOTE
  #undef IS_SOLARIS_PT_INTERP
  #undef INCLUDE_SECTION_IN_SEGMENT
*************** _bfd_elf_copy_private_section_data (ibfd
*** 4824,4829 ****
--- 4840,4846 ----
       asection *osec;
  {
    Elf_Internal_Shdr *ihdr, *ohdr;
+   const struct elf_backend_data *bed = get_elf_backend_data (ibfd);
  
    if (ibfd->xvec->flavour != bfd_target_elf_flavour
        || obfd->xvec->flavour != bfd_target_elf_flavour)
*************** _bfd_elf_copy_private_section_data (ibfd
*** 4833,4856 ****
       This must be done here, rather than in the copy_private_bfd_data
       entry point, because the latter is called after the section
       contents have been set, which means that the program headers have
!      already been worked out.  */
!   if (elf_tdata (obfd)->segment_map == NULL
!       && elf_tdata (ibfd)->phdr != NULL)
!     {
!       asection *s;
! 
!       /* Only set up the segments if there are no more SEC_ALLOC
!          sections.  FIXME: This won't do the right thing if objcopy is
!          used to remove the last SEC_ALLOC section, since objcopy
!          won't call this routine in that case.  */
!       for (s = isec->next; s != NULL; s = s->next)
! 	if ((s->flags & SEC_ALLOC) != 0)
! 	  break;
!       if (s == NULL)
! 	{
! 	  if (! copy_private_bfd_data (ibfd, obfd))
! 	    return false;
! 	}
      }
  
    ihdr = &elf_section_data (isec)->this_hdr;
--- 4850,4880 ----
       This must be done here, rather than in the copy_private_bfd_data
       entry point, because the latter is called after the section
       contents have been set, which means that the program headers have
!      already been worked out.  The backend function provides a way to 
!      override the test conditions and code path for the call to 
!      copy_private_bfd_data().  */
!   if (bed->elf_backend_do_copy_private_bfd_data)
!     {
!       if (bed->elf_backend_do_copy_private_bfd_data (ibfd, isec, obfd, osec))
!         if (! copy_private_bfd_data (ibfd, obfd))
!           return false;
!     } 
!   else if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
!     {
! 	asection *s;
! 
! 	/* Only set up the segments if there are no more SEC_ALLOC
! 	   sections.  FIXME: This won't do the right thing if objcopy is
! 	   used to remove the last SEC_ALLOC section, since objcopy
! 	   won't call this routine in that case.  */
! 	for (s = isec->next; s != NULL; s = s->next)
! 	  if ((s->flags & SEC_ALLOC) != 0)
! 	    break;
! 	if (s == NULL)
! 	  {
! 	    if (! copy_private_bfd_data (ibfd, obfd))
! 	      return false;
! 	  }
      }
  
    ihdr = &elf_section_data (isec)->this_hdr;
diff -rc3p -N src/bfd/elf32-i386.c src.qnx/bfd/elf32-i386.c
*** src/bfd/elf32-i386.c	Thu May 23 09:12:45 2002
--- src.qnx/bfd/elf32-i386.c	Wed May 29 10:34:33 2002
*************** elf_i386_finish_dynamic_sections (output
*** 3146,3149 ****
--- 3146,3151 ----
  #define elf_backend_relocate_section	      elf_i386_relocate_section
  #define elf_backend_size_dynamic_sections     elf_i386_size_dynamic_sections
  
+ #ifndef ELF32_I386_C_INCLUDED
  #include "elf32-target.h"
+ #endif
diff -rc3p -N src/bfd/elf32-i386qnx.c src.qnx/bfd/elf32-i386qnx.c
*** src/bfd/elf32-i386qnx.c	Wed Dec 31 19:00:00 1969
--- src.qnx/bfd/elf32-i386qnx.c	Wed May 29 14:16:06 2002
***************
*** 0 ****
--- 1,111 ----
+ /* Intel 80386/80486 QNX specific support for 32-bit ELF
+    Copyright 2002
+    Free Software Foundation, Inc.
+ 
+ This file is part of BFD, the Binary File Descriptor library.
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+ 
+ #define ELF32_I386_C_INCLUDED
+ #include "elf32-i386.c"
+ 
+   /* Returns the end address of the segment + 1.  */
+ #define SEGMENT_END(segment, start)                     \
+   (start + (segment->p_memsz > segment->p_filesz        \
+    ? segment->p_memsz : segment->p_filesz))
+ 
+ static boolean elf_i386qnx_do_copy_private_bfd_data
+   PARAMS ((bfd *, asection *, bfd *, asection *));
+ static boolean elf_i386qnx_is_contained_by_filepos
+   PARAMS ((asection *, Elf_Internal_Phdr *));
+ static void elf_i386qnx_set_nonloadable_filepos
+   PARAMS ((bfd *, Elf_Internal_Phdr *));
+ 
+ static boolean
+ elf_i386qnx_do_copy_private_bfd_data(ibfd, isec, obfd, osec)
+      bfd *ibfd;
+      asection *isec;
+      bfd *obfd;
+      asection *osec;
+ {
+   /* We don't use these parameters, but another target might. */
+   ibfd = ibfd;
+   obfd = obfd;
+   osec = osec;
+   return (isec->next == NULL);
+ }
+ 
+ static boolean
+ elf_i386qnx_is_contained_by_filepos(section, segment)
+       asection *section;
+       Elf_Internal_Phdr *segment; 
+ {
+   return ((unsigned) section->filepos >= segment->p_offset
+           && ((unsigned) section->filepos + section->_raw_size)
+           <= SEGMENT_END (segment, segment->p_offset));
+ }
+ 
+ static void
+ elf_i386qnx_set_nonloadable_filepos(abfd, phdrs)
+       bfd *abfd;
+       Elf_Internal_Phdr *phdrs; 
+ {
+   struct elf_segment_map *m;
+   Elf_Internal_Phdr *p;
+   file_ptr off = 0;
+ 
+   for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+        m != NULL;
+        m = m->next, p++)
+     {
+       unsigned int i;
+       asection **secpp;
+ 
+       for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+         {
+           asection *sec;
+ 
+           sec = *secpp;
+ 
+           if (p->p_type == PT_LOAD)
+                 off = sec->filepos;
+           else
+             {
+               if (i == 0)
+                 {
+                   if (sec->filepos)
+                     p->p_offset = sec->filepos;
+                   else
+                     p->p_offset = off;
+                 }
+               if (!sec->filepos)
+                 {
+                   off += sec->_raw_size;
+                   p->p_filesz += sec->_raw_size;
+                 }
+             }
+         }
+     }
+     return;
+ }
+ 
+ #undef  TARGET_LITTLE_SYM
+ #define TARGET_LITTLE_SYM			  bfd_elf32_i386qnx_vec
+ 
+ #define elf_backend_set_nonloadable_filepos	elf_i386qnx_set_nonloadable_filepos
+ #define elf_backend_is_contained_by_filepos	elf_i386qnx_is_contained_by_filepos
+ #define elf_backend_do_copy_private_bfd_data	elf_i386qnx_do_copy_private_bfd_data
+ 
+ #include "elf32-target.h"
diff -rc3p -N src/bfd/elfxx-target.h src.qnx/bfd/elfxx-target.h
*** src/bfd/elfxx-target.h	Wed May 29 10:38:25 2002
--- src.qnx/bfd/elfxx-target.h	Wed May 29 10:35:03 2002
*************** Foundation, Inc., 59 Temple Place - Suit
*** 378,383 ****
--- 378,392 ----
  #ifndef elf_backend_write_section
  #define elf_backend_write_section		NULL
  #endif
+ #ifndef elf_backend_set_nonloadable_filepos
+ #define elf_backend_set_nonloadable_filepos	NULL
+ #endif
+ #ifndef elf_backend_is_contained_by_filepos
+ #define elf_backend_is_contained_by_filepos	NULL
+ #endif
+ #ifndef elf_backend_do_copy_private_bfd_data
+ #define elf_backend_do_copy_private_bfd_data	NULL
+ #endif
  #ifndef elf_backend_mips_irix_compat
  #define elf_backend_mips_irix_compat		NULL
  #endif
*************** static const struct elf_backend_data elf
*** 479,484 ****
--- 488,496 ----
    elf_backend_discard_info,
    elf_backend_ignore_discarded_relocs,
    elf_backend_write_section,
+   elf_backend_set_nonloadable_filepos,
+   elf_backend_is_contained_by_filepos,
+   elf_backend_do_copy_private_bfd_data,
    elf_backend_mips_irix_compat,
    elf_backend_mips_rtype_to_howto,
    elf_backend_ecoff_debug_swap,
diff -rc3p -N src/bfd/targets.c src.qnx/bfd/targets.c
*** src/bfd/targets.c	Tue May 28 10:05:19 2002
--- src.qnx/bfd/targets.c	Wed May 29 10:35:14 2002
*************** extern const bfd_target bfd_elf32_hppa_l
*** 514,519 ****
--- 514,520 ----
  extern const bfd_target bfd_elf32_hppa_vec;
  extern const bfd_target bfd_elf32_i370_vec;
  extern const bfd_target bfd_elf32_i386_vec;
+ extern const bfd_target bfd_elf32_i386qnx_vec;
  extern const bfd_target bfd_elf32_i860_little_vec;
  extern const bfd_target bfd_elf32_i860_vec;
  extern const bfd_target bfd_elf32_i960_vec;
*************** static const bfd_target * const _bfd_tar
*** 765,770 ****
--- 766,772 ----
  	&bfd_elf32_hppa_vec,
  	&bfd_elf32_i370_vec,
  	&bfd_elf32_i386_vec,
+ 	&bfd_elf32_i386qnx_vec,
  	&bfd_elf32_i860_little_vec,
  	&bfd_elf32_i860_vec,
  	&bfd_elf32_i960_vec,
diff -rc3p -N src/gas/configure src.qnx/gas/configure
*** src/gas/configure	Tue May 28 10:07:44 2002
--- src.qnx/gas/configure	Wed May 29 10:36:21 2002
*************** EOF
*** 2453,2458 ****
--- 2453,2459 ----
        i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
        i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
        i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
+       i[3456]86-*-nto-qnx*) fmt=elf ;;
        i386-*-*nt*)          fmt=coff em=pe bfd_gas=yes ;;
        i386-*-vxworks*)      fmt=aout ;;
        i386-*-chaos)         fmt=elf ;;
diff -rc3p -N src/gas/configure.in src.qnx/gas/configure.in
*** src/gas/configure.in	Tue May 28 10:07:47 2002
--- src.qnx/gas/configure.in	Wed May 29 10:36:21 2002
*************** changequote([,])dnl
*** 300,305 ****
--- 300,306 ----
        i386-*-cygwin*)       fmt=coff em=pe bfd_gas=yes ;;
        i386-*-interix*)	    fmt=coff em=interix bfd_gas=yes ;;
        i386-*-mingw32*)      fmt=coff em=pe bfd_gas=yes ;;
+       i[3456]86-*-nto-qnx*) fmt=elf ;;
        i386-*-*nt*)          fmt=coff em=pe bfd_gas=yes ;;
        i386-*-vxworks*)      fmt=aout ;;
        i386-*-chaos)         fmt=elf ;;
diff -rc3p -N src/ld/Makefile.in src.qnx/ld/Makefile.in
*** src/ld/Makefile.in	Tue May 28 10:08:32 2002
--- src.qnx/ld/Makefile.in	Wed May 29 10:38:46 2002
*************** ez8001.c: $(srcdir)/emulparams/z8001.sh 
*** 1747,1752 ****
--- 1747,1755 ----
  ez8002.c: $(srcdir)/emulparams/z8002.sh \
    $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} z8002 "$(tdir_z8002)"
+ ei386nto.c: $(srcdir)/emulparams/i386nto.sh \
+   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} i386nto "$(tdir_i386nto)"
  
  # The generated emulation files mostly have the same dependencies.
  $(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \
diff -rc3p -N src/ld/configure.tgt src.qnx/ld/configure.tgt
*** src/ld/configure.tgt	Tue May 28 10:08:32 2002
--- src.qnx/ld/configure.tgt	Wed May 29 10:38:46 2002
*************** m68*-ericsson-ose)	targ_emul=sun3 ;;
*** 119,124 ****
--- 119,125 ----
  m68*-apple-aux*)	targ_emul=m68kaux ;;
  *-tandem-none)		targ_emul=st2000 ;;
  i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
+ i[3456]86-*-nto*)	targ_emul=i386nto ;;
  i[3456]86-*-vsta)	targ_emul=vsta ;;
  i[3456]86-go32-rtems*)	targ_emul=i386go32 ;;
  i[3456]86-*-go32)	targ_emul=i386go32 ;;
diff -rc3p -N src/ld/emulparams/i386nto.sh src.qnx/ld/emulparams/i386nto.sh
*** src/ld/emulparams/i386nto.sh	Wed Dec 31 19:00:00 1969
--- src.qnx/ld/emulparams/i386nto.sh	Thu Mar 21 14:25:08 2002
***************
*** 0 ****
--- 1,12 ----
+ SCRIPT_NAME=elf
+ OUTPUT_FORMAT="elf32-i386"
+ TEXT_START_ADDR=0x08048000
+ TEXT_START_SYMBOLS='_btext = .;'
+ MAXPAGESIZE=0x1000
+ NONPAGED_TEXT_START_ADDR=0x08048000
+ #SHLIB_TEXT_START_ADDR=0xb0300000
+ ARCH=i386
+ MACHINE=
+ NOP=0x9090
+ TEMPLATE_NAME=elf32
+ GENERATE_SHLIB_SCRIPT=yes


More information about the Binutils mailing list