qemu/compiler: Split out qemu_build_not_reached_always

Provide a symbol that can always be used to signal an error,
regardless of optimization. Usage of this should be protected
by e.g. __builtin_constant_p, which guards for optimization.

Backports c52ea111e0ea2d5368a3ae601baafaae75e3317f
This commit is contained in:
Richard Henderson 2021-03-04 15:23:11 -05:00 committed by Lioncash
parent d36a968f8e
commit 554a304d3d
17 changed files with 43 additions and 60 deletions

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_aarch64
#define qdict_size qdict_size_aarch64
#define qdict_type qdict_type_aarch64
#define qemu_build_not_reached_always qemu_build_not_reached_always_aarch64
#define qemu_clock_get_us qemu_clock_get_us_aarch64
#define qemu_clock_ptr qemu_clock_ptr_aarch64
#define qemu_clocks qemu_clocks_aarch64
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_aarch64
#define tcg_gen_divu_i32 tcg_gen_divu_i32_aarch64
#define tcg_gen_divu_i64 tcg_gen_divu_i64_aarch64
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_aarch64
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_aarch64
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_aarch64
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_aarch64
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_aarch64
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_aarch64
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_aarch64

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_aarch64eb
#define qdict_size qdict_size_aarch64eb
#define qdict_type qdict_type_aarch64eb
#define qemu_build_not_reached_always qemu_build_not_reached_always_aarch64eb
#define qemu_clock_get_us qemu_clock_get_us_aarch64eb
#define qemu_clock_ptr qemu_clock_ptr_aarch64eb
#define qemu_clocks qemu_clocks_aarch64eb
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_aarch64eb
#define tcg_gen_divu_i32 tcg_gen_divu_i32_aarch64eb
#define tcg_gen_divu_i64 tcg_gen_divu_i64_aarch64eb
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_aarch64eb
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_aarch64eb
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_aarch64eb
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_aarch64eb
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_aarch64eb
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_aarch64eb
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_aarch64eb

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_arm
#define qdict_size qdict_size_arm
#define qdict_type qdict_type_arm
#define qemu_build_not_reached_always qemu_build_not_reached_always_arm
#define qemu_clock_get_us qemu_clock_get_us_arm
#define qemu_clock_ptr qemu_clock_ptr_arm
#define qemu_clocks qemu_clocks_arm
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_arm
#define tcg_gen_divu_i32 tcg_gen_divu_i32_arm
#define tcg_gen_divu_i64 tcg_gen_divu_i64_arm
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_arm
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_arm
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_arm
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_arm
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_arm
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_arm
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_arm

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_armeb
#define qdict_size qdict_size_armeb
#define qdict_type qdict_type_armeb
#define qemu_build_not_reached_always qemu_build_not_reached_always_armeb
#define qemu_clock_get_us qemu_clock_get_us_armeb
#define qemu_clock_ptr qemu_clock_ptr_armeb
#define qemu_clocks qemu_clocks_armeb
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_armeb
#define tcg_gen_divu_i32 tcg_gen_divu_i32_armeb
#define tcg_gen_divu_i64 tcg_gen_divu_i64_armeb
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_armeb
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_armeb
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_armeb
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_armeb
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_armeb
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_armeb
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_armeb

View file

