Skip to contentSkip to conversation

Remove warning in tcg stub (tcg_out_reloc)

PATCH In review Alexander Graf 4 participants 8 messages May 11, 2010 – May 21, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove warning in tcg stub (tcg_out_reloc)

On S390 we don't have a real TCG implementation but use a stub instead. This stub obviously doesn't call any of the TCG helper functions that are usually used by the other TCG targets.

If such a helper function is static though, we end up getting a warning that turns into an error thanks to Werror. So to successfully compile qemu, we need to get rid of it. In this case it's tcg_out_reloc.

To do that, I figured the easiest way is to call tcg_out_reloc with dumb parameters after an abort call. That way the code in question never gets executed, but we got rid of the warning.

---
 tcg/s390/tcg-target.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tcg/s390/tcg-target.c +6 -0
index 265194a..f1a336d 100644
@@ -35,6 +35,12 @@ static void patch_reloc(uint8_t *code_ptr, int type,
                 tcg_target_long value, tcg_target_long addend)
 {
     tcg_abort();
+
+    /*
+     * XXX We need to call this function at least once, since it's static.
+     *     Please remove that code when implementing real s390x tcg support.
+     */
+    tcg_out_reloc(NULL, NULL, 0, 0, 0);
 }
 
 static inline int tcg_target_get_call_iarg_regs_count(int flags)
Signature · 1 line
1.6.0.2
#1 lore raw

Am 11.05.2010 18:23, schrieb Alexander Graf:

Quoted 24 lines

On S390 we don't have a real TCG implementation but use a stub instead. This stub obviously doesn't call any of the TCG helper functions that are usually used by the other TCG targets.

If such a helper function is static though, we end up getting a warning that turns into an error thanks to Werror. So to successfully compile qemu, we need to get rid of it. In this case it's tcg_out_reloc.

To do that, I figured the easiest way is to call tcg_out_reloc with dumb parameters after an abort call. That way the code in question never gets executed, but we got rid of the warning.

---
tcg/s390/tcg-target.c | 6 ++++++

