Skip to contentSkip to conversation

Makes softmmu compile with clang at HEAD

PATCH In review Shu-Chun Weng 2 participants 3 messages Mar 18, 2020 – Mar 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makes softmmu compile with clang at HEAD

With clang at HEAD, linking fails with "undefined symbol:
qemu_build_not_reached". It's because store_helper and helper_ret_stb_mmu are mutually recursive and clang inlined latter inside the former, making store_helper a recursive function and no longer fully inlineable preventing constant propogation.

---
 accel/tcg/cputlb.c | 1 +
 1 file changed, 1 insertion(+)
accel/tcg/cputlb.c +1 -0
index e3b5750c3b..a7c812ed72 100644
@@ -2050,6 +2050,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
     store_memop(haddr, val, op);
 }
 
+__attribute__((noinline))
 void helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,
                         TCGMemOpIdx oi, uintptr_t retaddr)
 {
Signature · 1 line
2.25.1.481.gfbce0eb801-goog
#1 lore raw

Ping.

Quoted 28 lines · Shu-Chun Weng

With clang at HEAD, linking fails with "undefined symbol:
qemu_build_not_reached". It's because store_helper and helper_ret_stb_mmu are mutually recursive and clang inlined latter inside the former, making store_helper a recursive function and no longer fully inlineable preventing constant propogation.

---
 accel/tcg/cputlb.c | 1 +
 1 file changed, 1 insertion(+)
accel/tcg/cputlb.c +1 -0
index e3b5750c3b..a7c812ed72 100644
@@ -2050,6 +2050,7 @@ store_helper(CPUArchState *env, target_ulong addr,
 uint64_t val,
     store_memop(haddr, val, op);
 }
 
+__attribute__((noinline))
 void helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,
                         TCGMemOpIdx oi, uintptr_t retaddr)

{
--
2.25.1.481.gfbce0eb801-goog

#2 lore raw
In reply to Shu-Chun Weng
Quoted 16 lines · Shu-Chun Weng

With clang at HEAD, linking fails with "undefined symbol:
qemu_build_not_reached". It's because store_helper and helper_ret_stb_mmu are mutually recursive and clang inlined latter inside the former, making store_helper a recursive function and no longer fully inlineable preventing constant propogation.

---
 accel/tcg/cputlb.c | 1 +
 1 file changed, 1 insertion(+)
accel/tcg/cputlb.c +0 -0
index e3b5750c3b..a7c812ed72 100644

accel/tcg/cputlb.c store_helper(CPUArchState *env, target_ulong addr, uint64_t val, · line 2055

Quoted 6 lines
accel/tcg/cputlb.c +1 -0
@@ -2050,6 +2050,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
     store_memop(haddr, val, op);
 }
 
+__attribute__((noinline))
 void helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,
                         TCGMemOpIdx oi, uintptr_t retaddr)

Hmm I wonder if the correct fix is for store_helper to callL

  store_memop(addr + i, val8, MO_UB);

direct in the fallback case - although the page crossing may be tricky to get right. Perhaps we should out of line all the unaligned stuff?

Signature · 1 line
Alex Bennée