This is the mail archive of the binutils@sourceware.org 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: RFC: Add dynamic list to version script


Hi,

On Thu, 27 Jul 2006, H. J. Lu wrote:

> > (no JUMP_SLOT, as expected that's now bound locally).  With -Bsymbolic the 
> > _ZTI1A reloc goes away, but the _ZTS1A remains.
> 
> Can you show me your example?

% cat header.h
struct A {
  int i;
  A(int i): i(i) {}
};

% cat lib.cpp
#include "header.h"
void f()
{
  throw (A(42));
}

% cat app.cpp
#include <stdio.h>
#include "header.h"
extern void f();
int main()
{
  try {
    f();
  } catch (A a) {
    printf ("Got A: %d\n", a.i);
  } catch (...) {
    printf ("Got something\n");
  }
  return 0;
}

> > I find the overloading of semantics a bit confusing.  I mean that 
> > using a version script with the "dynamic" tag implicitely has the 
> > effect of -Bsymbolic without actually mentioning that flag.  This 
> > means that an empty version script using the "dynamic" tag is the 
> > opposite of using no version script.  Perhaps such version script 
> > should only have an effect if the user also specifies -Bsymbolic (i.e. 
> > creating exceptions to the -Bsymbolic symbol set).  OTOH it's 
> > documented so it's not that important.
> > 
> 
> The dynamic verion script doesn't imply -Bsymbolic and shouldn't be used 
> together with -Bsymbolic since -Bsymbolic will set DF_SYMBOLIC and 
> dynamic linker will treat the DSO differently.

Ah yes, I only mean the effect of -Bsymbolic to bind self-defined symbols 
locally.  I wonder if DT_SYMBOLIC makes a difference in the end.  During 
link editing all references to symbols defined in the DSO are bound 
locally by ld.  So there's no reference left for ld.so which could be 
satisfied by the DSO itself, hence it shouldn't matter that it comes first 
in the symbol search order with DT_SYMBOLIC.  Hmm.

> What it does is to bind all symbols locally except for which are 
> undefined or on the dynamic list.

With an empty dynamic list, isn't that exactly what -Bsymbolic does, 
ignoring the setting of DT_SYMBOLIC?

> BTW, I'd like to have a new option name and I am thinking to add an 
> option to make C++ symbols dynamic automatically. Does anyone have any 
> suggestions for new option name?

How do you envision should it work?  Would you implement a rule of what 
C++ symbols are in ld (i.e. something like the globs), or would you 
somehow mark the symbols in the compiler?  How about -dynamic-only-cpp or 
similar?


Ciao,
Michael.


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