changeset 115:2f23301d2f86

tiobjd: literal reloc recognition restricted to RTYPE_LONG
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 03 Apr 2014 06:50:07 +0000
parents ca8e43288836
children 5f4141ee175b
files ticoff/armdis.c ticoff/reloc.c ticoff/thumbdis.c
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ticoff/armdis.c	Thu Apr 03 06:42:39 2014 +0000
+++ b/ticoff/armdis.c	Thu Apr 03 06:50:07 2014 +0000
@@ -11,7 +11,7 @@
 #include "globals.h"
 
 extern unsigned get_u16(), get_u32();
-extern struct internal_reloc *find_reloc();
+extern struct internal_reloc *find_word32_reloc();
 
 extern char *regnames[16], *condition_decode[16], *shift_types[4];
 
@@ -247,7 +247,7 @@
 	if (litoff >= sec->size)
 		return(0);
 	/* all checks passed, proceed */
-	rel = find_reloc(sec, litoff);
+	rel = find_word32_reloc(sec, litoff);
 	switch (size) {
 	case 1:
 		datum = filemap[sec->data_offset + litoff];
--- a/ticoff/reloc.c	Thu Apr 03 06:42:39 2014 +0000
+++ b/ticoff/reloc.c	Thu Apr 03 06:50:07 2014 +0000
@@ -141,3 +141,16 @@
 	}
 	return(0);
 }
+
+struct internal_reloc *
+find_word32_reloc(sec, loc)
+	struct internal_scnhdr *sec;
+	unsigned loc;
+{
+	struct internal_reloc *rel;
+
+	rel = find_reloc(sec, loc);
+	if (rel && rel->type != RTYPE_LONG)
+		rel = 0;
+	return(rel);
+}
--- a/ticoff/thumbdis.c	Thu Apr 03 06:42:39 2014 +0000
+++ b/ticoff/thumbdis.c	Thu Apr 03 06:50:07 2014 +0000
@@ -11,7 +11,7 @@
 #include "globals.h"
 
 extern unsigned get_u16(), get_u32();
-extern struct internal_reloc *find_reloc();
+extern struct internal_reloc *find_word32_reloc();
 
 extern char *regnames[16], *condition_decode[16], *shift_types[4];
 
@@ -123,7 +123,7 @@
 	off += 4;
 	litoff = off + loff;
 	if (litoff+4 <= sec->size) {
-		rel = find_reloc(sec, litoff);
+		rel = find_word32_reloc(sec, litoff);
 		datum = get_u32(filemap + sec->data_offset + litoff);
 		printf("ldr\t%s, =", regnames[(word>>8)&7]);
 		if (rel)