From 38e38437e83ed961dc1fa6d5b534bbdaae5b535e Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 9 Mar 2017 18:54:02 +0200
Subject: [PATCH] Add a color setting for mips64_n32 binaries

Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 build/rpmfc.c | 4 ++++
 rpmrc.in      | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/build/rpmfc.c b/build/rpmfc.c
index 86dd36d14..df421a23f 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -716,6 +716,7 @@ static int rpmfcHelper(rpmfc fc, int *fnx, int nfn, const char *proto,
 static const struct rpmfcTokens_s rpmfcTokens[] = {
   { "directory",		RPMFC_INCLUDE },
 
+  { "N32 MIPS64",		RPMFC_ELFMIPSN32|RPMFC_INCLUDE },
   { "ELF 32-bit",		RPMFC_ELF32|RPMFC_INCLUDE },
   { "ELF 64-bit",		RPMFC_ELF64|RPMFC_INCLUDE },
 
@@ -1258,6 +1259,9 @@ static uint32_t getElfColor(const char *fn)
 		color = 0;
 		break;
 	    }
+            if (ehdr.e_machine == EM_MIPS || ehdr.e_machine == EM_MIPS_RS3_LE)
+                if (ehdr.e_flags & EF_MIPS_ABI2)
+                    color = RPMFC_ELFMIPSN32;
 	}
 	if (elf)
 	    elf_end(elf);
diff --git a/rpmrc.in b/rpmrc.in
index 8646a966b..7349fdfd3 100644
--- a/rpmrc.in
+++ b/rpmrc.in
@@ -142,6 +142,8 @@ archcolor: mipsr6el 1
 archcolor: mips64r6 2
 archcolor: mips64r6el 2
 
+archcolor: mips64_n32 4
+
 archcolor: m68k 1
 
 archcolor: m68kmint 1
