xref: /linux/tools/objtool/tests/generic/test-static-local.sh (revision 5b6dca02b3e2254d2fd5706d76d7ab4610a67296)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# A static local must be correlated with the original, not duplicated: a second
5# copy would discard the state the running kernel accumulated.
6
7. "$(dirname "$0")/../lib.sh"
8
9setup
10build_pair static_local.c
11
12in_symbols orig.o | grep -q 'counter' ||
13	probe_skip "compiler emitted no distinct static local symbol"
14
15run_diff
16assert_patched target
17
18out_symbols | grep -q '\.klp\.sym\..*\.counter' ||
19	fail "static local not referenced through a klp relocation"
20
21out_symbols | grep 'counter' | grep -qvE 'UND|\.klp\.(sym|tombstone)' &&
22	fail "static local was given a fresh definition"
23
24pass "static local correlated rather than duplicated"
25