On Sep 6, 2008, at 8:32 PM, Richard Erlacher wrote:
>> The assembler generates relocatable object files.  The linker
>> translates those relocatable addresses into absolute addresses, and
>> writes the resulting memory image to the output file.
>>
> I know what a linker does for a living.  I just don't know why I'd  
> have to
> use one when my object code is probably going to be no larger than  
> 64 kB.
> That would probably only amount to about 25-30 k-lines of code,  
> depending on
> tables sizes, etc, and that shouldn't require a linker be involved  
> at all.

   Because the assembler outputs relocatable object files, not  
absolute binaries.  Nearly all assemblers do this, whether their  
inputs are absolutely-addressed or not.

>> If all of your addresses are explicitly defined, then the linker
>> has very little to do other than generate the memory image to the
>> output file.  No modern assembler that I'm aware of generates binary
>> (or hex-ified binary) files directly; asx8051 is no exception.
>>
> Most of the assemblers I've used over the years do exactly that, as  
> they're
> processor-specific and not intended for use together with other tools.

   This is actually rather rare.  Yes, it does happen (CP/M's  
assembler comes to mind) but it's not the norm.

>   So
> you're saying this one isn't able to generate .hex and .omf files  
> directly,
> is that right?

   The assembler?  No, it's not.  That's the linker's job.

>   Do you know of any assemblers, not associated with one
> compiler or another, that behave in this way?  I've not encounterd  
> them,
> though I've used numerous compiler/assembler/linker/debugger  
> suites.  I'm
> sure I've got at least a half-dozen assemblers that simply take a  
> source
> file and produce .hex or, in the case of MOT processors, .s19 output.

   I've got a few myself.  None that are at all recent, though.

> Since I'd see no need for a linker in this context, I'd never have  
> looked at
> the linker doc's to find out how to drive the assembler and  
> generate the
> necessary output.  This is useful information.

   Understood.  I can see how that'd be particularly confusing.  Just  
think of what you're used to as being the "assembler" as being split  
into two components; that's probably the easiest way to envision this  
setup.

             -Dave

--
Dave McGuire
Port Charlotte, FL


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to