diff options
author | midipix <writeonce@midipix.org> | 2025-06-18 04:47:07 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2025-06-18 04:47:07 +0000 |
commit | 733dcf7478d466eac6bfef09efee476d43679787 (patch) | |
tree | bb6cf0ebcfd723ebb5d844796f3ef20549bf5259 | |
parent | c5998808867bf8209722357c745508c592d337cf (diff) | |
download | perk-733dcf7478d466eac6bfef09efee476d43679787.tar.bz2 perk-733dcf7478d466eac6bfef09efee476d43679787.tar.xz |
driver: added the --relocs switch (image base relocations).
-rw-r--r-- | include/perk/perk_output.h | 1 | ||||
-rw-r--r-- | src/cmds/pe_cmd_perk.c | 3 | ||||
-rw-r--r-- | src/driver/pe_driver_ctx.c | 4 | ||||
-rw-r--r-- | src/internal/perk_driver_impl.h | 1 | ||||
-rw-r--r-- | src/skin/pe_skin_perk.c | 4 |
5 files changed, 13 insertions, 0 deletions
diff --git a/include/perk/perk_output.h b/include/perk/perk_output.h index 313f609..5c022b6 100644 --- a/include/perk/perk_output.h +++ b/include/perk/perk_output.h @@ -13,6 +13,7 @@ #define PERK_OUTPUT_IMAGE_SECTIONS 0x00000010 #define PERK_OUTPUT_IMAGE_SYMBOLS 0x00000020 #define PERK_OUTPUT_IMAGE_STRINGS 0x00000040 +#define PERK_OUTPUT_BASE_RELOCS 0x00000080 #define PERK_OUTPUT_MDSO_LIBS 0x00000200 #define PERK_OUTPUT_MDSO_SYMS 0x00000400 diff --git a/src/cmds/pe_cmd_perk.c b/src/cmds/pe_cmd_perk.c index bdb6364..37b80ee 100644 --- a/src/cmds/pe_cmd_perk.c +++ b/src/cmds/pe_cmd_perk.c @@ -64,6 +64,9 @@ static void pe_perform_unit_actions_impl( if ((flags & PERK_OUTPUT_MDSO_LIBS) || (flags & PERK_OUTPUT_MDSO_SYMS)) pe_output_mdso_libraries(dctx,meta); + if (flags & PERK_OUTPUT_BASE_RELOCS) + pe_output_base_relocs(dctx,meta); + if (dctx->cctx->hdrdump) pe_perform_hdrdump_actions(dctx,meta); } diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index 6a260bd..9e6a17e 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -251,6 +251,10 @@ static int pe_cctx_update( cctx->fmtflags |= PERK_OUTPUT_IMAGE_STRINGS; break; + case TAG_RELOCS: + cctx->fmtflags |= PERK_OUTPUT_BASE_RELOCS; + break; + case TAG_EXPSYMS: cctx->fmtflags |= PERK_OUTPUT_EXPORT_SYMS; break; diff --git a/src/internal/perk_driver_impl.h b/src/internal/perk_driver_impl.h index 5cd0d73..fdf75c3 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -32,6 +32,7 @@ enum app_tags { TAG_IMPSYMS, TAG_DSOLIBS, TAG_DSOSYMS, + TAG_RELOCS, TAG_HDRDUMP, TAG_AR_LIST_MEMBERS, TAG_AR_PRINT_MEMBERS, diff --git a/src/skin/pe_skin_perk.c b/src/skin/pe_skin_perk.c index 3678341..fd891c8 100644 --- a/src/skin/pe_skin_perk.c +++ b/src/skin/pe_skin_perk.c @@ -44,6 +44,10 @@ const perk_hidden struct argv_option pe_perk_options[] = { "list .dsometa (mdso) dependency libraries " "along with referenced symbols"}, + {"relocs", 'r',TAG_RELOCS,ARGV_OPTARG_NONE,0,0,0, + "list image base relocations found " + "in the .reloc section"}, + {"hdrdump", 'X',TAG_HDRDUMP,ARGV_OPTARG_OPTIONAL,0, "dos|image.dos|" "coff|coff.image|coff.object|coff.optional|" |