[2/2] ARC: provide for gcc "isolate path" induced generated abort calls

Message ID 1512760361-17663-2-git-send-email-vgupta@synopsys.com
State New
Headers show
  • [1/2] ARC: uaccess: dont use "l" inline as constraint
Related show

Commit Message

Vineet Gupta Dec. 8, 2017, 7:12 p.m.
gcc toggle -fisolate-erroneous-paths-dereference (default at -O2
onwards) isolates faulty code paths such as null pointer access, divide
by zero etc. If gcc port doesnt implement __builtin_trap, an abort() is
generated which causes kernel link error hence this patch.

FWIW ARC gcc now has the builtin, but we need to handle this error for
older toolchains.

The code in question triggering gcc is in lib/mpi/mpih-div.o

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
 arch/arc/kernel/setup.c | 6 ++++++
 1 file changed, 6 insertions(+)


diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 9d27331fe69a..5e180090b17f 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -19,6 +19,7 @@ 
 #include <linux/of_fdt.h>
 #include <linux/of.h>
 #include <linux/cache.h>
+#include <linux/reboot.h>
 #include <asm/sections.h>
 #include <asm/arcregs.h>
 #include <asm/tlb.h>
@@ -637,3 +638,8 @@  static int __init topology_init(void)
+void __weak abort(void)
+	machine_halt();