1*8abe5c94SSong Liu // SPDX-License-Identifier: GPL-2.0 2*8abe5c94SSong Liu /* 3*8abe5c94SSong Liu * Data with an alignment stricter than its size. 4*8abe5c94SSong Liu * 5*8abe5c94SSong Liu * A cloned data section has to keep its sh_addralign. The kernel has plenty 6*8abe5c94SSong Liu * of data whose alignment is a correctness property rather than an 7*8abe5c94SSong Liu * optimisation -- per-CPU variables, anything touched by an aligned SSE move, 8*8abe5c94SSong Liu * cacheline-aligned locks -- and a clone that lands under-aligned faults or 9*8abe5c94SSong Liu * silently shares a cacheline it was written to avoid. 10*8abe5c94SSong Liu * 11*8abe5c94SSong Liu * The object is new in the patched build, so klp diff has to clone it rather 12*8abe5c94SSong Liu * than reference the kernel's copy. 13*8abe5c94SSong Liu */ 14*8abe5c94SSong Liu 15*8abe5c94SSong Liu static const char __modinfo[] 16*8abe5c94SSong Liu __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux"; 17*8abe5c94SSong Liu 18*8abe5c94SSong Liu #ifdef PATCHED 19*8abe5c94SSong Liu int aligned_data[2] __attribute__((aligned(64))) = { 1, 2 }; 20*8abe5c94SSong Liu #endif 21*8abe5c94SSong Liu target(int x)22*8abe5c94SSong Liuint target(int x) 23*8abe5c94SSong Liu { 24*8abe5c94SSong Liu #ifdef PATCHED 25*8abe5c94SSong Liu return x + aligned_data[0]; 26*8abe5c94SSong Liu #else 27*8abe5c94SSong Liu return x; 28*8abe5c94SSong Liu #endif 29*8abe5c94SSong Liu } 30