AIX : -bnorwexec linker flag

REIX, Tony tony.reix at atos.net
Mon Apr 15 16:21:23 UTC 2019


Hi Matthias,


When building on AIX packages that make use of configure/Makefile/libtool, the code of these packages is aware of AIX constraints and libtool is able to generate and use .exp export files.

With the new CMake that we will deliver soon, it will be possible to do the same: now CMake knows about constraints of AIX and some changes (only for AIX) in the CMakeLists.txt files are enough for handling not-standard cases where .exp files must be exported/used explicitely.


Looking at source code of OpenJDK, there are: configure.ac/Makefile.in and many .gmk files . I was unable to build in my AIX test VMs, for now. However, I guess that some changes must be made in order to build the export list of symbols of lib*.a (or lib*.so) that are required by other archive/lib*.so or by executables.


Regards


Cordialement,

Tony Reix

tony.reix at atos.net

ATOS / Bull SAS
ATOS Expert
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net<https://mail.ad.bull.net/owa/redir.aspx?C=PvphmPvCZkGrAgHVnWGsdMcDKgzl_dEIsM6rX0g4u4v8V81YffzBGkWrtQeAXNovd3ttkJL8JIc.&URL=http%3a%2f%2fwww.atos.net%2f>
________________________________
De : Baesken, Matthias <matthias.baesken at sap.com>
Envoyé : lundi 15 avril 2019 16:47:18
À : REIX, Tony; ppc-aix-port-dev at openjdk.java.net; 'build-dev at openjdk.java.net'
Objet : RE: AIX : -bnorwexec linker flag


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 atos.net>
Sent: Montag, 15. April 2019 16:18
To: Baesken, Matthias <matthias.baesken at sap.com>; ppc-aix-port-dev at openjdk.java.net; 'build-dev at openjdk.java.net' <build-dev at openjdk.java.net>
Subject: RE: AIX : -bnorwexec linker flag



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