Common areas and as

David Marston david at illudium.org.uk
Tue Oct 28 15:08:54 PST 2003


In message <3F9CE5C6.8080505 at dsvr.net>
          Nick Burrett <nick at dsvr.net> wrote:

> David Marston wrote:
> > If I change the area definitions to something like
> > 
> > 	AREA |C$$x|, DATA, COMMON
> > |x|
> > 	EXPORT |x|
> > 	
> > then I get the right relocations:
> > 
> > At 000214: Word [00000000] displaced by base of area C$$y
> > At 000210: Word [00000000] displaced by base of area C$$x
> 
> This is the way we used to have the AREA definitions.

Yes, exactly. I was just checking it was these changes that were causing
the problem.

> Thanks for the analysis.  I get the impression that we aren't making 
> symbol 'x' an member of area 'x'.  We probably aren't generating a 
> relocation at all.

They were there, just wrong. I've found the problem now, and can't
believe I didn't see it the first time given I'd changed the same piece
of logic in quite a few places already.

(It's the changes in reloc.c in particular that are for this problem,
but I thought I'd make sure it was changed everywhere)

D

-- 
David Marston
david at illudium.org.uk
-------------- next part --------------
Index: riscos-aof/as/area.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/area.c,v
retrieving revision 1.4
diff -u -r1.4 area.c
--- riscos-aof/as/area.c	18 Aug 2003 18:08:09 -0000	1.4
+++ riscos-aof/as/area.c	28 Oct 2003 23:02:40 -0000
@@ -221,7 +221,7 @@
   sym = symbolGet (lexGetId ());
   if (sym->type & SYMBOL_DEFINED)
     error (ErrorError, TRUE, "Redefinition of label to area %s", sym->str);
-  else if (sym->type == SYMBOL_AREA)
+  else if (sym->type & SYMBOL_AREA)
     oldtype = sym->area.info->type;
   else
     {
Index: riscos-aof/as/reloc.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/reloc.c,v
retrieving revision 1.6
diff -u -r1.6 reloc.c
--- riscos-aof/as/reloc.c	20 Oct 2003 20:47:08 -0000	1.6
+++ riscos-aof/as/reloc.c	28 Oct 2003 23:02:47 -0000
@@ -260,7 +260,7 @@
 	  for (late = value->ValueLate.late; late; late = late->next)
 	    if (late->factor > 0)
 	      {
-		if (late->symbol->type != SYMBOL_AREA)
+		if (!(late->symbol->type & SYMBOL_AREA))
 		  late->symbol->used++;
 		this += late->factor;
 	      }
@@ -277,7 +277,7 @@
 	    {
 	      if (late->factor > 0)
 		{
-		  if (late->symbol->type != SYMBOL_AREA)
+		  if (!(late->symbol->type & SYMBOL_AREA))
 		    {
 		      late->symbol->used++;
 		    }
@@ -299,7 +299,7 @@
 	case RelocAdrl:
 	  for (late = value->ValueLate.late; late; late = late->next)
 	    if (late->factor > 0)
-	      if (late->symbol->type != SYMBOL_AREA)
+	      if (!(late->symbol->type & SYMBOL_AREA))
 		late->symbol->used++;
 	  break;
 	case ValueInt:
@@ -579,7 +579,7 @@
 	  if (relocs->value.ValueCode.c[ip].Tag != CodeSymbol)
 	    errorLine (relocs->lineno, relocs->file, ErrorSerious, TRUE, "Internal error in relocsOutput");
 	  areloc.How = How | relocs->value.ValueCode.c[ip].CodeSymbol.symbol->used;
-	  if (relocs->value.ValueCode.c[ip].CodeSymbol.symbol->type != SYMBOL_AREA)
+	  if (!(relocs->value.ValueCode.c[ip].CodeSymbol.symbol->type & SYMBOL_AREA))
 	    areloc.How |= HOW2_SYMBOL;
 	  areloc.How = armword(areloc.How);
 	  while (loop--)
@@ -661,7 +661,7 @@
             errorLine (relocs->lineno, relocs->file, ErrorSerious, TRUE, "Internal error in relocsOutput");
 
           How = How | relocs->value.ValueCode.c[ip].CodeSymbol.symbol->used;
-          if (relocs->value.ValueCode.c[ip].CodeSymbol.symbol->type != SYMBOL_AREA)
+          if (!(relocs->value.ValueCode.c[ip].CodeSymbol.symbol->type & SYMBOL_AREA))
             How |= HOW2_SYMBOL;
 
         symbol = (How & HOW3_SIDMASK) + 1;
Index: riscos-aof/as/symbol.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/symbol.c,v
retrieving revision 1.10
diff -u -r1.10 symbol.c
--- riscos-aof/as/symbol.c	22 Oct 2003 18:24:28 -0000	1.10
+++ riscos-aof/as/symbol.c	28 Oct 2003 23:02:53 -0000
@@ -88,7 +88,7 @@
 	    }
 	  else
 	    {
-	      if ((*isearch)->type == SYMBOL_AREA)
+	      if ((*isearch)->type & SYMBOL_AREA)
 		{
 		  strncpy (er, l.LexId.str, l.LexId.len);
 		  er[l.LexId.len] = 0;
@@ -301,7 +301,7 @@
 		case ValueLateLabel:
 		  if (!value.ValueLate.late->next &&	/* Only one late label */
 		      value.ValueLate.late->factor == 1 &&	/* ... occuring one time */
-		      value.ValueLate.late->symbol->type == SYMBOL_AREA)
+		      value.ValueLate.late->symbol->type & SYMBOL_AREA)
 		    {		/* ... and it is an area */
 		      if (sym->type & SYMBOL_ABSOLUTE)
 			{	/* Change absolute to relative */
@@ -435,7 +435,7 @@
                   if (!value.ValueLate.late->next &&    /* Only one late label */
                       value.ValueLate.late->factor == 1 &&      /* ... occuring
 one time */
-                      value.ValueLate.late->symbol->type == SYMBOL_AREA)
+                      value.ValueLate.late->symbol->type & SYMBOL_AREA)
                     {           /* ... and it is an area */
                       if (sym->type & SYMBOL_ABSOLUTE)
                         {       /* Change absolute to relative */


More information about the gcc mailing list