__builtin_smulll_overflow usage results in undefined symbol

Bug #1408607 reported by Ryan Cumming
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
llvm-toolchain-3.5 (Ubuntu)
New
Undecided
Unassigned

Bug Description

This simple nonsense program:

int main(int argc, char *argv[])
{
 long long result;
 return __builtin_smulll_overflow(argc, 5, &result);
}

Will result in the following:
ryan@ubuntu32:~/Code/test$ clang++ main.cpp -o main
/tmp/main-10feb1.o: In function `main':
main.cpp:(.text+0x46): undefined reference to `__mulodi4'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This can be manually fixed up by explicitly linking against compiler-rt:
clang++ main.cpp /usr/lib/clang/3.5.0/lib/linux/libclang_rt.builtins-i386.a -o main

This only occurs on 32bit

$ lsb_release -rd
Description: Ubuntu 14.10
Release: 14.10

$ apt-cache policy clang++-3.5
libclang-3.5-dev:
  Installed: (none)
  Candidate: 1:3.5-4ubuntu2
  Version table:
     1:3.5-4ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/main i386 Packages
clang-3.5-doc:
  Installed: (none)
  Candidate: 1:3.5-4ubuntu2
  Version table:
     1:3.5-4ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/universe i386 Packages
clang-3.5:
  Installed: 1:3.5-4ubuntu2
  Candidate: 1:3.5-4ubuntu2
  Version table:
 *** 1:3.5-4ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/universe i386 Packages
        100 /var/lib/dpkg/status
python-clang-3.5:
  Installed: (none)
  Candidate: 1:3.5-4ubuntu2
  Version table:
     1:3.5-4ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/universe i386 Packages
clang-3.5-examples:
  Installed: (none)
  Candidate: 1:3.5-4ubuntu2
  Version table:
     1:3.5-4ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/universe i386 Packages

$ apt-cache policy llvm-3.5
llvm-3.5:
  Installed: 1:3.5-4ubuntu2
  Candidate: 1:3.5-4ubuntu2
  Version table:
 *** 1:3.5-4ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/main i386 Packages
        100 /var/lib/dpkg/status

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.