Skip to content

Commit 2e63152

Browse files
Matt Helsleyrostedt
authored andcommitted
recordmcount: Kernel style formatting
Fix up the whitespace irregularity in the ELF switch blocks. Swapping the initial value of gpfx allows us to simplify all but one of the one-line switch cases even further. Link: http://lkml.kernel.org/r/647f21f43723d3e831cedd3238c893db03eea6f0.1564596289.git.mhelsley@vmware.com Signed-off-by: Matt Helsley <mhelsley@vmware.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 3aec863 commit 2e63152

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

‎scripts/recordmcount.c‎

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,15 @@ static int do_file(char const *const fname)
489489
push_bl_mcount_thumb = push_bl_mcount_thumb_be;
490490
break;
491491
} /* end switch */
492-
if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0
493-
|| w2(ehdr->e_type) != ET_REL
494-
|| ehdr->e_ident[EI_VERSION] != EV_CURRENT) {
492+
if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 ||
493+
w2(ehdr->e_type) != ET_REL ||
494+
ehdr->e_ident[EI_VERSION] != EV_CURRENT) {
495495
fprintf(stderr, "unrecognized ET_REL file %s\n", fname);
496496
cleanup();
497497
goto out;
498498
}
499499

500-
gpfx = 0;
500+
gpfx = '_';
501501
switch (w2(ehdr->e_machine)) {
502502
default:
503503
fprintf(stderr, "unrecognized e_machine %u %s\n",
@@ -510,32 +510,35 @@ static int do_file(char const *const fname)
510510
make_nop = make_nop_x86;
511511
ideal_nop = ideal_nop5_x86_32;
512512
mcount_adjust_32 = -1;
513+
gpfx = 0;
514+
break;
515+
case EM_ARM:
516+
reltype = R_ARM_ABS32;
517+
altmcount = "__gnu_mcount_nc";
518+
make_nop = make_nop_arm;
519+
rel_type_nop = R_ARM_NONE;
520+
gpfx = 0;
513521
break;
514-
case EM_ARM: reltype = R_ARM_ABS32;
515-
altmcount = "__gnu_mcount_nc";
516-
make_nop = make_nop_arm;
517-
rel_type_nop = R_ARM_NONE;
518-
break;
519522
case EM_AARCH64:
520-
reltype = R_AARCH64_ABS64;
521-
make_nop = make_nop_arm64;
522-
rel_type_nop = R_AARCH64_NONE;
523-
ideal_nop = ideal_nop4_arm64;
524-
gpfx = '_';
525-
break;
526-
case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break;
527-
case EM_MIPS: /* reltype: e_class */ gpfx = '_'; break;
528-
case EM_PPC: reltype = R_PPC_ADDR32; gpfx = '_'; break;
529-
case EM_PPC64: reltype = R_PPC64_ADDR64; gpfx = '_'; break;
530-
case EM_S390: /* reltype: e_class */ gpfx = '_'; break;
531-
case EM_SH: reltype = R_SH_DIR32; break;
532-
case EM_SPARCV9: reltype = R_SPARC_64; gpfx = '_'; break;
523+
reltype = R_AARCH64_ABS64;
524+
make_nop = make_nop_arm64;
525+
rel_type_nop = R_AARCH64_NONE;
526+
ideal_nop = ideal_nop4_arm64;
527+
break;
528+
case EM_IA_64: reltype = R_IA64_IMM64; break;
529+
case EM_MIPS: /* reltype: e_class */ break;
530+
case EM_PPC: reltype = R_PPC_ADDR32; break;
531+
case EM_PPC64: reltype = R_PPC64_ADDR64; break;
532+
case EM_S390: /* reltype: e_class */ break;
533+
case EM_SH: reltype = R_SH_DIR32; gpfx = 0; break;
534+
case EM_SPARCV9: reltype = R_SPARC_64; break;
533535
case EM_X86_64:
534536
make_nop = make_nop_x86;
535537
ideal_nop = ideal_nop5_x86_64;
536538
reltype = R_X86_64_64;
537539
rel_type_nop = R_X86_64_NONE;
538540
mcount_adjust_64 = -1;
541+
gpfx = 0;
539542
break;
540543
} /* end switch */
541544

0 commit comments

Comments
 (0)