blob: 818b047ed4b62f88c754d61c07dd61de65457c6f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# A patch may remove the last ANNOTATE_DATA_SPECIAL in a translation unit while
# leaving the special section it described in place.
#
# klp diff needs entry boundaries for a special section: either an entsize, or
# annotations naming where each entry starts. .static_call_sites has no
# entsize, so the annotations are all there is -- and when the patched object
# is the only side that lost them, the two sides no longer agree on how the
# section divides up.
#
# The section must still be handled. Dropping it would leave the patched
# function's static call unregistered; misreading its boundaries would attach
# the entry to the wrong code. Either way nothing is reported at build time.
#
# Fixed by commit 3de711fba73a ("objtool/klp: Fix create_fake_symbols()
# skipping entsize-based sections").
#
# Covers the same ground as corpus/x86_64/static-call-annotate-stripped in Joe
# Lawrence's klp-build unit test corpus.
. "$(dirname "$0")/../lib.sh"
setup
build_pair static_call.c -DNO_ANNOTATE
# The premise: the original describes its entry, the patched one no longer
# does, and both still have the section itself.
has_input_section orig.o .discard.annotate_data ||
fail "fixture produced no annotation in the original"
has_input_section patched.o .discard.annotate_data &&
fail "patched object still has the annotation; nothing was stripped"
assert_input_section .static_call_sites
run_diff
assert_patched target
assert_section .static_call_sites
assert_reloc_sym .static_call_sites target
pass "static call site kept when the patch strips its data annotation"
|