1 // SPDX-License-Identifier: GPL-2.0 2 /* Patched function referencing data in an .init section. */ 3 4 static const char __modinfo[] 5 __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux"; 6 7 /* volatile so the read cannot be folded into a constant, leaving no reference */ 8 static volatile int init_only __attribute__((section(".init.data"), used)) = 5; 9 10 int target(int x) 11 { 12 #ifdef PATCHED 13 return x + init_only + 1; 14 #else 15 return x + init_only; 16 #endif 17 } 18