Bug 1145085 - llvm7 does not build with gcc-4.8
llvm7 does not build with gcc-4.8
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Development
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Petr Tesařík
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-08-09 12:50 UTC by Petr Tesařík
Modified: 2021-05-22 13:20 UTC (History)
0 users

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Tesařík 2019-08-09 12:50:21 UTC
llvm7 build fails with gcc-4.8 when linking libomp:

/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:614: error: undefined reference to '__atomic_fetch_add_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:496: error: undefined reference to '__atomic_load_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:496: error: undefined reference to '__atomic_load_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:496: error: undefined reference to '__atomic_load_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:496: error: undefined reference to '__atomic_load_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:474: error: undefined reference to '__atomic_store_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:474: error: undefined reference to '__atomic_store_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:474: error: undefined reference to '__atomic_store_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:577: error: undefined reference to '__atomic_compare_exchange_8'
/usr/lib/gcc/i586-suse-linux/4.8/../../../../include/c++/4.8/bits/atomic_base.h:474: error: undefined reference to '__atomic_store_8'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Petr Tesařík 2019-08-09 12:52:10 UTC
More precisely, only the i586 build fails. That's because -latomic is required in that case, but openmp does not add it to the linker command line.
Comment 2 Petr Tesařík 2019-08-09 20:09:49 UTC
Adding -latomic fixes the build failure, but checks then fail here:

 [ 1254s] FAIL: LLVM-Unit :: Support/./SupportTests/JSONTest.Integers (2436 of 27030)
 [ 1254s] ******************** TEST 'LLVM-Unit :: Support/./SupportTests/JSONTest.Integers' FAILED ********************
 [ 1254s] Note: Google Test filter = JSONTest.Integers
 [ 1254s] [==========] Running 1 test from 1 test case.
 [ 1254s] [----------] Global test environment set-up.
 [ 1254s] [----------] 1 test from JSONTest
 [ 1254s] [ RUN ] JSONTest.Integers
 [ 1254s] ../unittests/Support/JSONTest.cpp:319: Failure
 [ 1254s] Expected: Doc->getAsNumber()
 [ 1254s] Which is: 12-byte object <00-00 00-00 00-00 D0-43 01-38 D1-08>
 [ 1254s] To be equal to: T.AsNumber
 [ 1254s] Which is: 12-byte object <00-00 00-00 00-00 D0-43 01-B0 92-F2>
 [ 1254s] Integer, not exact double. Stored as int64, convertible.
 [ 1254s] ../unittests/Support/JSONTest.cpp:319: Failure
 [ 1254s] Expected: Doc->getAsNumber()
 [ 1254s] Which is: 12-byte object <00-00 00-00 00-00 D0-C3 01-60 D1-08>
 [ 1254s] To be equal to: T.AsNumber
 [ 1254s] Which is: 12-byte object <00-00 00-00 00-00 D0-C3 01-00 00-00>
 [ 1254s] Negative integer, not exact double. Stored as int64, convertible.
 [ 1254s] [ FAILED ] JSONTest.Integers (0 ms)
 [ 1254s] [----------] 1 test from JSONTest (0 ms total)
 [ 1254s]
 [ 1254s] [----------] Global test environment tear-down
 [ 1254s] [==========] 1 test from 1 test case ran. (1 ms total)
 [ 1254s] [ PASSED ] 0 tests.
 [ 1254s] [ FAILED ] 1 test, listed below:
 [ 1254s] [ FAILED ] JSONTest.Integers

Essentially, there is a check that an int64_t converted to a double matches a pre-calculated value exactly. This does not work for a large 64-bit integer which cannot be interpreted exactly as a 64-bit double.

That's because the integer value is stored in a hardware floating-point register (using the FILD instruction). This register has 80 bits, so it can represent the integer value exactly. This register is then compared with the 64-bit value (loaded into another 80-bit floating-point register from memory using FLD instruction). Of course, the two do not match.

It is not an issue on x86-64, because 64-bit XMM registers are used in that case, so there is no extra precision. I believe this unit test is broken, at least on i586.
Comment 3 Petr Tesařík 2019-08-10 07:39:36 UTC
Fixed, see https://build.opensuse.org/request/show/722146
Comment 5 Swamp Workflow Management 2021-05-17 16:18:26 UTC
SUSE-RU-2021:1618-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1067478,1109367,1145085,1184920
CVE References: 
JIRA References: 
Sources used:
SUSE Linux Enterprise Module for Packagehub Subpackages 15-SP3 (src):    llvm7-7.0.1-3.19.2
SUSE Linux Enterprise Module for Packagehub Subpackages 15-SP2 (src):    llvm7-7.0.1-3.19.2
SUSE Linux Enterprise Module for Development Tools 15-SP3 (src):    llvm7-7.0.1-3.19.2
SUSE Linux Enterprise Module for Development Tools 15-SP2 (src):    llvm7-7.0.1-3.19.2
SUSE Linux Enterprise Module for Desktop Applications 15-SP3 (src):    libqt5-qtdeclarative-5.12.7-4.2.1, libqt5-qttools-5.12.7-3.3.10
SUSE Linux Enterprise Module for Desktop Applications 15-SP2 (src):    libqt5-qtdeclarative-5.12.7-4.2.1, libqt5-qttools-5.12.7-3.3.10
SUSE Linux Enterprise Module for Basesystem 15-SP3 (src):    double-conversion-3.1.5-3.2.1, libqt5-qtdeclarative-5.12.7-4.2.1, llvm7-7.0.1-3.19.2
SUSE Linux Enterprise Module for Basesystem 15-SP2 (src):    double-conversion-3.1.5-3.2.1, libqt5-qtdeclarative-5.12.7-4.2.1, llvm7-7.0.1-3.19.2

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 6 Swamp Workflow Management 2021-05-22 13:20:25 UTC
openSUSE-RU-2021:0768-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1067478,1109367,1145085,1184920
CVE References: 
JIRA References: 
Sources used:
openSUSE Leap 15.2 (src):    double-conversion-3.1.5-lp152.2.3.1, libqt5-qtdeclarative-5.12.7-lp152.3.3.1, libqt5-qttools-5.12.7-lp152.2.3.1