@@ -344,6 +344,23 @@ you wish to link with jemalloc add it to LIBS::
$ ./configure LIBS=-ljemalloc
+.. note::
+ Linking Open vSwitch with the jemalloc shared library may not work as
+ expected in certain operating system development environments if the GCC
+ compiler tries to optimize the linking process using the ``-flto`` flag.
+ You can overrides the automatic compiler decision removing the link-time
+ optimization by passing ``-fno-lto`` or disabling ``-fno-builtin`` flag since
+ the jemalloc override standard built-in memory allocation functions such as
+ malloc, calloc, etc. Both options can solve possible jemalloc linker issues
+ with pros and cons for each case, feel free to choose the path that appears
+ best to you. Disabling LTO flag example::
+
+ $ ./configure LIBS=-ljemalloc CFLAGS=-fno-lto
+
+ Disabling built-in flag example::
+
+ ./configure LIBS=-ljemalloc CFLAGS=-fno-builtin
+
.. _general-building:
Building
Current version of debian/rules simply uses the default GCC optimization settings during the linkage process. The main problem with this approach is that GCC on OS like Ubuntu Jammy, for example, can enable the -flto=auto flag option during the Open vSwitch building and linking process. In this case, the linked dynamic libraries would need to be compatible with the same lto optimization options, at the risk of not working, according to documentation [1]. However, it could be possible to link to jemalloc using the LTO option but the GIMPLE-bytecode may not work correctly. In this case, it would be necessary to disable the -fbuiltin flag [2] if it is set as default. Updating the reference documentation with the inclusion of possible building problems with libjemalloc and solution suggestions. [1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flto [2] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html Signed-off-by: Roberto Bartzen Acosta <roberto.acosta@luizalabs.com> --- Documentation/intro/install/general.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)