public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Docs for --unresolved-symbols unclear?
@ 2003-11-26 13:51 Vladimir Prus
  2003-12-02 15:28 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Prus @ 2003-11-26 13:51 UTC (permalink / raw)
  To: binutils


Hi,
the docs for --unresolved-symbols option of ld, say:

   `ignore-all'
          Do not report any unresolved symbols.  This is the default
          when creating shared libraries or dynamic executables.

Unless I misunderstand what 'dynamic executables' means, this is not correct. 
On my system (Debian unstable), all binaries are dynamic by default. Say I 
compile file a.cpp with the following content:

    void foo();

    int main()
   {
        foo();
   }

With 

     g++ a.cpp

I get "unresolved symbol" error, as expected. But if I compile it with 

      g++ a.cpp -Wl,--unresolved-symbols=ignore-all

I get only warning, and binary crashes at runtime. So, it seems that default 
value of --unresolved-symbls is not "ignore-all".

Is it so, and what's the real default value, or I'm missing something?

TIA,
Volodya



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

* Re: Docs for --unresolved-symbols unclear?
  2003-11-26 13:51 Docs for --unresolved-symbols unclear? Vladimir Prus
@ 2003-12-02 15:28 ` Nick Clifton
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2003-12-02 15:28 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: binutils

Hi Volodya,

> the docs for --unresolved-symbols option of ld, say:
>
>    `ignore-all'
>           Do not report any unresolved symbols.  This is the default
>           when creating shared libraries or dynamic executables.
>

> I get only warning, and binary crashes at runtime. So, it seems that
> default  value of --unresolved-symbls is not "ignore-all".

> Is it so, and what's the real default value, or I'm missing
> something?

No - the default was changed in order to allow autoconf to work, but
the documentation was not updated to match this change.  I am going to
apply the patch below to fix the documentation.

Cheers
        Nick

ld/ChangeLog
2003-12-02  Nick Clifton  <nickc@redhat.com>

	* ld.texinfo (Options): --ignore-all is no longer the default
	behaviour for shared libraries and dynamic executables.

Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.101
diff -c -3 -p -r1.101 ld.texinfo
*** ld/ld.texinfo	6 Nov 2003 11:58:58 -0000	1.101
--- ld/ld.texinfo	2 Dec 2003 15:26:23 -0000
*************** for which shared libraries are supported
*** 985,992 ****
  default on such platforms.  The different variants of this option are
  for compatibility with various systems.  You may use this option
  multiple times on the command line: it affects library searching for
! @option{-l} options which follow it.  This
! option also implies @option{--unresolved-symbols=ignore-all}.
  
  @kindex -Bgroup
  @item -Bgroup
--- 985,991 ----
  default on such platforms.  The different variants of this option are
  for compatibility with various systems.  You may use this option
  multiple times on the command line: it affects library searching for
! @option{-l} options which follow it.
  
  @kindex -Bgroup
  @item -Bgroup
*************** values for @samp{method}:
*** 1495,1506 ****
  
  @table @samp
  @item ignore-all
! Do not report any unresolved symbols.  This is the default when
! creating shared libraries or dynamic executables.
  
  @item report-all
! Report all unresolved symbols.  This is the default when creating
! static binaries.
  
  @item ignore-in-object-files
  Report unresolved symbols that are contained in shared libraries, but
--- 1494,1503 ----
  
  @table @samp
  @item ignore-all
! Do not report any unresolved symbols.
  
  @item report-all
! Report all unresolved symbols.  This is the default.
  
  @item ignore-in-object-files
  Report unresolved symbols that are contained in shared libraries, but
                

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

* Re: Docs for --unresolved-symbols unclear?
  2003-12-05 10:25 ` Nick Clifton
