Common areas and as

David Marston david at illudium.org.uk
Tue Oct 21 12:00:47 PDT 2003


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

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
changed.

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?

D
-- 
David Marston
david at illudium.org.uk
-------------- 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
82,83c82,83
< //  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
70,71d69
<    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
318c318
<   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
174c174
< 	  if (sym->type == SYMBOL_AREA)
---
> 	  if (sym->type & SYMBOL_AREA)
177a178
> 	      nosym++;
239c240
< 	if (SYMBOL_OUTPUT (sym) /*(sym)->used >= 0 */  || sym->type == SYMBOL_AREA)
---
> 	if (SYMBOL_OUTPUT (sym) /*(sym)->used >= 0 */  || sym->type & SYMBOL_AREA)
262c263
<       if (sym->type != SYMBOL_AREA && SYMBOL_OUTPUT (sym) /*sym->used >= 0 */ )
---
>       if (!(sym->type & SYMBOL_AREA) && SYMBOL_OUTPUT (sym) /*sym->used >= 0*/ )
339a341,350
>       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
171c171
< #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
1010c1010
<   int riscosifyc = __riscosify_control;
---
>   int __riscosify_control;
1035d1034
<   __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
85c85,88
< 	ORRS    pc, lr, #VFlag
---
> 	TEQ	pc, pc
> 	ORRNES	pc, lr, #VFlag
> 	MSR	CPSR_f, #VFlag
> 	MOV	pc, lr
156c159
< 	; 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