diff ticoff/armdis.c @ 114:ca8e43288836

tiobjd: ARM_B reloc handling
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 03 Apr 2014 06:42:39 +0000
parents d97fbe98600b
children 2f23301d2f86
line wrap: on
line diff
--- a/ticoff/armdis.c	Thu Apr 03 06:20:06 2014 +0000
+++ b/ticoff/armdis.c	Thu Apr 03 06:42:39 2014 +0000
@@ -497,3 +497,26 @@
 		return;
 	}
 }
+
+void
+arm_branch_reloc(sec, rel)
+	struct internal_scnhdr *sec;
+	struct internal_reloc *rel;
+{
+	unsigned word, dest;
+
+	word = get_u32(filemap + sec->data_offset + rel->location);
+	printf("%08x R\t", word);
+	if ((word & 0x0E000000) != 0x0A000000) {
+		printf("<invalid ARM_B reloc: opcode not B or BL>\n");
+		return;
+	}
+	dest = (word & 0x00FFFFFF) << 2;
+	if (dest & 0x02000000)
+		dest |= 0xFC000000;
+	dest += rel->location + 8;
+	printf("b%s%s\t", word&0x1000000 ? "l" : "",
+		condition_decode[word>>28]);
+	disasm_reloc_target(sec, rel, dest);
+	putchar('\n');
+}