This is the mail archive of the binutils@sourceware.cygnus.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]

Linker warnings and m68k-a.out


Hi,

gas configured for m68k-a.out doesn't write out linker warning symbols.
Both N_WARNING and N_REGISTER expand to the same value and when filtering
out the register symbols, the warnings symbols will also be omitted.

The patch at the end of this mail fixes that bug.  I suspect that the
files gas/config/obj-bout.c and gas/config/obj-vms.c are hit by the same
bug as gas/config/obj-aout.c but I can't verify that here.  Maybe somebody
else could check that.

The patch makes the (hopefully correct) assumption that the list walk in
obj_crawl_symbol_chain in obj-aout.c will never encounter symbols that
were created with symbol_new().  If this assumption is wrong there must be
found another solution.

Ciao

Guido
-- 
http://stud.uni-saarland.de/~gufl0000/
Send your spam to president@whitehouse.gov and your replies to
mailto:guido at freemint dot de

--- binutils-2.9.5.0.22/gas/config/tc-m68k.c.gfl	Mon Jul 12 17:13:50 1999
+++ binutils-2.9.5.0.22/gas/config/tc-m68k.c	Tue Mar 28 14:07:02 2000
@@ -1,5 +1,5 @@
 /* tc-m68k.c -- Assemble for the m68k family
-   Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1987, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -3248,14 +3248,17 @@
     }
 #endif
 
-  symbol_table_insert (symbol_new (regname, reg_section, regnum,
+  /* Use symbol_create here instead of symbol_new so we don't try to
+     output registers into the object file's symbol table.  */
+  symbol_table_insert (symbol_create (regname, reg_section, regnum,
 				   &zero_address_frag));
 
   for (i = 0; regname[i]; i++)
     buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
   buf[i] = '\0';
 
-  symbol_table_insert (symbol_new (buf, reg_section, regnum,
+  /* Must be symbol_create (see above).  */
+  symbol_table_insert (symbol_create (buf, reg_section, regnum,
 				   &zero_address_frag));
 }
 
--- binutils-2.9.5.0.22/gas/config/obj-aout.c.gfl	Sun Jun 27 01:02:40 1999
+++ binutils-2.9.5.0.22/gas/config/obj-aout.c	Tue Mar 28 14:23:24 2000
@@ -1,5 +1,5 @@
 /* a.out object file format
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -483,22 +483,26 @@
 	 * symbols with debug info in their N_TYPE
 
 	 Symbols that don't are:
-	 * symbols that are registers
 	 * symbols with \1 as their 3rd character (numeric labels)
 	 * "local labels" as defined by S_LOCAL_NAME(name) if the -L
 	 switch was passed to gas.
 
+	 Register symbols are also not output but if they have been
+	 properly created with symbol_create instead of symbol_new
+	 we never see them here.  Since N_REGISTER (struc-symbol.h)
+	 and N_WARNING (gnu_aout.h) expand to the same value any 
+	 extra check for register symbols here would prevent
+	 linker warning symbols from being written out.
+	 
 	 All other symbols are output.  We complain if a deleted
-	 symbol was marked external. */
+	 symbol was marked external.  */
 
-
-      if (!S_IS_REGISTER (symbolP)
-	  && (!S_GET_NAME (symbolP)
+      if (!S_GET_NAME (symbolP)
 	      || S_IS_DEBUG (symbolP)
 	      || !S_IS_DEFINED (symbolP)
 	      || S_IS_EXTERNAL (symbolP)
 	      || (S_GET_NAME (symbolP)[0] != '\001'
-		  && (flag_keep_locals || !S_LOCAL_NAME (symbolP)))))
+		  && (flag_keep_locals || !S_LOCAL_NAME (symbolP))))
 	{
 	  symbolP->sy_number = symbol_number++;
 

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