Jerry James b08b3a4
--- o/plt.c.orig	2014-09-06 09:45:30.000000000 -0600
Jerry James b08b3a4
+++ o/plt.c	2014-09-06 20:00:00.000000000 -0600
Jerry James b08b3a4
@@ -102,6 +102,12 @@ arsearch(const void *v1,const void *v2)
ed63bb5
 
ed63bb5
 }
ed63bb5
 
6e2b50c
+/* Parser states */
ed63bb5
+#define NOTHING 0 /* initial state */
ed63bb5
+#define PLT     1 /* reading plt */
ed63bb5
+#define NEWLINE 2 /* reading empty line after .iplt */
ed63bb5
+#define IPLT    3 /* reading iplt */
ed63bb5
+
ed63bb5
 int
ed63bb5
 parse_plt() {
ed63bb5
 
7fc6c88
@@ -132,15 +138,24 @@ parse_plt() {
ed63bb5
     return 0;
ed63bb5
   if (!(f=fopen(b1,"r")))
ed63bb5
     FEerror("Cannot open map file", 0);
ed63bb5
-  for (i=j=0,li=Cnil;fgets(b,sizeof(b),f);) {
ed63bb5
+  for (i=NOTHING,j=0,li=Cnil;fgets(b,sizeof(b),f);) {
4b6dc23
     if (!memchr(b,10,sizeof(b)-1))
4b6dc23
       FEerror("plt buffer too small", 0);
6e2b50c
-    if (!memcmp(b," .plt",4)) {
6e2b50c
-      i=1;
ed63bb5
+    if (i == NOTHING) {
ed63bb5
+      if (memcmp(b," .plt",5) == 0)
ed63bb5
+	i = PLT;
ed63bb5
+      else if (memcmp(b," .iplt",6) == 0)
ed63bb5
+	i = NEWLINE;
4b6dc23
       continue;
6e2b50c
     }
6e2b50c
-    if (*b!=' ' || b[1]!=' ' || !i) {
ed63bb5
-      i=0;
6e2b50c
+    if (*b=='\r' || *b=='\n') {
ed63bb5
+      i = (i == NEWLINE) ? PLT : NOTHING;
6e2b50c
+      continue;
ed63bb5
+    }
ed63bb5
+    if (b[1] != ' ') {
ed63bb5
+      /* There is at least one "annotation" line before the iplt information */
ed63bb5
+      if (i != NEWLINE)
ed63bb5
+	i = NOTHING;
6e2b50c
       continue;
6e2b50c
     }
ed63bb5
     if (sscanf(b,"%lx%n",&u,&n)!=1)