1 files changed, 6 insertions(+), 0 deletions(-)
tcg/s390/tcg-target.c +0 -0
index 265194a..f1a336d 100644
@@ -35,6 +35,12 @@ static void patch_reloc(uint8_t *code_ptr, int type,
 tcg_target_long value, tcg_target_long addend)
 {

tcg/s390/tcg-target.c static void patch_reloc(uint8_t *code_ptr, int type, · line 46

Quoted 10 lines
tcg/s390/tcg-target.c +6 -0
 tcg_abort();
+
+ /*
+ * XXX We need to call this function at least once, since it's static.
+ * Please remove that code when implementing real s390x tcg support.
+ */
+ tcg_out_reloc(NULL, NULL, 0, 0, 0);
 }
 
 static inline int tcg_target_get_call_iarg_regs_count(int flags)

Won't you get another warning about unreachable code because tcg_abort never returns?

What about condition compilation for tcg_out_reloc (don't compile it for hosts which don't need it)?

Regards,
Stefan

#2 lore raw
Quoted 2 lines · Stefan Weil

Won't you get another warning about unreachable code because tcg_abort never returns?

We don't enable that warning.

Quoted 2 lines

What about condition compilation for tcg_out_reloc (don't compile it for hosts which don't need it)?

All hosts should need it. S390 doesn't only because it's all stubbed out.

Frankly, it shouldn't take much effort to get a working TCG for s390x...

r~

#3 lore raw

Am 11.05.2010 um 19:26 schrieb Richard Henderson <[email protected]>:

Quoted 6 lines · Stefan Weil
Quoted 2 lines

Won't you get another warning about unreachable code because tcg_abort never returns?

We don't enable that warning.

Quoted 8 lines
Quoted 2 lines

What about condition compilation for tcg_out_reloc (don't compile it for hosts which don't need it)?

All hosts should need it. S390 doesn't only because it's all stubbed out.

Frankly, it shouldn't take much effort to get a working TCG for s390x...

Yeah, I have submitted a patch months ago, but Aurelien didn't get around to review it yet :(.

Alex

Quoted 1 line
#4 lore raw
Quoted 12 lines · Alexander Graf

Am 11.05.2010 um 19:26 schrieb Richard Henderson <[email protected]>:

Quoted 9 lines · Stefan Weil
Quoted 2 lines

Won't you get another warning about unreachable code because tcg_abort never returns?

We don't enable that warning.

Quoted 2 lines

What about condition compilation for tcg_out_reloc (don't compile it for hosts which don't need it)?

Quoted 9 lines
Quoted 5 lines

All hosts should need it. S390 doesn't only because it's all stubbed out.

Frankly, it shouldn't take much effort to get a working TCG for s390x...

Yeah, I have submitted a patch months ago, but Aurelien didn't get around to review it yet :(.

This is indeed the best solution. It's still on my TODO list, just that I have limited time and it's always easier to choose to ignore one big patch and got complains from a single person, than ignoring a lot of small patches and getting a lot of complains...

If only people were reviewing other people patches a bit more...

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#5 lore raw
Quoted 19 lines · Aurelien Jarno
Quoted 18 lines · Alexander Graf

Am 11.05.2010 um 19:26 schrieb Richard Henderson <[email protected]>:

Quoted 14 lines · Stefan Weil
Quoted 2 lines

Won't you get another warning about unreachable code because tcg_abort never returns?

We don't enable that warning.

Quoted 2 lines

What about condition compilation for tcg_out_reloc (don't compile it for hosts which don't need it)?

All hosts should need it. S390 doesn't only because it's all stubbed out.

Frankly, it shouldn't take much effort to get a working TCG for s390x...

Quoted 8 lines
Quoted 3 lines

Yeah, I have submitted a patch months ago, but Aurelien didn't get around to review it yet :(.

This is indeed the best solution. It's still on my TODO list, just that I have limited time and it's always easier to choose to ignore one big patch and got complains from a single person, than ignoring a lot of small patches and getting a lot of complains...

I can split up the patch if you like :).

Quoted 1 line

If only people were reviewing other people patches a bit more...

Maybe Richard could also help to review it? If so, I can certainly rebase it to current git and send it off again.

Alex

#6 lore raw
In reply to Alexander Graf
Quoted 23 lines · Alexander Graf

On S390 we don't have a real TCG implementation but use a stub instead. This stub obviously doesn't call any of the TCG helper functions that are usually used by the other TCG targets.

If such a helper function is static though, we end up getting a warning that turns into an error thanks to Werror. So to successfully compile qemu, we need to get rid of it. In this case it's tcg_out_reloc.

To do that, I figured the easiest way is to call tcg_out_reloc with dumb parameters after an abort call. That way the code in question never gets executed, but we got rid of the warning.

---
 tcg/s390/tcg-target.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tcg/s390/tcg-target.c +0 -0
index 265194a..f1a336d 100644
@@ -35,6 +35,12 @@ static void patch_reloc(uint8_t *code_ptr, int type,
                 tcg_target_long value, tcg_target_long addend)

tcg/s390/tcg-target.c static void patch_reloc(uint8_t *code_ptr, int type, · line 45

Quoted 10 lines
tcg/s390/tcg-target.c +6 -0
 {
     tcg_abort();
+
+    /*
+     * XXX We need to call this function at least once, since it's static.
+     *     Please remove that code when implementing real s390x tcg support.
+     */
+    tcg_out_reloc(NULL, NULL, 0, 0, 0);
 }
 

What about declaring tcg_out_reloc static inline?

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#7 lore raw
Quoted 5 lines · Aurelien Jarno
Quoted 3 lines

+ tcg_out_reloc(NULL, NULL, 0, 0, 0);
}

What about declaring tcg_out_reloc static inline?

I think we're not far away from a mergable s390 port. I think the smallest local change is best in the interim.

r~