diff options
author | David Brazdil <dbrazdil@google.com> | 2020-07-30 16:25:19 +0300 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2020-07-30 16:47:19 +0300 |
commit | bdbc0c7a070c0cbe3009cd271c6ec8d87d69cc7a (patch) | |
tree | 4c47a84631fcc4b205ed450a667e05bfdedfd727 /include/trace | |
parent | 6de7dd31ded078b31a3812a46d8874f871b4e82f (diff) | |
download | linux-bdbc0c7a070c0cbe3009cd271c6ec8d87d69cc7a.tar.xz |
KVM: arm64: Ensure that all nVHE hyp code is in .hyp.text
Some compilers may put a subset of generated functions into '.text.*'
ELF sections and the linker may leverage this division to optimize ELF
layout. Unfortunately, the recently introduced HYPCOPY command assumes
that all executable code (with the exception of specialized sections
such as '.hyp.idmap.text') is in the '.text' section. If this
assumption is broken, code in '.text.*' will be merged into kernel
proper '.text' instead of the '.hyp.text' that is mapped in EL2.
To ensure that this cannot happen, insert an OBJDUMP assertion into
HYPCOPY. The command dumps a list of ELF sections in the input object
file and greps for '.text.'. If found, compilation fails. Tested with
both binutils' and LLVM's objdump (the output format is different).
GCC offers '-fno-reorder-functions' to disable this behaviour. Select
the flag if it is available. From inspection of GCC source (latest
Git in July 2020), this flag does force all code into '.text'.
By default, GCC uses profile data, heuristics and attributes to select
a subsection.
LLVM/Clang currently does not have a similar optimization pass. It can
place static constructors into '.text.startup' and it's optimizer can
be provided with profile data to reorder hot/cold functions. Neither
of these is applicable to nVHE hyp code. If this changes in the future,
the OBJDUMP assertion should alert users to the problem.
Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200730132519.48787-1-dbrazdil@google.com
Diffstat (limited to 'include/trace')
0 files changed, 0 insertions, 0 deletions