13 int main(int argc, char **argv)
16 ELFHandles hIn = { 0 };
17 ELFHandles hOut = { 0 };
18 int exitval = EXIT_SUCCESS;
20 /* Is libelf alive and well? */
21 if (elf_version(EV_CURRENT) == EV_NONE) {
22 fprintf(stderr, "libelf init error: %s\n", elf_errmsg(-1));
26 /* Parse and validate user input */
27 parseOptions(&opts, argc, argv);
30 /* Open input/output files */
31 openElf(&hIn, opts.fnInput, ELF_C_READ);
33 exitval = EXIT_FAILURE;
38 openElf(&hOut, opts.fnOutput, ELF_C_WRITE);
40 exitval = EXIT_FAILURE;
46 /* Now that we have a (hopefully) sane environment, execute commands */
47 if (opts.printHeader) {
51 if (opts.printSegments) {
55 if (opts.printSections) {
63 if (elf_update(hOut.e, ELF_C_WRITE) < 0) {
64 fprintf(stderr, "elf_update() failed: %s\n", elf_errmsg(-1));