Bug 1657544

Summary: clang++ linking fails with undefined reference to __muloti4
Product: [Fedora] Fedora Reporter: Georg Sauthoff <fedora>
Component: clangAssignee: Tom Stellard <tstellar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: airlied, davejohansen, sbergman, siddharth.kde, tstellar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: clang-7.0.1-2.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-18 02:04:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
minimal reproducing C++ example none

Description Georg Sauthoff 2018-12-09 20:38:42 UTC
Created attachment 1512902 [details]
minimal reproducing C++ example

Description of problem:
When compiling a program that calls std::from_chars() clang++ cannot resolve the symbol __muloti4 during linking.

Version-Release number of selected component (if applicable):
clang-7.0.0-2.fc29.x86_64

How reproducible:
always

Steps to Reproduce:
1. get attached minimal example
2. clang++ -Wall  tochars_clang_fail.cc -o tochars
3. ./tochars 123

Actual results:
/usr/bin/ld: /tmp/tochars_clang_fail-e603f8.o: in function `bool std::__detail::__raise_and_add<unsigned long>(unsigned long&, int, unsigned char)':
tochars_clang_fail.cc:(.text._ZNSt8__detail15__raise_and_addImEEbRT_ih[_ZNSt8__detail15__raise_and_addImEEbRT_ih]+0x4c): undefined reference to `__muloti4'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation

Expected results:
successful compilation and as output:
123

Additional info:

Compiling with GCC works as expected:

g++ -Wall  tochars_clang_fail.cc -o tochars

Linking with libc++ also does work:

clang++ -Wall -stdlib=libc++  tochars_clang_fail.cc -o tochars

Comment 1 Tom Stellard 2018-12-18 06:35:31 UTC
Possibly related upstream commit: https://reviews.llvm.org/rL320902

Comment 2 Tom Stellard 2018-12-18 06:46:31 UTC
Simplified test case:

#include <stddef.h>
  
void mul(size_t a, int b) {
        size_t res;
        __builtin_mul_overflow(a, b, &res);
}

Comment 3 Tom Stellard 2018-12-21 03:48:56 UTC
Fixed in rawhide: clang-7.0.1-2.fc30.  I will backport this back to f29 too.

Comment 4 Tom Stellard 2019-02-12 20:31:41 UTC
Submitted PR: https://src.fedoraproject.org/rpms/clang/pull-request/33

Comment 5 Fedora Update System 2019-02-14 16:09:51 UTC
clang-7.0.1-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-5065cb8af8

Comment 6 Fedora Update System 2019-02-15 02:57:23 UTC
clang-7.0.1-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-5065cb8af8

Comment 7 Fedora Update System 2019-02-18 02:04:04 UTC
clang-7.0.1-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.