| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 |
|
| 7 | . "$(dirname "$0")/../lib.sh"
|
| 8 |
|
| 9 | key=klp_test_key
|
| 10 |
|
| 11 | setup
|
| 12 | build_pair jump_label.c
|
| 13 |
|
| 14 | has_input_section orig.o __jump_table ||
|
| 15 | probe_skip "fixture produced no __jump_table on this arch"
|
| 16 |
|
| 17 | key_slot_relocs()
|
| 18 | {
|
| 19 | out_relocs | awk '/rela__jump_table/,/^$/' | grep -c "^0*8[[:space:]]"
|
| 20 | }
|
| 21 |
|
| 22 | |
| 23 | export_syms
|
| 24 | run_diff
|
| 25 |
|
| 26 | [ "$(key_slot_relocs)" = 1 ] ||
|
| 27 | fail "unexported key: key slot has no relocation"
|
| 28 | out_relocs | awk '/rela__jump_table/,/^$/' | grep -q "\.klp\.tombstone\.$key" ||
|
| 29 | fail "unexported key: expected a .klp.tombstone.$key relocation"
|
| 30 | out_symbols | grep -q "\.klp\.sym\..*\.$key," ||
|
| 31 | fail "unexported key: no .klp.sym reference for the real relocation"
|
| 32 |
|
| 33 | |
| 34 | export_syms "$key"
|
| 35 | run_diff
|
| 36 |
|
| 37 | [ "$(key_slot_relocs)" = 1 ] ||
|
| 38 | fail "exported key: key slot has no relocation"
|
| 39 | out_relocs | awk '/rela__jump_table/,/^$/' | grep -q "[[:space:]]$key[[:space:]]*+" ||
|
| 40 | fail "exported key: expected a direct relocation to $key"
|
| 41 | out_symbols | grep -q '\.klp\.tombstone\.' &&
|
| 42 | fail "exported key: tombstone emitted for an exported symbol"
|
| 43 |
|
| 44 | pass "key slot populated for exported and unexported vmlinux keys"
|