AIX : -bnorwexec linker flag

REIX, Tony tony.reix at atos.net
Mon Apr 15 14:18:24 UTC 2019


Hi


Maybe that the patch is good, but the original code, though working fine, is bad.



--- a/make/autoconf/flags-ldflags.m4


-    BASIC_LDFLAGS="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K \


On AIX, using -brtl and -bexpall is OK for fixing issues quick and dirty.
However, when building and delivering professional products, these options should be used only in last resort.

On AIX, the default is to NOT export all symbols. Instead, one should build the list of needed symbols and inform the linker with -bE and -bI linker options of the list of symbols that need to be exported/imported. That's more work, but it's the good way.

Using -bexpall means that all symbols contained in a library will be exported. Thus, an executable may want to load a symbol (like strcmp, which is first provided by the libc.a) from another library, breaking the upward compatibility. In addition, -bexpall creates performance issues. And also, sometimes, the linker explodes due to too many symbols.


As an example, the current versions of CMake and MariaDB for AIX make use of -bexpall (and, much worse, -expfull). We are changing the code of these 2 packages in order to no more use -bexpall (nor -bexpfull).


Regards,

Tony


More information about the build-dev mailing list