[Coco] More progress
Lothan
lothan at newsguy.com
Sun Dec 28 23:06:33 EST 2008
The primary psect directive is defined in cstart.a/cstart.r. This is in
nitros9/3rdparty/packages/cc/sources/cstart.a:
psect cstart_a,$11,$81,Edit,Stk,_cstart
where _cstart is the actual entry point of the application defined in
cstart.r. This is the code that splits the command line into a
null-terminated array, performs various housekeeping, and eventually calls
lbsr main. If I remember correctly, all other psect directives just define
the psect name and stack requirement for that code file.
When I attempt to compile a C source file using cc1, it generates these
command lines:
c.prep test.c >ctmp.3.m
c.pass1 ctmp.3.m -o=ctmp.3.i
c.pass2 ctmp.3.i -o=ctmp.3.a
c.opt ctmp.3.a ctmp.3.o
c.asm ctmp.3.o -o=ctmp.3.r
c.link /dd/lib/cstart.r ctmp.3.r -o=test -l=/dd/lib/clib.l
I think those last two are equivalent to:
rma ctmp.3.o -o=ctmp.3.r
rlink /dd/lib/cstart.r ctmp.3.r -o=test -l=/dd/lib/clib.l
If I can find all the right pieces, I'll update my ancient cc1 with the
newer one that calls rma and rlink instead of c.asm and c.link. I haven't
done much with it lately because MESS doesn't seem to like my Logitech
diNovo Edge keyboard for some reason.
--------------------------------------------------
From: "Steven Hirsch" <snhirsch at gmail.com>
Sent: Sunday, December 28, 2008 9:18 PM
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Subject: Re: [Coco] More progress
> On Sun, 28 Dec 2008, Boisy Pitre wrote:
>
>> Steve,
>>
>> Change your line to:
>>
>> rlink -l=/dd/lib/clib.l -o=hello.r cstart.r hello.r
>>
>> The symbols you mentioned are located in cstart.r (the C runtime). If
>> you don't have it I probably can send it to you.
>
> Boisy, et al,
>
> I was able to hack one together by taking cstart.a from the CoCo compiler
> and and os9defs.a I found in the NitrOS9 distribution. I actually had to
> ensure that the C library came last:
>
> $ rlink hello.r cstart.r -l=/dd/lib/clib.l -o=hello
>
> Now, on to the code generation issues. I cannot see anything in the
> compiler sources that would properly set the psect pseudo-op to the
> correct language/type value. The compiler has a line that hard-codes zero
> for this value and the following one in the header.
>
> Unless I edit by hand, the linker complains:
>
> linker fatal: 'hello.r' contains no mainline
>
>>From reading the code, this is based on the fact that it's finding zero as
> the language/type value.
>
> In a "real" situation, do you know what modifies the psect line for the
> primary program?
>
> Steve
>
> (almost there now)
>
>
> --
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list