@ 2003-12-10 14:31   ` Vladimir Prus
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Prus @ 2003-12-10 14:31 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Hi Nick,

> > That is, I get warning, not error. Without, -Bdynamic, I get error, as
> > expected. I'm using binutils 2.14.90.0.6-3 on Debian, so it might not be
> > the most current version.
>
> Hmm - I do not get this with the 2.14 sources I have here, but they
> are probably slightly different from the Debian ones.
>
> Anyway with the current mainline binutils sources the undefined symbol
> in your test case will produce an error message, rather than a warning
> message, even if -Bdynamic is specified.  Hence I think that the
> documentation is now correct.

I've just got the most up-to-date Debian package and it works as you desribe.

Thanks,
Volodya


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

* Re: Docs for --unresolved-symbols unclear?
       [not found] <200312050930.05059.ghost@cs.msu.su>
@ 2003-12-05 10:25 ` Nick Clifton
  2003-12-10 14:31   ` Vladimir Prus
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2003-12-05 10:25 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: binutils

Hi Vladimir,

> Now, I'm at loss again. This change removes statement that -Bdynamic
> implies --unresolved-symbols=ignore-all. But when I try my test case:
> with 
>
> g++ a.cpp -Wl,-Bdynamic
>
> I get:
>
> a.cpp:6:2: warning: no newline at end of file
> /tmp/ccaT8qMm.o(.text+0x11): In function `main':
> : warning: undefined reference to `foo()'
>
> That is, I get warning, not error. Without, -Bdynamic, I get error, as
> expected. I'm using binutils 2.14.90.0.6-3 on Debian, so it might not be
> the most current version.

Hmm - I do not get this with the 2.14 sources I have here, but they
are probably slightly different from the Debian ones.

Anyway with the current mainline binutils sources the undefined symbol
in your test case will produce an error message, rather than a warning
message, even if -Bdynamic is specified.  Hence I think that the
documentation is now correct.

> OTOH, ChangeLog does not mention any significant changes to
> -Bdynamic.

True - the ChangeLog entries are more general - talking about
unresolved symbols and shared libraries.

Cheers
        Nick
        


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

* Re: Docs for --unresolved-symbols unclear?
@ 2003-12-05  6:39 Vladimir Prus
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Prus @ 2003-12-05  6:39 UTC (permalink / raw)
  To: binutils

Hi Nick,

>> I get only warning, and binary crashes at runtime. So, it seems that
>> defaultб б valueб ofб --unresolved-symblsб isб notб "ignore-all".
> 
>> Is it so, and what's the real default value, or I'm missing
>> something?
> 
> No - the default was changed in order to allow autoconf to work, but
> the documentation was not updated to match this change.б б Iб amб goingб to
> apply the patch below to fix the documentation.

Thanks for explaining this!

> *************** for which shared libraries are supported
> *** 985,992 ****
>б б б defaultб onб suchб platforms.б б Theб differentб variantsб ofб thisб optionб are
>б б б forб compatibilityб withб variousб systems.б б Youб mayб useб thisб option
>б б б multipleб timesб onб theб commandб line:б itб affectsб libraryб searchingб for
> ! @option{-l} options which follow it.б б This
> ! option also implies @option{--unresolved-symbols=ignore-all}.
>б б б 
>б б б @kindexб -Bgroup
>б б б @itemб -Bgroup
> --- 985,991 ----
>б б б defaultб onб suchб platforms.б б Theб differentб variantsб ofб thisб optionб are
>б б б forб compatibilityб withб variousб systems.б б Youб mayб useб thisб option
>б б б multipleб timesб onб theб commandб line:б itб affectsб libraryб searchingб for
> ! @option{-l} options which follow it.

Now, I'm at loss again. This change removes stagement that -Bdynamic implies
--unresolved-symbols=ignore-all. But when I try my test case:

б б б б voidб foo();

б б б б intб main()
б б б б {
б б б б б б б б foo();
б б б б }

with 

б б g++б a.cppб -Wl,-Bdynamic

I get:

a.cpp:6:2: warning: no newline at end of file
/tmp/ccaT8qMm.o(.text+0x11): In function `main':
: warning: undefined reference to `foo()'

That is, I get warning, not error. Without, -Bdynamic, I get error, as
expected. I'm using binutils 2.14.90.0.6-3 on Debian, so it might not be
the most current version. OTOH, Changelog does not mention any significant
changes to -Bdynamic.

- Volodya


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

end of thread, other threads:[~2003-12-10 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-26 13:51 Docs for --unresolved-symbols unclear? Vladimir Prus
2003-12-02 15:28 ` Nick Clifton
2003-12-05  6:39 Vladimir Prus
     [not found] <200312050930.05059.ghost@cs.msu.su>
2003-12-05 10:25 ` Nick Clifton
2003-12-10 14:31   ` Vladimir Prus

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).