Imported Symbol Attributes

Ian Lance Taylor ian@wasabisystems.com
Mon Feb 9 23:10:00 GMT 2004


GroundVehicle2@aol.com writes:

>   .extern This_Symbol
>   .section This_Section
>   nop
>   .dc.l .-This_Symbol
>   .end
> 
> Question:
> 
>    If the symbol "This_Symbol" is defined in another file in the same section "This_Section" why does the assembler not
> understand what section "This_Symbol" belongs to.

The assembler only sees one file at a time.  How could the assembler
possibly know what section This_Symbol is in?

The above code won't work in most object file formats because there is
no way to represent the required relocation.  Most object file formats
do not have a relocation for a negated symbol value.

On the other hand,
    .dc.l This_Symbol - .
will generally work, since that is a PC relative relocation.

Ian



More information about the Binutils mailing list