This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add ELFOSABI_QNX


Thanks, HJ.

As per our e-mails on the weekend, I will apply this, test it and
provide feedback ASAP.

Regards,
GP

> 
> 
> --82I3+IH0IqGh5yIs
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> This patch adds the support for ELFOSABI_QNX. David, I also fixed a
> FreeBSD bug. elf32-i386-freebsd shouldn't match ELFOSABI_NONE unless
> elf32-i386 is not configured. You may want to disallow that even if
> elf32-i386 is not configured.
> 
> Please give it a try.
> 
> 
> H.J.
> 
> --82I3+IH0IqGh5yIs
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="binutils-qnx.patch"
> 
> bfd/
> 2002-10-27  H.J. Lu <hjl@gnu.org>
> 
> 	* Makefile.am (INCLUDES): Add $(TDEFAULTS).
> 	(targets.lo): Remove $(TDEFAULTS).
> 	(archures.lo): Likewise.
> 	* Makefile.in: Regenerated.
> 
> 	* configure.in (havevecs): Set to -DHAVE_bfd_all_target_vectors
> 	for --enable-targets=all.
> 	* configure: Regenerated.
> 
> 	* elf32-i386.c (elf_i386_object_p): Check ELFOSABI_NONE,
> 	ELFOSABI_FREEBSD and ELFOSABI_QNX.
> 	Build elf32-i386 only if elf32-i386 or all targets are enabled.
> 	(elf_i386_post_process_headers): Renamed to ...
> 	(elf_i386_freebsd_post_process_headers): This.
> 	(elf_i386_qnx_post_process_headers): New.
> 
> gas/
> 2002-10-27  H.J. Lu <hjl@gnu.org>
> 
> 	* config/tc-i386.h (ELF_TARGET_FORMAT): Defined as
> 	"elf32-i386-nto" for QNX.
> 
> 	* config/te-qnx.h: New.
> 
> 	* configure.in (i386-*-nto-qnx*): Set em to qnx.
> 	* configure: Regenerated.
> 
> include/elf/
> 2002-10-27  H.J. Lu <hjl@gnu.org>
> 
> 	* common.h (ELFOSABI_QNX): New.
> 
> ld/
> 2002-10-27  H.J. Lu <hjl@gnu.org>
> 
> 	* emulparams/i386nto.sh (OUTPUT_FORMAT): Set to elf32-i386-nto.
> 
> ld/testsuite/
> 2002-10-27  H.J. Lu <hjl@gnu.org>
> 
> 	* ld-scripts/script.exp: Don't match "*-*-*-qnx" for "*-*-nt*".
> 
> --- binutils/bfd/Makefile.am.qnx	Sat Oct 19 14:20:14 2002
> +++ binutils/bfd/Makefile.am	Sun Oct 27 20:09:13 2002
> @@ -542,7 +542,9 @@ BFD_LIBS = @bfd_libs@
>  BFD_MACHINES = @bfd_machines@
>  TDEFAULTS = @tdefaults@
>  
> -INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
> +INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ \
> +	   $(TDEFAULTS) $(CSEARCH) $(CSWITCHES) \
> +	   -I$(srcdir)/../intl -I../intl
>  
>  # C source files that correspond to .o's.
>  SOURCE_CFILES = \
> @@ -655,10 +657,10 @@ targmatch.h: config.bfd targmatch.sed
>  # info from configure.
>  
>  targets.lo: targets.c config.status
> -	$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/targets.c
> +	$(LIBTOOL) --mode=compile $(COMPILE) -c $(srcdir)/targets.c
>  
>  archures.lo: archures.c config.status
> -	$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
> +	$(LIBTOOL) --mode=compile $(COMPILE) -c $(srcdir)/archures.c
>  
>  elf32-target.h : elfxx-target.h
>  	rm -f elf32-target.h
> --- binutils/bfd/configure.in.qnx	Sat Oct 19 14:20:15 2002
> +++ binutils/bfd/configure.in	Sun Oct 27 19:51:00 2002
> @@ -814,7 +814,7 @@ if test x${all_targets} = xtrue ; then
>    bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)'
>    bfd_machines="${bfd_machines}"' $(ALL_MACHINES)'
>    selvecs=
> -  havevecs=
> +  havevecs=-DHAVE_bfd_all_target_vectors
>    selarchs=
>  else	# all_targets is true
>    # Only set these if they will be nonempty, for the clever echo.
> --- binutils/bfd/elf32-i386.c.qnx	Sun Oct 27 20:02:39 2002
> +++ binutils/bfd/elf32-i386.c	Sun Oct 27 21:36:06 2002
> @@ -628,13 +628,38 @@ elf_i386_object_p (abfd)
>  {
>    /* Allocate our special target data.  */
>    struct elf_i386_obj_tdata *new_tdata;
> +  Elf_Internal_Ehdr * i_ehdrp;
> +
>    bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
>    new_tdata = bfd_zalloc (abfd, amt);
>    if (new_tdata == NULL)
>      return false;
>    new_tdata->root = *abfd->tdata.elf_obj_data;
>    abfd->tdata.any = new_tdata;
> -  return true;
> +
> +  i_ehdrp = elf_elfheader (abfd);
> +
> +  if (strcmp (bfd_get_target (abfd), "elf32-i386") == 0)
> +    return i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE;
> +
> +  /* If bfd is not configured for normal ELF/i386 nor all BFD targets
> +     are enabled, we will always match ELFOSABI_NONE.  */
> +#if !defined (HAVE_bfd_elf32_i386_vec) && !defined (HAVE_bfd_all_target_vectors)
> +  if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE)
> +     return true;
> +#endif
> +
> +  if (strcmp (bfd_get_target (abfd), "elf32-i386-freebsd") == 0)
> +    {
> +      if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_FREEBSD)
> +	return true;
> +    }
> +  else if (strcmp (bfd_get_target (abfd), "elf32-i386-nto") == 0)
> +    {
> +      if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_QNX)
> +	return true;
> +    }
> +  return false;
>  }
>  
>  /* i386 ELF linker hash table.  */
> @@ -3387,7 +3412,9 @@ elf_i386_finish_dynamic_sections (output
>  #define elf_backend_relocate_section	      elf_i386_relocate_section
>  #define elf_backend_size_dynamic_sections     elf_i386_size_dynamic_sections
>  
> +#if defined (HAVE_bfd_elf32_i386_vec) || defined (HAVE_bfd_all_target_vectors)
>  #include "elf32-target.h"
> +#endif
>  
>  /* FreeBSD support.  */
>  
> @@ -3400,11 +3427,11 @@ elf_i386_finish_dynamic_sections (output
>     "FreeBSD" label in the ELF header.  So we put this label on all
>     executables and (for simplicity) also all other object files.  */
>  
> -static void elf_i386_post_process_headers
> +static void elf_i386_freebsd_post_process_headers
>    PARAMS ((bfd *, struct bfd_link_info *));
>  
>  static void
> -elf_i386_post_process_headers (abfd, link_info)
> +elf_i386_freebsd_post_process_headers (abfd, link_info)
>       bfd *abfd;
>       struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
>  {
> @@ -3421,7 +3448,7 @@ elf_i386_post_process_headers (abfd, lin
>  }
>  
>  #undef	elf_backend_post_process_headers
> -#define	elf_backend_post_process_headers      elf_i386_post_process_headers
> +#define	elf_backend_post_process_headers	elf_i386_freebsd_post_process_headers
>  
>  #define	elf32_bed			elf32_i386_fbsd_bed
>  
> @@ -3433,6 +3460,23 @@ elf_i386_post_process_headers (abfd, lin
>  /* QNX support.  */
>  #include "elf32-qnx.h"
>  
> +static void elf_i386_qnx_post_process_headers
> +  PARAMS ((bfd *, struct bfd_link_info *));
> +
> +static void
> +elf_i386_qnx_post_process_headers (abfd, link_info)
> +     bfd *abfd;
> +     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
> +{
> +  Elf_Internal_Ehdr *i_ehdrp;
> +
> +  i_ehdrp = elf_elfheader (abfd);
> +  i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_QNX;
> +}
> +
> +#undef	elf_backend_post_process_headers
> +#define	elf_backend_post_process_headers	elf_i386_qnx_post_process_headers
> +
>  #undef	TARGET_LITTLE_SYM
>  #define	TARGET_LITTLE_SYM		bfd_elf32_i386qnx_vec
>  #undef	TARGET_LITTLE_NAME
> --- binutils/gas/config/tc-i386.h.qnx	Mon Oct 14 21:24:22 2002
> +++ binutils/gas/config/tc-i386.h	Sun Oct 27 20:59:47 2002
> @@ -63,6 +63,9 @@ extern unsigned long i386_mach PARAMS ((
>  #ifdef TE_FreeBSD
>  #define ELF_TARGET_FORMAT	"elf32-i386-freebsd"
>  #endif
> +#ifdef TE_QNX
> +#define ELF_TARGET_FORMAT	"elf32-i386-nto"
> +#endif
>  #ifndef ELF_TARGET_FORMAT
>  #define ELF_TARGET_FORMAT	"elf32-i386"
>  #endif
> --- binutils/gas/config/te-qnx.h.qnx	Sun Oct 27 20:57:56 2002
> +++ binutils/gas/config/te-qnx.h	Sun Oct 27 20:58:09 2002
> @@ -0,0 +1,4 @@
> +#define TE_QNX
> +#define LOCAL_LABELS_FB 1
> +
> +#include "obj-format.h"
> --- binutils/gas/configure.in.qnx	Sat Oct 19 14:20:25 2002
> +++ binutils/gas/configure.in	Sun Oct 27 20:57:10 2002
> @@ -297,7 +297,7 @@ changequote([,])dnl
>        i386-*-cygwin*)			fmt=coff em=pe ;;
>        i386-*-interix*)			fmt=coff em=interix ;;
>        i386-*-mingw32*)			fmt=coff em=pe ;;
> -      i386-*-nto-qnx*)			fmt=elf ;;
> +      i386-*-nto-qnx*)			fmt=elf em=qnx;;
>        i386-*-*nt*)			fmt=coff em=pe ;;
>        i386-*-vxworks*)			fmt=aout ;;
>        i386-*-chaos)			fmt=elf ;;
> --- binutils/include/elf/common.h.qnx	Wed Jul 17 10:17:34 2002
> +++ binutils/include/elf/common.h	Sun Oct 27 19:22:49 2002
> @@ -71,6 +71,7 @@ Foundation, Inc., 59 Temple Place - Suit
>  #define ELFOSABI_TRU64  10      /* TRU64 UNIX */
>  #define ELFOSABI_MODESTO 11     /* Novell Modesto */
>  #define ELFOSABI_OPENBSD 12     /* OpenBSD */
> +#define ELFOSABI_QNX	13	/* QNX */
>  #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
>  #define ELFOSABI_ARM   97	/* ARM */
>  
> --- binutils/ld/emulparams/i386nto.sh.qnx	Tue Jun  4 20:17:22 2002
> +++ binutils/ld/emulparams/i386nto.sh	Sun Oct 27 21:38:24 2002
> @@ -1,5 +1,5 @@
>  SCRIPT_NAME=elf
> -OUTPUT_FORMAT="elf32-i386"
> +OUTPUT_FORMAT="elf32-i386-nto"
>  TEXT_START_ADDR=0x08048000
>  TEXT_START_SYMBOLS='_btext = .;'
>  MAXPAGESIZE=0x1000
> --- binutils/ld/testsuite/ld-scripts/script.exp.qnx	Tue Jul 24 09:49:58 2001
> +++ binutils/ld/testsuite/ld-scripts/script.exp	Sun Oct 27 21:27:10 2002
> @@ -79,7 +79,9 @@ if {[istarget "*-*-pe*"] \
>      || [istarget "*-*-winnt*"] \
>      || [istarget "*-*-nt*"] \
>      || [istarget "*-*-interix*"] } then {
> -  set flags "--image-base 0"
> +  if {![istarget "*-*-*-qnx"]} then {
> +    set flags "--image-base 0"
> +  }
>  }
>  
>  if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
> 
> --82I3+IH0IqGh5yIs--
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]