AIX : -bnorwexec linker flag

Baesken, Matthias matthias.baesken at
Mon Apr 15 14:47:18 UTC 2019

Hi Tony,  agree  the  -bexpall  is not good .

Do you have a good (/ better) solution  for the issue ,  do you use visibility attributes  in the C/C++   or  export-lists ?
Maybe someone from IBM could  comment on this too .

Best regards, Matthias

From: REIX, Tony <tony.reix at>
Sent: Montag, 15. April 2019 16:18
To: Baesken, Matthias <matthias.baesken at>; ppc-aix-port-dev at; 'build-dev at' <build-dev at>
Subject: RE: AIX : -bnorwexec linker flag


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).



More information about the build-dev mailing list