| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 |
|
| 7 | . "$(dirname "$0")/../lib.sh"
|
| 8 |
|
| 9 | |
| 10 | |
| 11 | |
| 12 | gcc_only "clang does not split functions into a cold part"
|
| 13 |
|
| 14 | setup
|
| 15 |
|
| 16 | split_flag=-freorder-blocks-and-partition
|
| 17 | cc_supports "$split_flag" || split_flag=
|
| 18 |
|
| 19 | build_pair cold_function.c $split_flag
|
| 20 |
|
| 21 | |
| 22 | |
| 23 | cold_sym="$(in_symbols orig.o | awk '$NF ~ /^target\.cold/ { print $NF; exit }')"
|
| 24 | [ -n "$cold_sym" ] ||
|
| 25 | probe_skip "compiler did not split the function into a cold part"
|
| 26 |
|
| 27 | run_diff
|
| 28 |
|
| 29 | assert_patched target
|
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | out_symbols | awk -v n="$cold_sym" '$NF == n && $(NF - 1) != "UND"' | grep -q . ||
|
| 37 | fail "cold half ($cold_sym) was not carried into the patch"
|
| 38 |
|
| 39 | pass "cold half carried into the patch with its parent"
|