@ -2622,6 +2622,7 @@ symbols = (
'qdict_rename_keys',
'qdict_size',
'qdict_type',
'qemu_build_not_reached_always',
'qemu_clock_get_us',
'qemu_clock_ptr',
'qemu_clocks',

View file

@ -44,6 +44,33 @@
# define QEMU_NONSTRING
#endif
/*
* Forced inlining may be desired to encourage constant propagation
* of function parameters. However, it can also make debugging harder,
* so disable it for a non-optimizing build.
*/
#if defined(__OPTIMIZE__)
#define QEMU_ALWAYS_INLINE __attribute__((always_inline))
#else
#define QEMU_ALWAYS_INLINE
#endif
/**
* qemu_build_not_reached()
*
* The compiler, during optimization, is expected to prove that a call
* to this function cannot be reached and remove it. If the compiler
* supports QEMU_ERROR, this will be reported at compile time; otherwise
* this will be reported at link time due to the missing symbol.
*/
#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
qemu_build_not_reached_always(void);
#define qemu_build_not_reached() qemu_build_not_reached_always()
#else
#define qemu_build_not_reached() g_assert_not_reached()
#endif
#ifdef _MSC_VER
// MSVC support

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_m68k
#define qdict_size qdict_size_m68k
#define qdict_type qdict_type_m68k
#define qemu_build_not_reached_always qemu_build_not_reached_always_m68k
#define qemu_clock_get_us qemu_clock_get_us_m68k
#define qemu_clock_ptr qemu_clock_ptr_m68k
#define qemu_clocks qemu_clocks_m68k
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_m68k
#define tcg_gen_divu_i32 tcg_gen_divu_i32_m68k
#define tcg_gen_divu_i64 tcg_gen_divu_i64_m68k
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_m68k
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_m68k
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_m68k
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_m68k
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_m68k
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_m68k
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_m68k

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_mips
#define qdict_size qdict_size_mips
#define qdict_type qdict_type_mips
#define qemu_build_not_reached_always qemu_build_not_reached_always_mips
#define qemu_clock_get_us qemu_clock_get_us_mips
#define qemu_clock_ptr qemu_clock_ptr_mips
#define qemu_clocks qemu_clocks_mips
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_mips
#define tcg_gen_divu_i32 tcg_gen_divu_i32_mips
#define tcg_gen_divu_i64 tcg_gen_divu_i64_mips
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_mips
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_mips
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_mips
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_mips
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_mips
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_mips
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_mips

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_mips64
#define qdict_size qdict_size_mips64
#define qdict_type qdict_type_mips64
#define qemu_build_not_reached_always qemu_build_not_reached_always_mips64
#define qemu_clock_get_us qemu_clock_get_us_mips64
#define qemu_clock_ptr qemu_clock_ptr_mips64
#define qemu_clocks qemu_clocks_mips64
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_mips64
#define tcg_gen_divu_i32 tcg_gen_divu_i32_mips64
#define tcg_gen_divu_i64 tcg_gen_divu_i64_mips64
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_mips64
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_mips64
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_mips64
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_mips64
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_mips64
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_mips64
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_mips64

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_mips64el
#define qdict_size qdict_size_mips64el
#define qdict_type qdict_type_mips64el
#define qemu_build_not_reached_always qemu_build_not_reached_always_mips64el
#define qemu_clock_get_us qemu_clock_get_us_mips64el
#define qemu_clock_ptr qemu_clock_ptr_mips64el
#define qemu_clocks qemu_clocks_mips64el
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_mips64el
#define tcg_gen_divu_i32 tcg_gen_divu_i32_mips64el
#define tcg_gen_divu_i64 tcg_gen_divu_i64_mips64el
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_mips64el
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_mips64el
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_mips64el
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_mips64el
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_mips64el
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_mips64el
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_mips64el

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_mipsel
#define qdict_size qdict_size_mipsel
#define qdict_type qdict_type_mipsel
#define qemu_build_not_reached_always qemu_build_not_reached_always_mipsel
#define qemu_clock_get_us qemu_clock_get_us_mipsel
#define qemu_clock_ptr qemu_clock_ptr_mipsel
#define qemu_clocks qemu_clocks_mipsel
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_mipsel
#define tcg_gen_divu_i32 tcg_gen_divu_i32_mipsel
#define tcg_gen_divu_i64 tcg_gen_divu_i64_mipsel
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_mipsel
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_mipsel
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_mipsel
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_mipsel
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_mipsel
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_mipsel
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_mipsel

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_powerpc
#define qdict_size qdict_size_powerpc
#define qdict_type qdict_type_powerpc
#define qemu_build_not_reached_always qemu_build_not_reached_always_powerpc
#define qemu_clock_get_us qemu_clock_get_us_powerpc
#define qemu_clock_ptr qemu_clock_ptr_powerpc
#define qemu_clocks qemu_clocks_powerpc
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_powerpc
#define tcg_gen_divu_i32 tcg_gen_divu_i32_powerpc
#define tcg_gen_divu_i64 tcg_gen_divu_i64_powerpc
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_powerpc
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_powerpc
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_powerpc
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_powerpc
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_powerpc
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_powerpc
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_powerpc

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_riscv32
#define qdict_size qdict_size_riscv32
#define qdict_type qdict_type_riscv32
#define qemu_build_not_reached_always qemu_build_not_reached_always_riscv32
#define qemu_clock_get_us qemu_clock_get_us_riscv32
#define qemu_clock_ptr qemu_clock_ptr_riscv32
#define qemu_clocks qemu_clocks_riscv32
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_riscv32
#define tcg_gen_divu_i32 tcg_gen_divu_i32_riscv32
#define tcg_gen_divu_i64 tcg_gen_divu_i64_riscv32
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_riscv32
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_riscv32
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_riscv32
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_riscv32
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_riscv32
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_riscv32
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_riscv32

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_riscv64
#define qdict_size qdict_size_riscv64
#define qdict_type qdict_type_riscv64
#define qemu_build_not_reached_always qemu_build_not_reached_always_riscv64
#define qemu_clock_get_us qemu_clock_get_us_riscv64
#define qemu_clock_ptr qemu_clock_ptr_riscv64
#define qemu_clocks qemu_clocks_riscv64
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_riscv64
#define tcg_gen_divu_i32 tcg_gen_divu_i32_riscv64
#define tcg_gen_divu_i64 tcg_gen_divu_i64_riscv64
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_riscv64
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_riscv64
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_riscv64
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_riscv64
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_riscv64
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_riscv64
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_riscv64

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_sparc
#define qdict_size qdict_size_sparc
#define qdict_type qdict_type_sparc
#define qemu_build_not_reached_always qemu_build_not_reached_always_sparc
#define qemu_clock_get_us qemu_clock_get_us_sparc
#define qemu_clock_ptr qemu_clock_ptr_sparc
#define qemu_clocks qemu_clocks_sparc
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_sparc
#define tcg_gen_divu_i32 tcg_gen_divu_i32_sparc
#define tcg_gen_divu_i64 tcg_gen_divu_i64_sparc
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_sparc
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_sparc
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_sparc
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_sparc
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_sparc
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_sparc
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_sparc

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_sparc64
#define qdict_size qdict_size_sparc64
#define qdict_type qdict_type_sparc64
#define qemu_build_not_reached_always qemu_build_not_reached_always_sparc64
#define qemu_clock_get_us qemu_clock_get_us_sparc64
#define qemu_clock_ptr qemu_clock_ptr_sparc64
#define qemu_clocks qemu_clocks_sparc64
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_sparc64
#define tcg_gen_divu_i32 tcg_gen_divu_i32_sparc64
#define tcg_gen_divu_i64 tcg_gen_divu_i64_sparc64
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_sparc64
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_sparc64
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_sparc64
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_sparc64
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_sparc64
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_sparc64
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_sparc64

View file

@ -2616,6 +2616,7 @@
#define qdict_rename_keys qdict_rename_keys_x86_64
#define qdict_size qdict_size_x86_64
#define qdict_type qdict_type_x86_64
#define qemu_build_not_reached_always qemu_build_not_reached_always_x86_64
#define qemu_clock_get_us qemu_clock_get_us_x86_64
#define qemu_clock_ptr qemu_clock_ptr_x86_64
#define qemu_clocks qemu_clocks_x86_64
@ -3068,10 +3069,6 @@
#define tcg_gen_div_i64 tcg_gen_div_i64_x86_64
#define tcg_gen_divu_i32 tcg_gen_divu_i32_x86_64
#define tcg_gen_divu_i64 tcg_gen_divu_i64_x86_64
#define tcg_gen_dup8i_vec tcg_gen_dup8i_vec_x86_64
#define tcg_gen_dup16i_vec tcg_gen_dup16i_vec_x86_64
#define tcg_gen_dup32i_vec tcg_gen_dup32i_vec_x86_64
#define tcg_gen_dup64i_vec tcg_gen_dup64i_vec_x86_64
#define tcg_gen_dupi_vec tcg_gen_dupi_vec_x86_64
#define tcg_gen_dupm_vec tcg_gen_dupm_vec_x86_64
#define tcg_gen_dup_i32_vec tcg_gen_dup_i32_vec_x86_64