target/i386: set `CF_PCREL` in `x86_cpu_realizefn`
authorAnton Johansson <anjo@rev.ng>
Mon, 27 Feb 2023 13:51:37 +0000 (14:51 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 1 Mar 2023 17:31:27 +0000 (07:31 -1000)
Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-3-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
target/i386/cpu.c

index 4bad3d41d33fee6fcebff4816286e494d770dd6d..62755bf51144fd0cbe3f99a1a73f7488272b813e 100644 (file)
@@ -6534,6 +6534,11 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     static bool ht_warned;
     unsigned requested_lbr_fmt;
 
+    /* Use pc-relative instructions in system-mode */
+#ifndef CONFIG_USER_ONLY
+    cs->tcg_cflags |= CF_PCREL;
+#endif
+
     if (cpu->apic_id == UNASSIGNED_APIC_ID) {
         error_setg(errp, "apic-id property was not initialized properly");
         return;