This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Patch: Only use strict COFF for djgpp
- To: Nick Clifton <nickc at redhat dot com>
- Subject: Re: Patch: Only use strict COFF for djgpp
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Tue, 22 Aug 2000 08:20:50 -0700
- Cc: snowball3 at bigfoot dot com, ian at zembu dot com,binutils at sourceware dot cygnus dot com
- References: <200008220007.RAA24195@elmo.cygnus.com>
On Mon, Aug 21, 2000 at 05:07:45PM -0700, Nick Clifton wrote:
> If you could resubmit a patch with these changes I would be happy to
> approve it.
>
Here is the patch.
Thanks.
H.J.
---
2000-08-22 H.J. Lu <hjl@gnu.org>
* config.in (STRICTCOFF): New for strict COFF.
* configure.in: Define STRICTCOFF for i386-*-msdosdjgpp*,
i386-*-go32* and i386-go32-rtems*.
* configure: Rebuilt.
* config/obj-coff.c (obj_coff_endef): Follow the historical
behavior if STRICTCOFF is not defined.
* doc/internals.texi: Document STRICTCOFF.
Index: config.in
===================================================================
RCS file: /work/cvs/gnu/binutils/gas/config.in,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 config.in
--- config.in 1999/06/03 18:01:57 1.1.1.1
+++ config.in 2000/08/19 17:28:05
@@ -166,6 +166,9 @@
/* Using cgen code? */
#undef USING_CGEN
+/* Using strict COFF? */
+#undef STRICTCOFF
+
/* Using i386 COFF? */
#undef I386COFF
Index: configure.in
===================================================================
RCS file: /work/cvs/gnu/binutils/gas/configure.in,v
retrieving revision 1.31
diff -u -p -r1.31 configure.in
--- configure.in 2000/08/16 02:37:52 1.31
+++ configure.in 2000/08/19 17:28:14
@@ -251,7 +251,9 @@ changequote([,])dnl
i386-*-sco3.2*) fmt=coff ;;
i386-*-vsta) fmt=aout ;;
i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
- fmt=coff em=go32;;
+ fmt=coff em=go32
+ AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
+ ;;
i386-*-rtemself*) fmt=elf ;;
i386-*-rtems*) fmt=coff ;;
i386-*-gnu*) fmt=elf ;;
Index: config/obj-coff.c
===================================================================
RCS file: /work/cvs/gnu/binutils/gas/config/obj-coff.c,v
retrieving revision 1.1.1.21
diff -u -p -r1.1.1.21 obj-coff.c
--- config/obj-coff.c 2000/08/16 00:53:47 1.1.1.21
+++ config/obj-coff.c 2000/08/22 15:11:38
@@ -732,13 +732,49 @@ obj_coff_endef (ignore)
case C_ARG:
case C_REGPARM:
case C_FIELD:
+
+ /* According to the COFF documentation:
+
+ http://osr5doc.sco.com:1996/topics/COFF_SectNumFld.html
+
+ A special section number (-2) marks symbolic debugging symbols,
+ including structure/union/enumeration tag names, typedefs, and
+ the name of the file. A section number of -1 indicates that the
+ symbol has a value but is not relocatable. Examples of
+ absolute-valued symbols include automatic and register variables,
+ function arguments, and .eos symbols.
+
+ But from Ian Lance Taylor:
+
+ http://sources.redhat.com/ml/binutils/2000-08/msg00202.html
+
+ the actual tools all marked them as section -1. So the GNU COFF
+ assembler follows historical COFF assemblers.
+
+ However, it causes problems for djgpp
+
+ http://sources.redhat.com/ml/binutils/2000-08/msg00210.html
+
+ By defining STRICTCOFF, a COFF port can make the assembler to
+ follow the documented behavior. */
+#ifdef STRICTCOFF
case C_MOS:
case C_MOE:
case C_MOU:
case C_EOS:
+#endif
SF_SET_DEBUG (def_symbol_in_progress);
S_SET_SEGMENT (def_symbol_in_progress, absolute_section);
break;
+
+#ifndef STRICTCOFF
+ case C_MOS:
+ case C_MOE:
+ case C_MOU:
+ case C_EOS:
+ S_SET_SEGMENT (def_symbol_in_progress, absolute_section);
+ break;
+#endif
case C_EXT:
case C_WEAKEXT:
Index: doc/internals.texi
===================================================================
RCS file: /work/cvs/gnu/binutils/gas/doc/internals.texi,v
retrieving revision 1.1.1.12
diff -u -p -r1.1.1.12 internals.texi
--- doc/internals.texi 2000/07/09 23:38:11 1.1.1.12
+++ doc/internals.texi 2000/08/22 15:17:05
@@ -773,6 +773,12 @@ variable. Normally the default value of
configuration process will create a file named @file{targ-env.h} in the build
directory which includes @file{te-@var{em}.h}.
+There is a special case for COFF. For historical reason, the GNU COFF
+assembler doesn't follow the documented behavior on certain debug symbols for
+the compatibility with other COFF assemblers. A port can define
+@code{STRICTCOFF} in the configure script to make the GNU COFF assembler
+to follow the documented behavior.
+
Porting GAS to a new CPU requires writing the @file{tc-@var{CPU}} files.
Porting GAS to a new object file format requires writing the
@file{obj-@var{fmt}} files. There is sometimes some interaction between these