about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/localplt.awk18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/localplt.awk b/scripts/localplt.awk
index beaa342922..fe79ca01ab 100644
--- a/scripts/localplt.awk
+++ b/scripts/localplt.awk
@@ -4,17 +4,25 @@
 # It writes "NAME: SYMBOL" for each PLT entry in NAME that refers to a
 # symbol defined in the same object.
 
-BEGIN { result = 0 }
+BEGIN {
+  result = 0;
+  pltrelsize = -1;
+}
 
 FILENAME != lastfile {
   if (lastfile && jmprel_offset == 0 && rela_offset == 0 && rel_offset == 0) {
     print FILENAME ": *** failed to find expected output (readelf -WSdr)";
     result = 2;
   }
+  if (pltrelsz > 0 && jmprel_offset == -1) {
+    print FILENAME ": Could not find section for DT_JMPREL";
+    result = 2;
+  }
   lastfile = FILENAME;
   jmprel_offset = 0;
   rela_offset = 0;
   rel_offset = 0;
+  pltrelsz = -1;
   delete section_offset_by_address;
 }
 
@@ -82,12 +90,16 @@ $2 == "(JMPREL)" {
   if (jmprel_addr in section_offset_by_address) {
     jmprel_offset = section_offset_by_address[jmprel_addr];
   } else {
-    print FILENAME ": *** DT_JMPREL does not match any section's address";
-    result = 2;
+    jmprel_offset = -1
   }
   next
 }
 
+$2 == "(PLTRELSZ)" {
+  pltrelsz = strtonum($3);
+  next
+}
+
 $2 == "(RELA)" {
   rela_addr = strtonum($3);
   if (rela_addr in section_offset_by_address) {