linux-mips
[Top] [All Lists]

Re: undefined reference to `__multi3' when building with gcc 7.x

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: undefined reference to `__multi3' when building with gcc 7.x
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sat, 5 Aug 2017 13:56:49 +0200
Cc: linux-mips@linux-mips.org, Waldemar Brodkorb <wbx@openadk.org>
In-reply-to: <20170804222500.GA11675@linux-mips.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Organization: Free Electrons
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20170803225547.6caa602b@windsurf.lan> <20170804000556.GC30597@linux-mips.org> <20170804151920.GA11317@linux-mips.org> <20170804174151.2eea9af3@windsurf.lan> <20170804222500.GA11675@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
Hello,

On Sat, 5 Aug 2017 00:25:00 +0200, Ralf Baechle wrote:

> > Great! However, looking at the functions that end up calling __multi3,
> > I'm wondering why suddenly gcc 7.x needs to call such a function, while
> > the same code was compiling without __multi3 in libgcc with gcc 6.x.  
> 
> Chances are it's something specific to MIPS64 R6.  Before trying your
> config file I also tried a number of other defconfigs and all built
> well.
> 
> Here's a test case which generates a reference to __multi3:
> 
> unsigned long func(unsigned long a, unsigned long b)
> {
>         return a > (~0UL) / b;
> }
> 
> GCC rearanges above statement to:
> 
>       return (unsigned __int128)a * (unsigned __int128) b > 0xffffffff;

And this is normal/expected ?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

<Prev in Thread] Current Thread [Next in Thread>