1*638df22cSSong Liu // SPDX-License-Identifier: GPL-2.0 2*638df22cSSong Liu /* 3*638df22cSSong Liu * A static whose name recurs in every translation unit that includes it. 4*638df22cSSong Liu * Compiled once for a single-copy object and twice, partially linked, for one 5*638df22cSSong Liu * with duplicates -- which is the only case where sympos is non-zero. 6*638df22cSSong Liu * 7*638df22cSSong Liu * FUNC_NAME keeps the referencing functions distinct so both get patched. 8*638df22cSSong Liu * Only the first copy carries .modinfo; two would be a second thing to 9*638df22cSSong Liu * disambiguate and is not what this fixture is about. 10*638df22cSSong Liu */ 11*638df22cSSong Liu 12*638df22cSSong Liu #ifndef FUNC_NAME 13*638df22cSSong Liu #define FUNC_NAME use_a 14*638df22cSSong Liu #endif 15*638df22cSSong Liu 16*638df22cSSong Liu #ifndef NO_MODINFO 17*638df22cSSong Liu static const char __modinfo[] 18*638df22cSSong Liu __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux"; 19*638df22cSSong Liu #endif 20*638df22cSSong Liu 21*638df22cSSong Liu /* volatile so it survives as an STT_OBJECT rather than being folded away */ 22*638df22cSSong Liu static volatile int dup_counter = 1; 23*638df22cSSong Liu FUNC_NAME(int x)24*638df22cSSong Liuint FUNC_NAME(int x) 25*638df22cSSong Liu { 26*638df22cSSong Liu dup_counter += x; 27*638df22cSSong Liu #ifdef PATCHED 28*638df22cSSong Liu return dup_counter + 1; 29*638df22cSSong Liu #else 30*638df22cSSong Liu return dup_counter; 31*638df22cSSong Liu #endif 32*638df22cSSong Liu } 33