projects/linux·blob master · refs

26 lines · 711 B

1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# Only the patched function's special section entry may be extracted.
5
6. "$(dirname "$0")/../lib.sh"
7
8setup
9build_pair special_section_shared.c
10
11has_input_section orig.o .kcfi_traps ||
12 probe_skip "fixture produced no .kcfi_traps on this arch"
13
14run_diff
15
16assert_patched target
17assert_not_patched other
18assert_section ".kcfi_traps"
19
20entries="$(out_relocs | awk '/rela\.kcfi_traps/,/^$/' | grep -c 'target')"
21[ "$entries" = 1 ] || fail "expected one .kcfi_traps entry, found $entries"
22
23out_relocs | awk '/rela\.kcfi_traps/,/^$/' | grep -q 'other' &&
24 fail "the untouched function's entry was dragged in"
25
26pass "only the patched function's entry extracted"