[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modulename_LTX_ prefix not removed from preloaded symbols?

From: Gary V. Vaughan
Subject: Re: modulename_LTX_ prefix not removed from preloaded symbols?
Date: Mon, 13 Oct 2003 11:23:47 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3

Kevin P. Fleming wrote:
I've just converted an application to use libtool and ltdl for opening its plugin modules; part of that conversion required prefixing the public-visible symbols in the modules with "modulename_LTX_", which ltdl strips when lt_dlsym is called. That all worked fine.

However, one of the reasons for making this change to libtool was so that the application could support being statically linked. I have modified the makefiles to use -dlopen and -dlpreopen where required, and now I get a static binary built with all the plugins linked in. So far so good... however, after figuring out a way to get at the preloaded_symbols list (see my message to this list from yesterday), I find out that the symbols in this list _do not have the prefix removed_! In spite of that, presym_sym (the "symbol finder" for preloaded modules) has no concept of the symbol prefix and makes no attempt to remove it before checking the symbol list. I now have to construct the prefix in my code so I can add it to the symbol, but only when I found the module in the preloaded symbols list.

Is this how this is supposed to work? It doesn't seem logical to me, at this point I could have built the infrastructure to do this myself (given that I don't have to support much portability beyond Linux) and not had to deal with this. Maybe I'm just missing something, but I don't see why the preloaded-symbols case shouldn't act _exactly_ like the shared-library-loaded-symbols case.

You're not supposed to call the loaders directly, just use lt_dlsym, and it will add the prefix for you:

  3866        /* this is a libtool module */
  3867        if (handle->loader->sym_prefix)
  3868          {
  3869            strcpy(sym, handle->loader->sym_prefix);
  3870            strcat(sym, handle->;
  3871          }
  3872        else
  3873          {
  3874            strcpy(sym, handle->;
  3875          }
  3877        strcat(sym, "_LTX_");
  3878        strcat(sym, symbol);
  3880        /* try "modulename_LTX_symbol" */
  3881        address = handle->loader->find_sym (data, handle->module, sym);

  ())_.  Gary V. Vaughan    gary@(|
  ( '/   Research Scientist       ,_())____
  / )=   GNU Hacker  \'      `&
`(_~)_   Tech' Author   =`---d__/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]