[PATCH] frv: fix build failure

Vineet Gupta Vineet.Gupta1 at synopsys.com
Mon Nov 27 10:25:16 PST 2017


+CC linux-arch, Arnd

On 11/23/2017 09:17 AM, Alexey Brodkin wrote:
> Hi Sudip,
> 
> On Tue, 2017-11-21 at 22:10 +0000, Sudip Mukherjee wrote:
>> The frv defconfig build is failing with the error:
>> lib/mpi/mpih-div.o: In function `mpihelp_divrem':
>> mpih-div.c:(.text+0x30c): undefined reference to `abort'
>>
>> The function 'abort' was never defined for the frv architecture.
>> Create 'abort' as is done in other arch like 'arm' and 'unicore32'.
>>
>> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee at gmail.com>
>> ---
> 
> I'm seeing the same issue building for ARC from today's Linus' tree.

With which compiler ? Claudiu implemented __builtin_trap recently so ARC builds 
should not get abort() but a trap 5 instruction instead.

> Maybe it worth implementing abort() as a weak function for every arch/platform
> that doesn't have it explicitly defined? Otherwise we'll end-up with
> useless code duplication.

I understand the case/need for adding a weak/common abort() as a quick fix for 
handling such cases, but perhaps we should not and instead fix the rootcause. In 
this specific case, Claudiu mentioned that gcc was generating abort due to 
something like this (flagging a possible divide by zero due to 
-fno-isolate-erroneous-paths-dereference.

a;

fn1() {
   switch (a)
   case 0:
   return 1 / a;
}

Sudeep can you confirm that removing this hacking FRV build to not have this 
toggle fixes the abort issue.

So the offending code needs to be fixed as in the end when that code path is taken 
system is hosed.

-Vineet



More information about the linux-snps-arc mailing list