patch for .set on AIX

Geoff Keating geoffk@cygnus.com
Tue Jan 25 22:30:00 GMT 2000


I think this patch fixes the problems with .set under AIX.
At least, it should now work out-of-the-box with current CVS GCC for
variable aliases, and needs only a minor change to GCC to make
function aliases work.

The tc-ppc.c patch is I think just an extension of this patch:

Thu Apr 23 19:23:23 1998  Ian Lance Taylor  <ian@cygnus.com>

	* config/tc-ppc.c (ppc_fix_adjustable): Correct test of whether a
	reloc is in the TOC csect.
	(md_apply_fix3): Correct gettext typo.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File /mnt/celeste/home/geoffk/patches/rs6000-gas.set-2.patch===
md5sum: 14695d799fa1194e d6700188fedc64ca 174700
Index: binutils/gas/ChangeLog
0a
2000-01-25  Geoff Keating  <geoffk@cygnus.com>

	* config/obj-coff.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Don't define if
	already defined.
	* config/tc-ppc.h [OBJ_XCOFF] (OBJ_COPY_SYMBOL_ATTRIBUTES): 
	New macro.
	* config/tc-ppc.c (ppc_fix_adjustable): Don't look at the frag
	of a symbol when we really care about its value.

.
Changed files:
binutils/gas/ChangeLog
binutils/gas/config/obj-coff.h
binutils/gas/config/tc-ppc.c
binutils/gas/config/tc-ppc.h
md5sum: f198689d6a9cb4fe 069d6c340de2f85a 31619
--- /bluey/co/binutils-mainline/binutils/gas/config/obj-coff.h	Tue Jan 25 21:53:26 2000
+++ binutils/gas/config/obj-coff.h	Tue Jan 25 22:04:49 2000
@@ -1,6 +1,5 @@
 /* coff object file format
-   Copyright (C) 1989, 90, 91, 92, 94, 95, 96, 97, 98, 1999
-   Free Software Foundation, Inc.
+   Copyright (C) 1989, 90-99, 2000 Free Software Foundation, Inc.
 
    This file is part of GAS.
 
@@ -371,6 +370,7 @@ extern symbolS *coff_last_function;
 
 /* Forward the segment of a forwarded symbol, handle assignments that
    just copy symbol values, etc.  */
+#ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
 #ifndef TE_I386AIX
 #define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src) \
   (SF_GET_GET_SEGMENT (dest) \
@@ -381,6 +381,7 @@ extern symbolS *coff_last_function;
   (SF_GET_GET_SEGMENT (dest) && S_GET_SEGMENT (dest) == SEG_UNKNOWN \
    ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \
    : 0)
+#endif
 #endif
 
 /* sanity check */
md5sum: 2fe53723e980abf9 c368ed73c142c054 126816
--- /bluey/co/binutils-mainline/binutils/gas/config/tc-ppc.c	Tue Jan 25 21:53:26 2000
+++ binutils/gas/config/tc-ppc.c	Tue Jan 25 22:04:18 2000
@@ -1,5 +1,5 @@
 /* tc-ppc.c -- Assemble for the PowerPC or POWER (RS/6000)
-   Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95-99, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GAS, the GNU Assembler.
@@ -4556,14 +4556,13 @@ ppc_fix_adjustable (fix)
 	{
 	  while (symbol_get_tc (csect)->next != (symbolS *) NULL
 		 && (symbol_get_frag (symbol_get_tc (csect)->next)->fr_address
-		     <= symbol_get_frag (fix->fx_addsy)->fr_address))
+		     <= val))
 	    {
 	      /* If the csect address equals the symbol value, then we
                  have to look through the full symbol table to see
                  whether this is the csect we want.  Note that we will
                  only get here if the csect has zero length.  */
-	      if ((symbol_get_frag (csect)->fr_address
-		   == symbol_get_frag (fix->fx_addsy)->fr_address)
+	      if ((symbol_get_frag (csect)->fr_address == val)
 		  && S_GET_VALUE (csect) == S_GET_VALUE (fix->fx_addsy))
 		{
 		  symbolS *scan;
md5sum: 00ec45f621704d6c 552f4ee48a6efc43 9370
--- /bluey/co/binutils-mainline/binutils/gas/config/tc-ppc.h	Tue Jan 25 21:53:26 2000
+++ binutils/gas/config/tc-ppc.h	Tue Jan 25 22:28:30 2000
@@ -1,5 +1,5 @@
 /* tc-ppc.h -- Header file for tc-ppc.c.
-   Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95-99, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GAS, the GNU Assembler.
@@ -186,6 +186,19 @@ extern void ppc_adjust_symtab PARAMS ((v
 
 /* Niclas Andersson <nican@ida.liu.se> says this is needed.  */
 #define SUB_SEGMENT_ALIGN(SEG) 2
+
+/* We also need to copy, in particular, the class of the symbol,
+   over what obj-coff would otherwise have copied.  */
+#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src)			\
+do {								\
+  if (SF_GET_GET_SEGMENT (dest))				\
+    S_SET_SEGMENT (dest, S_GET_SEGMENT (src));			\
+  symbol_get_tc (dest)->size = symbol_get_tc (src)->size;	\
+  symbol_get_tc (dest)->align = symbol_get_tc (src)->align;	\
+  symbol_get_tc (dest)->class = symbol_get_tc (src)->class;	\
+  symbol_get_tc (dest)->within = symbol_get_tc (src)->within;	\
+} while (0)
+
 
 #endif /* OBJ_XCOFF */
 
============================================================


More information about the Binutils mailing list