diff options
author | midipix <writeonce@midipix.org> | 2019-02-20 18:43:32 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2019-02-20 23:31:15 -0500 |
commit | 113d3fcaa8e7c14c65e8b45e0ab1baf93cb030a8 (patch) | |
tree | 054385cfa585c0f07b4bb6d62187c5312a50e767 | |
parent | c6570d037a1def5d7d25d832b28ca3ce7398657c (diff) | |
download | mdso-113d3fcaa8e7c14c65e8b45e0ab1baf93cb030a8.tar.bz2 mdso-113d3fcaa8e7c14c65e8b45e0ab1baf93cb030a8.tar.xz |
driver: added --crc support: output computed crc32|64 of exported symbols.
-rw-r--r-- | include/mdso/mdso.h | 4 | ||||
-rw-r--r-- | src/driver/mdso_amain.c | 6 | ||||
-rw-r--r-- | src/driver/mdso_driver_ctx.c | 11 | ||||
-rw-r--r-- | src/internal/mdso_driver_impl.h | 1 | ||||
-rw-r--r-- | src/skin/mdso_skin_default.c | 4 |
5 files changed, 26 insertions, 0 deletions
diff --git a/include/mdso/mdso.h b/include/mdso/mdso.h index 160f89f..9d40ed3 100644 --- a/include/mdso/mdso.h +++ b/include/mdso/mdso.h @@ -35,6 +35,8 @@ extern "C" { #define MDSO_DRIVER_QUAD_PTR 0x0040 #define MDSO_DRIVER_GENERATE_ASM 0x0100 #define MDSO_DRIVER_GENERATE_OBJECTS 0x0200 +#define MDSO_DRIVER_COMPUTE_CRC32 0x0400 +#define MDSO_DRIVER_COMPUTE_CRC64 0x0800 #define MDSO_DRIVER_ANNOTATE_ALWAYS 0x1000 #define MDSO_DRIVER_ANNOTATE_NEVER 0x2000 @@ -159,6 +161,8 @@ mdso_api int mdso_create_implib_archive(const struct mdso_driver_ctx *); mdso_api int mdso_create_implib_sources(const struct mdso_driver_ctx *); mdso_api int mdso_create_implib_objects(const struct mdso_driver_ctx *); mdso_api int mdso_output_export_symbols(const struct mdso_driver_ctx *, const struct mdso_unit_ctx *); +mdso_api int mdso_output_expsyms_crc32 (const struct mdso_driver_ctx *, const struct mdso_unit_ctx *); +mdso_api int mdso_output_expsyms_crc64 (const struct mdso_driver_ctx *, const struct mdso_unit_ctx *); mdso_api int mdso_output_error_record (const struct mdso_driver_ctx *, const struct mdso_error_info *); mdso_api int mdso_output_error_vector (const struct mdso_driver_ctx *); diff --git a/src/driver/mdso_amain.c b/src/driver/mdso_amain.c index bed201d..c0d0824 100644 --- a/src/driver/mdso_amain.c +++ b/src/driver/mdso_amain.c @@ -55,6 +55,12 @@ static void mdso_perform_unit_actions( { if (uctx->cctx->fmtflags & MDSO_OUTPUT_EXPORT_SYMS) mdso_output_export_symbols(dctx,uctx); + + if (uctx->cctx->drvflags & MDSO_DRIVER_COMPUTE_CRC32) + mdso_output_expsyms_crc32(dctx,uctx); + + if (uctx->cctx->drvflags & MDSO_DRIVER_COMPUTE_CRC64) + mdso_output_expsyms_crc64(dctx,uctx); } static int mdso_exit(struct mdso_driver_ctx * dctx, int ret) diff --git a/src/driver/mdso_driver_ctx.c b/src/driver/mdso_driver_ctx.c index f4a83c1..59450ac 100644 --- a/src/driver/mdso_driver_ctx.c +++ b/src/driver/mdso_driver_ctx.c @@ -250,6 +250,17 @@ int mdso_get_driver_ctx( cctx.drvflags |= MDSO_DRIVER_GENERATE_OBJECTS; break; + case TAG_CRC: + if (!(strcmp(entry->arg,"64"))) { + cctx.drvflags &= ~(uint64_t)MDSO_DRIVER_COMPUTE_CRC32; + cctx.drvflags |= MDSO_DRIVER_COMPUTE_CRC64; + } else { + cctx.drvflags &= ~(uint64_t)MDSO_DRIVER_COMPUTE_CRC64; + cctx.drvflags |= MDSO_DRIVER_COMPUTE_CRC32; + } + + break; + case TAG_QUAD_PTR: machine = entry; diff --git a/src/internal/mdso_driver_impl.h b/src/internal/mdso_driver_impl.h index 4cf4064..dc37a66 100644 --- a/src/internal/mdso_driver_impl.h +++ b/src/internal/mdso_driver_impl.h @@ -28,6 +28,7 @@ extern const struct argv_option mdso_default_options[]; enum app_tags { TAG_HELP, TAG_VERSION, + TAG_CRC, TAG_ASM, TAG_OBJ, TAG_QUAD_PTR, diff --git a/src/skin/mdso_skin_default.c b/src/skin/mdso_skin_default.c index 0c3fd85..8080c09 100644 --- a/src/skin/mdso_skin_default.c +++ b/src/skin/mdso_skin_default.c @@ -20,6 +20,10 @@ const struct argv_option mdso_default_options[] = { {"obj", 'b',TAG_OBJ,ARGV_OPTARG_NONE,0,0,0, "generate objects"}, + {"crc", 'c',TAG_CRC,ARGV_OPTARG_REQUIRED,0,"32|64",0, + "compute and display the exported symbols' " + "%s-bit crc sum."}, + {"machine", 'm',TAG_QUAD_PTR,ARGV_OPTARG_REQUIRED,0,"32|64",0, "set machine bits to %s"}, |