1*317cf7bbSSong Liu // SPDX-License-Identifier: GPL-2.0 2*317cf7bbSSong Liu /* 3*317cf7bbSSong Liu * A switch dense enough that Clang builds a jump table for it, in a section of 4*317cf7bbSSong Liu * its own: .rodata..Lswitch.table.<function>. 5*317cf7bbSSong Liu * 6*317cf7bbSSong Liu * The table belongs to the function and has to travel with it. It is named 7*317cf7bbSSong Liu * after the function but is not part of it, so klp diff has to associate the 8*317cf7bbSSong Liu * two rather than treating the table as unrelated data. 9*317cf7bbSSong Liu * 10*317cf7bbSSong Liu * The patch adds a case, which changes the table's contents and length. 11*317cf7bbSSong Liu */ 12*317cf7bbSSong Liu 13*317cf7bbSSong Liu static const char __modinfo[] 14*317cf7bbSSong Liu __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux"; status_to_string(unsigned int c)15*317cf7bbSSong Liuconst char *status_to_string(unsigned int c) 16*317cf7bbSSong Liu { 17*317cf7bbSSong Liu switch (c) { 18*317cf7bbSSong Liu case 0: return "idle"; 19*317cf7bbSSong Liu case 1: return "running"; 20*317cf7bbSSong Liu case 2: return "stopped"; 21*317cf7bbSSong Liu case 3: return "error"; 22*317cf7bbSSong Liu case 4: return "paused"; 23*317cf7bbSSong Liu case 5: return "waiting"; 24*317cf7bbSSong Liu case 6: return "starting"; 25*317cf7bbSSong Liu case 7: return "stopping"; 26*317cf7bbSSong Liu #ifdef PATCHED 27*317cf7bbSSong Liu case 8: return "completed"; 28*317cf7bbSSong Liu #endif 29*317cf7bbSSong Liu } 30*317cf7bbSSong Liu return "unknown"; 31*317cf7bbSSong Liu } 32