libtool
[Top][All Lists]
Advanced

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

Re: -dlopen self on AIX


From: Howard Chu
Subject: Re: -dlopen self on AIX
Date: Sun, 30 Oct 2005 12:10:23 -0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051027 SeaMonkey/1.1a

Albert Chin wrote:
On AIX, ld doesn't explicitly export all symbols (not even with
-bexpall). From ld(1):
  autoexp
       Automatically exports some symbols from the output module without
       having to list them in an export file. (This option does not
       export all symbols from the output module. Use the -bexpall option
       to export all symbols.) This is the default. Use this option when
       linking a main program. The linker assumes that you are linking a
       main program when you do not specify a module type (with the M or
       modtype option) beginning with S and you do not use the noentry
       option.

       When you use the autoexp option, if any shared object listed on
       the command-line imports a symbol from the special file . (dot),
       and the module being linked contains a local definition of the
       symbol, the symbol is exported automatically.

       Other symbols are also exported automatically when you link with
       the rtl option. If a symbol defined in the module being linked has
       one or more additional definitions exported from a shared object
       listed on the command-line, and if any of the definitions is a BSS
       symbol, the symbol is exported automatically. If the definition in
       the module being linked is a BSS symbol, the symbol is exported
       with the nosymbolic attribute. Otherwise, the symbol is exported
       with the symbolic attribute. If the symbol is listed in an export
       file with another export attribute, the explicit attribute is
       used.

       If the autoexp option would automatically export a symbol, but the
       symbol is listed in an export file with the list attribute, the
       symbol is not exported.

  expall
       Exports all global symbols, except imported symbols, unreferenced
       symbols defined in archive members, and symbols beginning with an
       underscore (_). You can export additional symbols by listing them
       in an export file. This option does not affect symbols exported by
       the autoexp option.

       When you use this option, you might be able to avoid using an
       export file. On the other hand, using an export file provides
       explicit control over which symbols are exported, and allows you
       to use other global symbols within your shared object without
       worrying about conflicting with names exported from other shared
       objects. The default is noexpall.

This means the method libtool uses to support -dlopen self on AIX
won't work (by building a list of symbols into some xxS.o file and
linking it with the executable). The real solution is to -bE the
symbol list. What's the cleanest way to do this?

Dynamic module support in openldap-2.3.x isn't working on AIX for the
above reason. Using -bexpall or -bE when linking the main binary does
work though. While the main binary, slapd, doesn't dlopen itself,
modules it dlopen()'s cannot resolve symbols in slapd because they
weren't exported.

I don't recall what particular hacks we've done to libtool for this on AIX, but Symas builds everything as dynamic modules on all of our platforms, and mostly It Just Works. (Including IBM AIX and z/OS, as well as Solaris, HPUX, Linux, Windows, etc.) In general the only thing I've hacked was to prevent build directories from being embedded into the generated files, and to eliminate all relinking. I've submitted most of our changes back to this list in the past; a lot may have fallen on the floor since those were patches against libtool 1.4.

Maybe you should just download our CDS3 packages...

--
  -- Howard Chu
  Chief Architect, Symas Corp.  http://www.symas.com
  Director, Highland Sun        http://highlandsun.com/hyc
  OpenLDAP Core Team            http://www.openldap.org/project/




reply via email to

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