make dry run versbose
authorAnas Nashif <anas.nashif@intel.com>
Tue, 6 Nov 2012 15:16:51 +0000 (07:16 -0800)
committerChanho Park <chanho61.park@samsung.com>
Sat, 15 Nov 2014 16:10:01 +0000 (01:10 +0900)
src/arch-i386.c
src/conflict.c
src/doit.c
src/execstack.c

index aae68f9..1a3b7a4 100644 (file)
@@ -146,9 +146,11 @@ i386_prelink_rel (struct prelink_info *info, GElf_Rel *rel, GElf_Addr reladdr)
        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;
@@ -405,9 +407,10 @@ i386_prelink_conflict_rel (DSO *dso, struct prelink_info *info, GElf_Rel *rel,
       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:
index 88a347c..13cbace 100644 (file)
@@ -461,9 +461,9 @@ prelink_build_conflicts (struct prelink_info *info)
        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 @@ prelink_build_conflicts (struct prelink_info *info)
                                   - info->dynbss_base, cr.rela[i].r_addend,
                                   cr.rela[i].r_offset);
 
+       if (!dry_run) {
          switch (j)
            {
            case 1:
@@ -786,6 +787,7 @@ prelink_build_conflicts (struct prelink_info *info)
              goto error_out;
            }
        }
+       }
     }
 
   if (info->conflict_rela_size)
index a289dd7..45789b3 100644 (file)
@@ -121,10 +121,6 @@ prelink_ent (struct prelink_entry *ent)
       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))
@@ -136,7 +132,10 @@ prelink_ent (struct prelink_entry *ent)
          dso = NULL;
          goto error_out;
        }
-    }
+  
+  if (dry_run)
+     close_dso (dso);
   ent->done = 2;
   ent->flags |= PCF_PRELINKED;
 
index 2f503ba..250b13e 100644 (file)
@@ -31,6 +31,7 @@
 
 int set;
 int execflag;
+int dry_run = 0; // for arch-i386
 
 const char *argp_program_version = "execstack 1.0";