public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* "Undefined symbols"
@ 2001-08-16 17:59 Xinan Tang
  2001-08-21  9:01 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Xinan Tang @ 2001-08-16 17:59 UTC (permalink / raw)
  To: binutils

Hi
    I am using GNU ld version 2.10 (with BF 2.10) and I found out
the FUND' symbols are not reported as error in the link stage.

    For example, the `objdump -t a.out' result looks like:
___________________________________________
00000000  w      *UND*	00000000 L31

____________________________________________

   The label L31 was not defined anywhere in the test program. However,
`ld' did not catch this (I purposely set the label attribute to 'w').

   Could anyone point to me which part of ld source code I should look into?

Thanks


-- 
Dr. Xinan Tang                    Member of Technical Staff
EMail: xinant@cognigine.com       Cognigine Corp.
Voice: 510.743.4930               6120 Stevenson Boulevard
Fax:   510.743.4910               Fremont, CA  94538


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Undefined symbols"
  2001-08-16 17:59 "Undefined symbols" Xinan Tang
@ 2001-08-21  9:01 ` Nick Clifton
  2001-08-21  9:13   ` Xinan Tang
  2001-08-21  9:14   ` Philip Blundell
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Clifton @ 2001-08-21  9:01 UTC (permalink / raw)
  To: Xinan Tang; +Cc: binutils

Hi Dr Xinan,

>     I am using GNU ld version 2.10 (with BF 2.10) and I found out 

2.10 is an old version of GNU ld.  I would first recommend upgrading
to the latest released version (2.11.1) or the latest CVS sources.


> the FUND' symbols are not reported as error in the link stage.
> 
>     For example, the `objdump -t a.out' result looks like:
> ___________________________________________
> 00000000  w      *UND*	00000000 L31
> ____________________________________________
> 
>    The label L31 was not defined anywhere in the test
> program. However, `ld' did not catch this (I purposely set the label
> attribute to 'w').

L31 is a local label, which may be why it is being ignored by the
linker.

You could try adding "--trace-symbol L31" to your linker command line
to see if this helps.

If you can provide a small test case and also tell us which target
configuration you are using then we may be able to reproduce the
problem and offer further insights.

Cheers
        Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Undefined symbols"
  2001-08-21  9:01 ` Nick Clifton
@ 2001-08-21  9:13   ` Xinan Tang
  2001-08-22  0:58     ` Nick Clifton
  2001-08-21  9:14   ` Philip Blundell
  1 sibling, 1 reply; 5+ messages in thread
From: Xinan Tang @ 2001-08-21  9:13 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Hi Nick,

Nick Clifton wrote:

> 
> L31 is a local label, which may be why it is being ignored by the
> linker.
> 
> You could try adding "--trace-symbol L31" to your linker command line
> to see if this helps.


   Thanks for your tips.

   I have found the solution. Basically, adding such a piece of code in

   `elf32-target.c' (target is our target name like elf32-mips.c)

________________________________________________________________________

   if (bfd_is_und_section (symbol->section) && (abfd == (bfd *) NULL)) {
         return bfd_reloc_undefined;
    }
    return bfd_reloc_ok;

__________________________________________________________________________

  Therefore, when linker tries to resolve a relocated symbol at last pass,

it will first check whether the symbol is still in the `UND' section.
If that is the case, it will return an undefined error.

Thanks

--Xinan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Undefined symbols"
  2001-08-21  9:01 ` Nick Clifton
  2001-08-21  9:13   ` Xinan Tang
@ 2001-08-21  9:14   ` Philip Blundell
  1 sibling, 0 replies; 5+ messages in thread
From: Philip Blundell @ 2001-08-21  9:14 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Xinan Tang, binutils

>> ___________________________________________
>> 00000000  w      *UND*	00000000 L31
>> ____________________________________________
>> 
>>    The label L31 was not defined anywhere in the test
>> program. However, `ld' did not catch this (I purposely set the label
>> attribute to 'w').
>
>L31 is a local label, which may be why it is being ignored by the
>linker.

Eh, doesn't "w" signify a weak symbol? 

p.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Undefined symbols"
  2001-08-21  9:13   ` Xinan Tang
@ 2001-08-22  0:58     ` Nick Clifton
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2001-08-22  0:58 UTC (permalink / raw)
  To: Xinan Tang; +Cc: binutils

Hi Xinan,

>    Thanks for your tips.
> 
>    I have found the solution. Basically, adding such a piece of code in
> 
>    `elf32-target.c' (target is our target name like elf32-mips.c)
> 
> ________________________________________________________________________
> 
>    if (bfd_is_und_section (symbol->section) && (abfd == (bfd *) NULL)) {
>          return bfd_reloc_undefined;
>     }
>     return bfd_reloc_ok;
> 
> __________________________________________________________________________
> 
>   Therefore, when linker tries to resolve a relocated symbol at last pass,

If you want to submit an official patch we will consider it for
inclusion into the binutils sources.

Cheers
        Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-08-22  0:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-16 17:59 "Undefined symbols" Xinan Tang
2001-08-21  9:01 ` Nick Clifton
2001-08-21  9:13   ` Xinan Tang
2001-08-22  0:58     ` Nick Clifton
2001-08-21  9:14   ` Philip Blundell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).