diff options
author | midipix <writeonce@midipix.org> | 2015-11-26 11:46:46 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:27 -0500 |
commit | 9c5807c7cadf7219a32f3b2c081a8d21aceb4837 (patch) | |
tree | 05b106b7f8119bd7bd0e1ab6116ef2ee2b4285b8 /src/perk.c | |
parent | 949bb3ba304be9bd80cda27c37c2d0d0da6a67dd (diff) | |
download | perk-9c5807c7cadf7219a32f3b2c081a8d21aceb4837.tar.bz2 perk-9c5807c7cadf7219a32f3b2c081a8d21aceb4837.tar.xz |
output import libraries and dependency symbols: initial implementation.
Diffstat (limited to 'src/perk.c')
-rw-r--r-- | src/perk.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -1,4 +1,5 @@ #include <stdio.h> +#include <unistd.h> #include <perk/perk.h> #include <perk/perk_output.h> @@ -6,12 +7,32 @@ #define PERK_DRIVER_FLAGS PERK_DRIVER_VERBOSITY_ERRORS|PERK_DRIVER_VERBOSITY_USAGE #endif +static void perk_paragraph_break(struct pe_unit_ctx * uctx, int * fpara) +{ + if (*fpara) { + if (uctx->cctx.fdout >= 0) + write(uctx->cctx.fdout,"\n",1); + else + fputc('\n',stdout); + *fpara = 0; + } +} + static void perk_perform_unit_actions(struct pe_unit_ctx * uctx) { + int fpara = 0; uint64_t flags = uctx->cctx.fmtflags; - if (flags & PERK_OUTPUT_EXPORT_SYMS) + if (flags & PERK_OUTPUT_EXPORT_SYMS) { uctx->cctx.status = pe_output_export_symbols(uctx->meta,&uctx->cctx,0); + fpara += uctx->meta->summary.num_of_export_syms; + } + + if ((flags & PERK_OUTPUT_IMPORT_LIBS) || (flags & PERK_OUTPUT_IMPORT_SYMS)) { + perk_paragraph_break(uctx,&fpara); + uctx->cctx.status = pe_output_import_libraries(uctx->meta,&uctx->cctx,0); + fpara += (uctx->meta->summary.num_of_implibs > 0); + } } static int perk_exit(struct pe_driver_ctx * dctx, int status) |