office-gobmx/external/coinmp
Stephan Bergmann 0408e5344b external/coinmap: Address ODR violations
...since 2193650b33 "external/coinmp: Update to
CoinMP 1.8.4", as reported by <https://ci.libreoffice.org/job/lo_ubsan/2805/>,

> ==25531==ERROR: AddressSanitizer: odr-violation (0x7f3df9756e40):
>   [1] size=4 'CbcOrClpEnvironmentIndex' /home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/UnpackedTarball/coinmp/Clp/src/CbcOrClpParam.cpp:1236:5
>   [2] size=4 'CbcOrClpEnvironmentIndex' CbcOrClpParam.cpp:1236:5
> These globals were registered at these points:
>   [1]:
>     #0 0x43e508 in __asan_register_globals.part.13 /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_globals.cpp:360
>     #1 0x7f3df9252a6b in asan.module_ctor (/instdir/program/libCbcSolver.so.3+0x21fa6b)
> LLVMSymbolizer: error reading file: No such file or directory
>     #2 0x7ffda20d8279  ([stack]+0x32279)
>
>   [2]:
>     #0 0x43e508 in __asan_register_globals.part.13 /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_globals.cpp:360
>     #1 0x7f3df4973a4b in asan.module_ctor (/instdir/program/libClpSolver.so.1+0x127a4b)
>     #2 0x7ffda20d8279  ([stack]+0x32279)

and similarly for CbcOrClpRead_mode and CbcOrClpReadCommand.

There's code using those three extern variables in both libCbcSolver.so.3 and
libClpSolver.so.1, and some of it is duplicated (in
workdir/UnpackedTarball/coinmp/Clp/src/CbcOrClpParam.cpp, which is also included
from workdir/UnpackedTarball/coinmp/Cbc/src/CbcCbcParam.cpp).  Those libraries
do not appear to make any use of symbol visibility hiding, and it is completely
unclear to me how all that code is actually meant to work.  But it also smells
like all that code is only used within standalone programs (see main in
workdir/UnpackedTarball/coinmp/Cbc/src/CoinSolve.cpp and
workdir/UnpackedTarball/coinmp/Clp/src/ClpMain.cpp).  So lets try to get away
with properly sharing those three extern variables across those two libraries.
Except on Windows, where linking the one library wouldn't find the extern
variables from the other library (and I'm not sure whether that's a general
issue on Windows, or is due to how 2193650b33
modified external/coinmp/windows.build.patch.1).

(This also appears to be fixed on recent upstream;
<https://github.com/coin-or/Cbc> no longer mentions any of those three extern
variables.  Maybe a new tarball will eventually appear at
<http://www.coin-or.org/download/source/CoinMP/> that includes a proper fix of
these ODR violations.)

Change-Id: I953c7dc31f8e35315c59dc2bedd3fdf780579638
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153001
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-06-14 07:24:36 +02:00
..
bind2nd.patch.1
clang-with-path.patch
coinmp-msvc-disable-sse2.patch.1
configure-exit.patch
ExternalPackage_coinmp.mk
ExternalProject_coinmp.mk
libtool.patch
Makefile
Module_coinmp.mk
no-binaries.patch.1
odr.patch
pedantic-errors.patch
README
register.patch
rpath.patch
ubsan.patch.0
UnpackedTarball_coinmp.mk
werror-undef.patch.0
windows.build.patch.1
Wnon-c-typedef-for-linkage.patch

CoinMP is a C-API library that supports most of the functionality of CLP (Coin LP),
CBC (Coin Branch-and-Cut), and CGL (Cut Generation Library) projects.

Info [https://projects.coin-or.org/CoinMP].
From [http://www.coin-or.org/download/source/CoinMP/].