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.