This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: symbol resolution in linker?
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: "Vineet Sharma, Noida" <vineets at noida dot hcltech dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 29 Nov 2003 09:10:06 -0500
- Subject: Re: symbol resolution in linker?
- References: <1B3885BC15C7024C845AAC78314766C50134081B@EXCH-01>
"Vineet Sharma, Noida" <vineets@noida.hcltech.com> writes:
> If my assembler sees any undefined symbol (say "xyz"), it makes an entry of
> symbol "xyz"(section "*UND*") and a reloc entry.
> Now when my linker tries to resolve the address. it does not resolve
> it(inspite of the fact that this symbol "xyz" is defined in another object
> file linked with it.
When you say that the symbol is defined in another object file, what
are you basing that on? Do you see the symbol when you run `nm -g' on
the object file which should define it?
> Secondly "Is it normal to have linker output as :
>
>
> 00000000 <.text>:
> 0: 8a 8a /* Some instruction*/
> 2: 0c 03 /* Some instruction*/ /*
> Note there are 2 .text section, 2 abc label*/
> 4: 0b 03 /* Some instruction*/ /*Is
> it normal?*/
> 6: 0c 05 /* Some instruction */
>
> 00000008 <xyz>:
> 8: 0c 01 /* Some instruction*/
>
> 0000000a <abc>:
> a: 8c 0d /* Some instruction*/
>
> 0000000c <.text>:
> c: 8a 1a /* Some instruction*/
>
> 0000000e <abc>:
> e: 0b ff /* Some instruction*/
> 10: 0c 00 /* Some instruction refreing xyz*/ /*This
> instruction never finds the xyz symbol*/
That would be normal if xyz were a local symbol. Note that all
symbols are local by default. You need to use the .globl pseudo-op to
mark a symbol as globally visible.
> And i dont want two .text section i want them to be combined and reslove the
> symbols uniqily.
I'm afraid that I don't understand that. You presumably only have one
.text section in the output file, as reported by objdump h. Otherwise
I don't understand what you mean.
Ian