x86: make hypervisor build with gcc11
authorJan Beulich <jbeulich@suse.com>
Fri, 4 Jun 2021 12:56:19 +0000 (14:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 4 Jun 2021 12:56:19 +0000 (14:56 +0200)
commitac507e078edcc18215d86c436d6c26dd76ffa15c
treed2d25f4c8c34af4423eec81ef1054498d7f25559
parentebfdf0c7eb0ba26a9e83f3f39bdf51452fa11b03
x86: make hypervisor build with gcc11

Gcc 11 looks to make incorrect assumptions about valid ranges that
pointers may be used for addressing when they are derived from e.g. a
plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.

Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
in at least
- mpparse.c:efi_check_config(),
- tboot.c:tboot_probe(),
- tboot.c:tboot_gen_frametable_integrity(),
- x86_emulate.c:x86_emulate() (at -O2 only).
The last case is particularly odd not just because it only triggers at
higher optimization levels, but also because it only affects one of at
least three similar constructs. Various "note" diagnostics claim the
valid index range to be [0, 2⁶³-1].

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Jason Andryuk <jandryuk@gmail.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 722f59d38c710a940ab05e542a83020eb5546dea
master date: 2021-05-27 14:40:29 +0200
tools/tests/x86_emulator/x86-emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/include/asm-x86/fixmap.h
xen/include/xen/compiler.h
xen/include/xen/pdx.h