Common areas and as

David Marston david at
Tue Oct 21 12:00:47 PDT 2003

Since I've been looking at 'as' anyway I had a look at the common area

It seems 'objasm' generates symbols for every area definition in the
assembly, whereas 'as' deliberately doesn't. The first attached patch
changes 'as' to generate symbols for the areas so the behaviour is the
same as 'objasm'.

The gccsdk build gets a lot further with this now, so there were a
couple of other things that needed fixing (these are in the second
attached patch):

gcc/gcc/config/arm/riscos-aof.h: The bss areas shouldn't be COMMON (I
guess Nick already fixed this in his local copy since he wasn't seeing
the bss errors).

riscos-aof/drlink/files.c: The behaviour of __riscosify_control has

unixlib/source/module/sul.s: Not connected to this, but I've had it a
while and forgot to send it. The no such SWI exit wasn't 32-bit safe.

Anyway, after fixing these things it gets as far as the stage2 libfile
build before complaining about a symbol being defined in two files. This
looks like it's caused by the new area symbols. There is a definition of
a common area in both of the two files, and now the symbol is generated
as well there are two global symbols with the same name.

I'd guess this means it's not sensible to EXPORT the area names, which
brings us back to where we started. I'll keep looking at it, but does
anyone have any suggestions?

David Marston
david at
-------------- next part --------------
Index: riscos-aof/as/asm.c
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/asm.c,v
retrieving revision 1.4
diff -r1.4 asm.c
< //  symbol = symbolAdd (*label);
<   symbol = symbolGet(*label);
>   symbol = symbolAdd (*label);
> //  symbol = symbolGet(*label);
Index: riscos-aof/as/code.c
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/code.c,v
retrieving revision 1.4
diff -r1.4 code.c
<    error (ErrorWarning, TRUE, "codeSymbol");
Index: riscos-aof/as/commands.c
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/commands.c,v
retrieving revision 1.7
diff -r1.7 commands.c
<   symFlag (SYMBOL_GLOBAL, 1, "exported");
>   symFlag (SYMBOL_REFERENCE, 1, "exported");
Index: riscos-aof/as/symbol.c
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/as/symbol.c,v
retrieving revision 1.8
diff -r1.8 symbol.c
< 	  if (sym->type == SYMBOL_AREA)
> 	  if (sym->type & SYMBOL_AREA)
> 	      nosym++;
< 	if (SYMBOL_OUTPUT (sym) /*(sym)->used >= 0 */  || sym->type == SYMBOL_AREA)
> 	if (SYMBOL_OUTPUT (sym) /*(sym)->used >= 0 */  || sym->type & SYMBOL_AREA)
<       if (sym->type != SYMBOL_AREA && SYMBOL_OUTPUT (sym) /*sym->used >= 0 */ )
>       if (!(sym->type & SYMBOL_AREA) && SYMBOL_OUTPUT (sym) /*sym->used >= 0*/ )
>       else if (sym->type & SYMBOL_AREA)
> 	{
> 	  asym.Name = armword (sym->offset);
> 	  asym.Type = armword (SYMBOL_KIND(sym->type)|SYMBOL_LOCAL);
> 	  asym.Value = armword (0);
> 	  asym.AreaName = armword (sym->offset);
> 	  fwrite ((void *) &asym, sizeof (AofSymbol), 1, outfile);
> 	}
-------------- next part --------------
Index: gcc/gcc/config/arm/riscos-aof.h
RCS file: /usr/local/cvsroot/gccsdk/gcc/gcc/config/arm/riscos-aof.h,v
retrieving revision 1.10
diff -r1.10 riscos-aof.h
< #define BSS_SECTION_ASM_OP "\tAREA\t|C$$bss|, DATA, COMMON"
> #define BSS_SECTION_ASM_OP "\tAREA\t|C$$bss|, DATA, NOINIT"
Index: riscos-aof/drlink/files.c
RCS file: /usr/local/cvsroot/gccsdk/riscos-aof/drlink/files.c,v
retrieving revision 1.5
diff -r1.5 files.c
<   int riscosifyc = __riscosify_control;
>   int __riscosify_control;
<   __riscosify_control = riscosifyc;
Index: unixlib/source/module/sul.s
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/module/sul.s,v
retrieving revision 1.4
diff -r1.4 sul.s
< 	ORRS    pc, lr, #VFlag
> 	TEQ	pc, pc
> 	ORRNES	pc, lr, #VFlag
> 	MSR	CPSR_f, #VFlag
> 	MOV	pc, lr
< 	; The memory claimed for now merely provides a way validate a caller.
> 	; The memory claimed for now merely provides a way to validate a caller.

More information about the gcc mailing list