xref: /linux/tools/objtool/tests/generic/test-jump-label-module-key.sh (revision 5b6dca02b3e2254d2fd5706d76d7ab4610a67296)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# A static branch key owned by a module cannot be reached with a klp
5# relocation and must be rejected.
6
7. "$(dirname "$0")/../lib.sh"
8
9setup
10build_pair jump_label.c -DMODNAME='"klp_testmod"'
11
12has_input_section orig.o __jump_table ||
13	probe_skip "fixture produced no __jump_table on this arch"
14
15run_diff 255
16
17diff_log | grep -q 'unsupported static branch key klp_test_key' ||
18	fail "expected rejection, got: $(diff_log | tail -1)"
19[ -e "$workdir/out.o" ] &&
20	fail "output object produced for a rejected input"
21
22pass "module-owned static branch key rejected"
23