summaryrefslogtreecommitdiff
path: root/tools/objtool/tests/generic/test-jump-label-module-key.sh
blob: 7c3f82cdd3c1a1fa6aa726cae86f1aa13174755b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# A static branch key owned by a module cannot be reached with a klp
# relocation and must be rejected.

. "$(dirname "$0")/../lib.sh"

setup
build_pair jump_label.c -DMODNAME='"klp_testmod"'

has_input_section orig.o __jump_table ||
	probe_skip "fixture produced no __jump_table on this arch"

run_diff 255

diff_log | grep -q 'unsupported static branch key klp_test_key' ||
	fail "expected rejection, got: $(diff_log | tail -1)"
[ -e "$workdir/out.o" ] &&
	fail "output object produced for a rejected input"

pass "module-owned static branch key rejected"