From: Anas Nashif Date: Tue, 6 Nov 2012 15:16:51 +0000 (-0800) Subject: make dry run versbose X-Git-Tag: accepted/tizen/20130503.225535~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6749b77bdb48fd0f17d85c661cbdddf299ab23c5;p=platform%2Fupstream%2Fprelink.git make dry run versbose --- diff --git a/src/arch-i386.c b/src/arch-i386.c index aae68f9..1a3b7a4 100644 --- a/src/arch-i386.c +++ b/src/arch-i386.c @@ -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: diff --git a/src/conflict.c b/src/conflict.c index 88a347c..13cbace 100644 --- a/src/conflict.c +++ b/src/conflict.c @@ -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) diff --git a/src/doit.c b/src/doit.c index a289dd7..45789b3 100644 --- a/src/doit.c +++ b/src/doit.c @@ -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; diff --git a/src/execstack.c b/src/execstack.c index 2f503ba..250b13e 100644 --- a/src/execstack.c +++ b/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";