2012-12-11 Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* bfd/config.bfd: Add bfd_elf32_i386_vec to the vectors to build
	for this target.

	* gas/configure: Add i386elf to the list of supported emulations.

	* gas/configure.in: Add i386elf to the list of supported emulations.

	* ld/configure.tgt: Add elf_i386 to the list of additional linker
	emulations to be provided.

	* gas/config/tc-i386.c (md_pseudo_table): Copy file, loc and
	loc_mark_labels to GO32 section so they are honored even if
	ELF is supported as emulation.  (Revision 1.197)





diff -aprNU5 binutils-2.23.2.orig/bfd/config.bfd binutils-2.23.2/bfd/config.bfd
--- binutils-2.23.2.orig/bfd/config.bfd	2012-09-04 15:14:58 +0000
+++ binutils-2.23.2/bfd/config.bfd	2013-03-31 16:24:58 +0000
@@ -526,11 +526,11 @@ case "${targ}" in
     targ_defvec=bfd_elf32_i386_vec
     targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
     ;;
   *-*-msdosdjgpp* | *-*-go32* )
     targ_defvec=go32coff_vec
-    targ_selvecs="go32stubbedcoff_vec i386aout_vec"
+    targ_selvecs="go32stubbedcoff_vec bfd_elf32_i386_vec i386aout_vec"
     ;;
   i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \
   i[3-7]86-*-aix*)
     targ_defvec=i386coff_vec
     ;;
diff -aprNU5 binutils-2.23.2.orig/gas/config/tc-i386.c binutils-2.23.2/gas/config/tc-i386.c
--- binutils-2.23.2.orig/gas/config/tc-i386.c	2012-11-09 14:32:04 +0000
+++ binutils-2.23.2/gas/config/tc-i386.c	2013-03-31 16:24:58 +0000
@@ -853,10 +853,17 @@ const pseudo_typeS md_pseudo_table[] =
   {"att_mnemonic", set_intel_mnemonic, 0},
   {"allow_index_reg", set_allow_index_reg, 1},
   {"disallow_index_reg", set_allow_index_reg, 0},
   {"sse_check", set_sse_check, 0},
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+#ifdef TE_GO32
+  /*  DJGPP always requires these entries no mather
+      if ELF is supported as an emulation or not.  */
+  {"file", (void (*) (int)) dwarf2_directive_file, 0},
+  {"loc", dwarf2_directive_loc, 0},
+  {"loc_mark_labels", dwarf2_directive_loc_mark_labels, 0},
+#endif
   {"largecomm", handle_large_common, 0},
 #else
   {"file", (void (*) (int)) dwarf2_directive_file, 0},
   {"loc", dwarf2_directive_loc, 0},
   {"loc_mark_labels", dwarf2_directive_loc_mark_labels, 0},
diff -aprNU5 binutils-2.23.2.orig/gas/configure binutils-2.23.2/gas/configure
--- binutils-2.23.2.orig/gas/configure	2012-06-18 05:43:06 +0000
+++ binutils-2.23.2/gas/configure	2013-03-31 16:24:58 +0000
@@ -12272,10 +12272,11 @@ _ACEOF
       i386-*-pe-coff)	;;
       # Uncommenting the next line will turn on support for i386 AOUT
       # for the default linux configuration
       # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
       #
+      i386-*-msdosdjgpp*-coff) emulation="i386coff i386elf" ;;
       i386-*-aout)	emulation="i386aout" ;;
       i386-*-coff)	emulation="i386coff" ;;
       i386-*-elf)	emulation="i386elf" ;;
 
       # Always all formats.  The first stated emulation becomes the default.
diff -aprNU5 binutils-2.23.2.orig/gas/configure.in binutils-2.23.2/gas/configure.in
--- binutils-2.23.2.orig/gas/configure.in	2012-11-05 17:27:44 +0000
+++ binutils-2.23.2/gas/configure.in	2013-03-31 16:24:58 +0000
@@ -436,10 +436,11 @@ changequote([,])dnl
       i386-*-pe-coff)	;;
       # Uncommenting the next line will turn on support for i386 AOUT
       # for the default linux configuration
       # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
       #
+      i386-*-msdosdjgpp*-coff) emulation="i386coff i386elf" ;;
       i386-*-aout)	emulation="i386aout" ;;
       i386-*-coff)	emulation="i386coff" ;;
       i386-*-elf)	emulation="i386elf" ;;
 
       # Always all formats.  The first stated emulation becomes the default.
diff -aprNU5 binutils-2.23.2.orig/ld/configure.tgt binutils-2.23.2/ld/configure.tgt
--- binutils-2.23.2.orig/ld/configure.tgt	2012-09-04 13:53:46 +0000
+++ binutils-2.23.2/ld/configure.tgt	2013-03-31 16:24:58 +0000
@@ -187,11 +187,12 @@ hppa*-*-openbsd*)	targ_emul=hppaobsd
 i370-*-elf* | i370-*-linux-*) targ_emul=elf32i370
 			;;
 i[3-7]86-*-nto-qnx*)	targ_emul=i386nto ;;
 i[3-7]86-*-vsta)	targ_emul=vsta ;;
 i[3-7]86-*-go32)	targ_emul=i386go32 ;;
-i[3-7]86-*-msdosdjgpp*) targ_emul=i386go32 ;;
+i[3-7]86-*-msdosdjgpp*) targ_emul=i386go32
+			targ_extra_emuls=elf_i386 ;;
 i[3-7]86-*-aix*)	targ_emul=i386coff ;;
 i[3-7]86-*-sco*)	targ_emul=i386coff ;;
 i[3-7]86-*-isc*)	targ_emul=i386coff ;;
 i[3-7]86-*-lynxos*)	targ_emul=i386lynx ;;
 i[3-7]86-*-coff)	targ_emul=i386coff ;;
