This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Imported Symbol Attributes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]