configure: Check whether we can compile the s390-ccw bios with -msoft-float
PATCH 1/1 configure: Check whether we can compile the s390-ccw bios with -msoft-float
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions unexpectedly, we block those old compilers now via a test in the configure script. Note that for some weird reasons, the Clang compiler only complains about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "compile_object" instead of "compile_prog" for this check.
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -5462,7 +5462,7 @@ if test "$cpu" = "s390x" ; then write_c_skeleton compile_prog "-march=z900" "" has_z900=$? - if [ $has_z900 = 0 ] || compile_prog "-march=z10" ""; then + if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then if [ $has_z900 != 0 ]; then echo "WARNING: Your compiler does not support the z900!" echo " The s390-ccw bios will only work with guest CPUs >= z10."
Signature · 1 line
2.27.0
Quoted 7 lines · On Tue, 25 May 2021 16:20:32 +0200 Thomas Huth <[email protected]> wrote:
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions unexpectedly, we block those old compilers now via a test in the configure script. Note that for some weird reasons, the Clang compiler only complains about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "
compile_object" instead of "compile_prog" for this check.
Ugh.
Quoted 11 lines
Signed-off-by Thomas Huth <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure if test "$cpu" = "s390x" ; then · line 5465
Quoted 5 lines
configure +1
-1@@ -5462,7 +5462,7 @@ if test "$cpu" = "s390x" ; then write_c_skeleton compile_prog "-march=z900" "" has_z900=$? - if [ $has_z900 = 0 ] || compile_prog "-march=z10" ""; then + if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; then
Do you believe that we should have caught the various clang specialties now?
Quoted 3 lines
configure +0
-0if [ $has_z900 != 0 ]; then echo "WARNING: Your compiler does not support the z900!" echo " The s390-ccw bios will only work with guest CPUs >= z10."
Quoted 11 lines · Cornelia Huck
Quoted 7 lines · On Tue, 25 May 2021 16:20:32 +0200 Thomas Huth <[email protected]> wrote:
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions unexpectedly, we block those old compilers now via a test in the configure script. Note that for some weird reasons, the Clang compiler only complains about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "
compile_object" instead of "compile_prog" for this check.
Quoted 1 line
Ugh.
It's maybe better to use compile_object for testing -msoft-float anyway since it could influence the way of linking against libraries (if I get https://reviews.llvm.org/D72189 right).
Quoted 6 lines
Quoted 6 lines
Signed-off-by Thomas Huth <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
configure if test "$cpu" = "s390x" ; then · line 5465
Quoted 10 lines
configure +1
-1@@ -5462,7 +5462,7 @@ if test "$cpu" = "s390x" ; then write_c_skeleton compile_prog "-march=z900" "" has_z900=$? - if [ $has_z900 = 0 ] || compile_prog "-march=z10" ""; then + if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; thenDo you believe that we should have caught the various clang specialties now?
Apart from one compiler warning that just popped up today, yes. I'm seeing this compiler warning with Clang 12.0 now:
roms/SLOF/lib/libnet/ipv6.c:447:18: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant]
unsigned short raw[ip6size];
^... not sure what to do with that one yet.
Thomas
Quoted 45 lines · Thomas Huth
Quoted 14 lines · Cornelia Huck
Quoted 10 lines · On Tue, 25 May 2021 16:20:32 +0200 Thomas Huth <[email protected]> wrote:
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions
unexpectedly, we block those old compilers now via a test in the configure
script. Note that for some weird reasons, the Clang compiler only complains
about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "compile_object" instead of "compile_prog" for this check.Quoted 1 line
Ugh.
It's maybe better to use
compile_objectfor testing -msoft-float anyway since it could influence the way of linking against libraries (if I get
https://reviews.llvm.org/D72189 right).Quoted 6 lines
Quoted 6 lines
Signed-off-by Thomas Huth <[email protected]>---
configure | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
Quoted 11 lines
configure +0
-0@@ -5462,7 +5462,7 @@ if test "$cpu" = "s390x" ; then
write_c_skeleton
compile_prog"-march=z900" ""
has_z900=$?- if [ $has_z900 = 0 ] || compile_prog "-march=z10" ""; then + if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float-Werror"; then
Do you believe that we should have caught the various clang specialties now?
Apart from one compiler warning that just popped up today, yes. I'm seeing this compiler warning with Clang 12.0 now:
Quoted 6 lines
roms/SLOF/lib/libnet/ipv6.c:447:18: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] unsigned short raw[ip6size];
^... not sure what to do with that one yet.
Fix it? =)
Same class as:
https://gitlab.freedesktop.org/slirp/libslirp/-/commit/6690d55626cc
-- >8 --
lib/libnet/ipv6.c +0 -0
@@ -441,10 +441,9 @@ static unsigned short ip6_checksum(struct ip6hdr
*ip6h, unsigned char *packet,
{
int i;
unsigned long checksum;
- const int ip6size = sizeof(struct ip6hdr)/sizeof(unsigned short);
union {
struct ip6hdr ip6h;
- unsigned short raw[ip6size];
+ unsigned short raw[sizeof(struct ip6hdr) /
sizeof(unsigned short)];
} pseudo;
memcpy (&pseudo.ip6h, ip6h, sizeof(struct ip6hdr));
@@ -455,7 +454,7 @@ static unsigned short ip6_checksum(struct ip6hdr
*ip6h, unsigned char *packet,
for (checksum = 0, i = 0; i < bytes; i += 2)
checksum += (packet[i] << 8) | packet[i + 1];- for (i = 0; i < ip6size; i++)
+ for (i = 0; i < sizeof(pseudo.raw); i++)
checksum += pseudo.raw[i];
checksum = (checksum >> 16) + (checksum & 0xffff);---
Do you want me to send the fix since I have it ready?
Quoted 46 lines · Philippe Mathieu-Daudé
Quoted 45 lines · Thomas Huth
Quoted 14 lines · Cornelia Huck
Quoted 10 lines · On Tue, 25 May 2021 16:20:32 +0200 Thomas Huth <[email protected]> wrote:
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions
unexpectedly, we block those old compilers now via a test in the configure
script. Note that for some weird reasons, the Clang compiler only complains
about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "compile_object" instead of "compile_prog" for this check.Quoted 1 line
Ugh.
It's maybe better to use
compile_objectfor testing -msoft-float anyway since it could influence the way of linking against libraries (if I get
https://reviews.llvm.org/D72189 right).Quoted 6 lines
Quoted 6 lines
Signed-off-by Thomas Huth <[email protected]>---
configure | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
Quoted 11 lines
configure +0
-0@@ -5462,7 +5462,7 @@ if test "$cpu" = "s390x" ; then
write_c_skeleton
compile_prog"-march=z900" ""
has_z900=$?- if [ $has_z900 = 0 ] || compile_prog "-march=z10" ""; then + if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float-Werror"; then
Do you believe that we should have caught the various clang specialties now?
Apart from one compiler warning that just popped up today, yes. I'm seeing this compiler warning with Clang 12.0 now:
Quoted 6 lines
Quoted 6 lines
roms/SLOF/lib/libnet/ipv6.c:447:18: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] unsigned short raw[ip6size];
^... not sure what to do with that one yet.
See Eric's explanation:
https://www.mail-archive.com/[email protected]/msg84461.html
Quoted 39 lines
Fix it? =)
Same class as:
https://gitlab.freedesktop.org/slirp/libslirp/-/commit/6690d55626cc-- >8 --
lib/libnet/ipv6.c +1
-2@@ -441,10 +441,9 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned char *packet, {int i;unsigned long checksum; -const int ip6size =sizeof (struct ip6hdr )/sizeof (unsigned short );union {struct ip6hdr ip6h; -unsigned short raw[ip6size]; +unsigned short raw[sizeof (struct ip6hdr ) /sizeof (unsigned short )]; } pseudo;memcpy (&pseudo.ip6h, ip6h, sizeof(struct ip6hdr));lib/libnet/ipv6.c +1
-1@@ -455,7 +454,7 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned char *packet, for (checksum = 0, i = 0; i < bytes; i += 2) checksum += (packet[i] <<8 ) | packet[i +1 ]; -for (i =0 ; i < ip6size; i++) +for (i =0 ; i <sizeof (pseudo.raw); i++) checksum += pseudo.raw[i];checksum = (checksum >> 16) + (checksum & 0xffff);---
Do you want me to send the fix since I have it ready?
Quoted 87 lines · Philippe Mathieu-Daudé
Quoted 45 lines · Thomas Huth
Quoted 14 lines · Cornelia Huck
Quoted 10 lines · On Tue, 25 May 2021 16:20:32 +0200 Thomas Huth <[email protected]> wrote:
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions
unexpectedly, we block those old compilers now via a test in the configure
script. Note that for some weird reasons, the Clang compiler only complains
about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "compile_object" instead of "compile_prog" for this check.Quoted 1 line
Ugh.
It's maybe better to use
compile_objectfor testing -msoft-float anyway since it could influence the way of linking against libraries (if I get
https://reviews.llvm.org/D72189 right).Quoted 6 lines
Quoted 6 lines
Signed-off-by Thomas Huth <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
configure if test "$cpu" = "s390x" ; then · line 5466
Quoted 11 lines
configure +1
-2@@ -5462,7 +5462,7 @@ if test "$cpu" = "s390x" ; then write_c_skeleton compile_prog "-march=z900" "" has_z900=$? - if [ $has_z900 = 0 ] || compile_prog "-march=z10" ""; then + if [ $has_z900 = 0 ] || compile_object "-march=z10 -msoft-float -Werror"; thenDo you believe that we should have caught the various clang specialties now?
Apart from one compiler warning that just popped up today, yes. I'm seeing this compiler warning with Clang 12.0 now:
Quoted 6 lines
roms/SLOF/lib/libnet/ipv6.c:447:18: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant]
unsigned short raw[ip6size];
^... not sure what to do with that one yet.
Fix it? =)
Same class as:
https://gitlab.freedesktop.org/slirp/libslirp/-/commit/6690d55626cc-- >8 --
lib/libnet/ipv6.c +1
-2@@ -441,10 +441,9 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned char *packet, {int i;unsigned long checksum; -const int ip6size =sizeof (struct ip6hdr )/sizeof (unsigned short );union {struct ip6hdr ip6h; -unsigned short raw[ip6size]; +unsigned short raw[sizeof (struct ip6hdr ) /sizeof (unsigned short )]; } pseudo;memcpy (&pseudo.ip6h, ip6h, sizeof(struct ip6hdr));lib/libnet/ipv6.c +1
-1@@ -455,7 +454,7 @@ static unsigned short ip6_checksum(struct ip6hdr *ip6h, unsigned char *packet, for (checksum = 0, i = 0; i < bytes; i += 2) checksum += (packet[i] <<8 ) | packet[i +1 ]; -for (i =0 ; i < ip6size; i++) +for (i =0 ; i <sizeof (pseudo.raw); i++) checksum += pseudo.raw[i];checksum = (checksum >> 16) + (checksum & 0xffff);
Quoted 3 lines
---
Do you want me to send the fix since I have it ready?
Yes, please!
Thanks,
Thomas
Cornelia Huck
AppliedQuoted 8 lines · Thomas Huth
The -msoft-float switch is not available in older versions of Clang. Since we rely on the compiler to not generate floating point instructions unexpectedly, we block those old compilers now via a test in the configure script. Note that for some weird reasons, the Clang compiler only complains about the missing soft-float support if no other flags are passed via "-Wl,..." to the linker. So we have to use "
compile_object" instead of "compile_prog" for this check.
Quoted 4 lines
Signed-off-by Thomas Huth <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied.