Skip to contentSkip to conversation

qemu-barrier: Fix compiler version check for future gcc versions

PATCH Applied Stefan Weil 3 participants 4 messages Oct 3, 2012 – Oct 8, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-barrier: Fix compiler version check for future gcc versions

The current check will give a wrong result for gcc-5.x with x < 4. Using QEMU_GNUC_PREREQ is simpler and fixes that issue.

---

With current gcc versions (gcc-4.x) there is no problem. Nevertheless, I suggest to fix this in stable versions, too.

Regards

Stefan Weil

 qemu-barrier.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-barrier.h +1 -1
index 7e11197..16f0942 100644
@@ -19,7 +19,7 @@
  * mfence on 32 bit as well, e.g. if built with -march=pentium-m.
  * However, on i386, there seem to be known bugs as recently as 4.3.
  * */
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4
+#if QEMU_GNUC_PREREQ(4, 4)
 #define smp_mb() __sync_synchronize()
 #else
 #define smp_mb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")
Signature · 1 line
1.7.10
#1 lore raw
Quoted 9 lines · Stefan Weil

The current check will give a wrong result for gcc-5.x with x < 4. Using QEMU_GNUC_PREREQ is simpler and fixes that issue.

---

With current gcc versions (gcc-4.x) there is no problem. Nevertheless, I suggest to fix this in stable versions, too.

Quoted 6 lines

Regards

Stefan Weil

 qemu-barrier.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

#2 lore raw
In reply to Stefan Weil
Quoted 4 lines · Stefan Weil

The current check will give a wrong result for gcc-5.x with x < 4. Using QEMU_GNUC_PREREQ is simpler and fixes that issue.

Quoted 8 lines

---

With current gcc versions (gcc-4.x) there is no problem. Nevertheless, I suggest to fix this in stable versions, too.

Regards

Stefan Weil

ACK for stable tree.

Quoted 18 lines
 qemu-barrier.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-barrier.h +1 -1
index 7e11197..16f0942 100644
@@ -19,7 +19,7 @@
  * mfence on 32 bit as well, e.g. if built with -march=pentium-m.
  * However, on i386, there seem to be known bugs as recently as 4.3.
  * */
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4
+#if QEMU_GNUC_PREREQ(4, 4)
 #define smp_mb() __sync_synchronize()
 #else
 #define smp_mb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")
Signature · 1 line
1.7.10
#3 lore raw

Am 08.10.2012 22:01, schrieb Michael S. Tsirkin:

Quoted 18 lines · Stefan Weil
Quoted 4 lines

The current check will give a wrong result for gcc-5.x with x < 4. Using QEMU_GNUC_PREREQ is simpler and fixes that issue.

Quoted 8 lines

---

With current gcc versions (gcc-4.x) there is no problem. Nevertheless, I suggest to fix this in stable versions, too.

Regards

Stefan Weil

ACK for stable tree.

Quoted 3 lines
  qemu-barrier.h |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 15 lines
qemu-barrier.h +1 -1
index 7e11197..16f0942 100644
@@ -19,7 +19,7 @@
   * mfence on 32 bit as well, e.g. if built with -march=pentium-m.
   * However, on i386, there seem to be known bugs as recently as 4.3.
   * */
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 4
+#if QEMU_GNUC_PREREQ(4, 4)
  #define smp_mb() __sync_synchronize()
  #else
  #define smp_mb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")
Signature · 1 line
1.7.10

My patch was incomplete: an include statement for compiler.h is needed (see the patches which were applied to the same file in git master.

Regards

Stefan Weil