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