This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix tekhex


Hi!

The PR binutils/2584 patch rendered the tekhex reader useless
due to missing break.  E.g. objdump -x on the sample
%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75
%1B3709T_SEGMENT1108FFFFFFFF
%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10
%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710
%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10
%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10
%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10
%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10
%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010
%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10
%2734D9T_SEGMENT8Bvoid$t15$151035_main10
%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110
%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214
%0781010
from tekhex.c's comment reports it did not recognize the format.
Also, tekhex reader aborts in several places rather than
just returning FALSE (thus saying it is not a valid tekhex
object file), try e.g.:
echo -n '%3A6' > /tmp/test.tkh; objdump -x /tmp/test.tkh

Ok?

2007-01-04  Jakub Jelinek  <jakub@redhat.com>

	* texhex.c (first_phase): Don't fall through into the default
	case.
	(pass_over): Replace abort () calls with return FALSE.

--- bfd/tekhex.c.jj	2006-06-19 15:17:43.000000000 +0200
+++ bfd/tekhex.c	2007-01-04 18:28:27.000000000 +0100
@@ -436,6 +436,7 @@ first_phase (bfd *abfd, int type, char *
 		if (!getvalue (&src, &val))
 		  return FALSE;
 		new->symbol.value = val - section->vma;
+		break;
 	      }
 	    default:
 	      return FALSE;
@@ -457,7 +458,7 @@ pass_over (bfd *abfd, bfd_boolean (*func
 
   /* To the front of the file.  */
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
-    abort ();
+    return FALSE;
   while (! eof)
     {
       char buffer[MAXCHUNK];
@@ -475,7 +476,7 @@ pass_over (bfd *abfd, bfd_boolean (*func
 
       /* Fetch the type and the length and the checksum.  */
       if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5)
-	abort (); /* FIXME.  */
+	return FALSE;
 
       type = src[2];
 
@@ -486,7 +487,7 @@ pass_over (bfd *abfd, bfd_boolean (*func
       chars_on_line = HEX (src) - 5;
 
       if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line)
-	abort (); /* FIXME.  */
+	return FALSE;
 
       /* Put a null at the end.  */
       src[chars_on_line] = 0;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]