File prelink-make-dry-run-verbose.diff of Package prelink

--- src/arch-i386.c
+++ src/arch-i386.c
@@ -143,9 +143,11 @@
 	return 2;
       }
     case R_386_PC32:
-      error (0, 0, "%s: R_386_PC32 relocs should not be present in prelinked REL sections",
-	     dso->filename);
-      return 1;
+      if (!dry_run)
+         error (0, 0, "%s: R_386_PC32 relocs should not be present in prelinked REL sections",
+  	       dso->filename);
+      return !dry_run;
+
     case R_386_TLS_DTPOFF32:
       write_le32 (dso, rel->r_offset, value);
       break;
@@ -379,9 +381,10 @@
       break;
     case R_386_32:
     case R_386_PC32:
-      error (0, 0, "%s: R_386_%s32 relocs should not be present in prelinked REL sections",
-	     dso->filename, GELF_R_TYPE (rel->r_info) == R_386_32 ? "" : "PC");
-      return 1;
+      if (!dry_run)
+        error (0, 0, "%s: R_386_%s32 relocs should not be present in prelinked REL sections",
+	       dso->filename, GELF_R_TYPE (rel->r_info) == R_386_32 ? "" : "PC");
+      return !dry_run;
     case R_386_TLS_DTPMOD32:
     case R_386_TLS_DTPOFF32:
     case R_386_TLS_TPOFF32:
--- src/conflict.c
+++ src/conflict.c
@@ -461,9 +461,9 @@
 	goto error_out;
       info->dsos[i] = dso;
       /* Now check that the DSO matches what we recorded about it.  */
-      if (ent->timestamp != dso->info_DT_GNU_PRELINKED
+      if (!dry_run && (ent->timestamp != dso->info_DT_GNU_PRELINKED
 	  || ent->checksum != dso->info_DT_CHECKSUM
-	  || ent->base != dso->base)
+	  || ent->base != dso->base))
 	{
 	  error (0, 0, "%s: Library %s has changed since it has been prelinked",
 		 info->dso->filename, ent->filename);
@@ -772,6 +772,7 @@
 				   - info->dynbss_base, cr.rela[i].r_addend,
 				   cr.rela[i].r_offset);
 
+       if (!dry_run) {
 	  switch (j)
 	    {
 	    case 1:
@@ -786,6 +787,7 @@
 	      goto error_out;
 	    }
 	}
+	}
     }
 
   if (info->conflict_rela_size)
--- src/execstack.c
+++ src/execstack.c
@@ -31,6 +31,7 @@
 
 int set;
 int execflag;
+int dry_run = 0; // for arch-i386
 
 const char *argp_program_version = "execstack 1.0";
 
--- src/doit.c
+++ src/doit.c
@@ -121,22 +121,17 @@
       goto error_out;
     }
 
-  if (dry_run)
-    close_dso (dso);
-  else
-    {
-      if (prelink_prepare (dso))
-	goto make_unprelinkable;
-      if (ent->type == ET_DYN && relocate_dso (dso, ent->base))
-	goto make_unprelinkable;
-      if (prelink (dso, ent))
-	goto make_unprelinkable;
-      if (update_dso (dso, NULL))
-	{
-	  dso = NULL;
-	  goto error_out;
-	}
-    }
+  if (prelink_prepare (dso)) goto make_unprelinkable;
+  if (ent->type == ET_DYN && relocate_dso (dso, ent->base))
+    goto make_unprelinkable;
+  if (prelink (dso, ent)) goto make_unprelinkable;
+
+  if (dry_run) close_dso (dso);
+  else if (update_dso (dso, NULL)) {
+    dso = NULL;
+    goto error_out;
+  }
+
   ent->done = 2;
   ent->flags |= PCF_PRELINKED;
 
openSUSE Build Service is sponsored by