zdtm: fix building uptime_grow.c on s390

Submitted by Adrian Reber on July 19, 2017, 1:40 p.m.

Details

Message ID 1500471636-11454-1-git-send-email-adrian@lisas.de
State New
Series "zdtm: fix building uptime_grow.c on s390"
Headers show

Commit Message

Adrian Reber July 19, 2017, 1:40 p.m.
From: Adrian Reber <areber@redhat.com>

Building the uptime_grow test case fails on s390 with:

uptime_grow.o: In function `main':
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3'

Include math.h fixes it.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 test/zdtm/static/uptime_grow.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/static/uptime_grow.c b/test/zdtm/static/uptime_grow.c
index 6d99509..87ae765 100644
--- a/test/zdtm/static/uptime_grow.c
+++ b/test/zdtm/static/uptime_grow.c
@@ -5,6 +5,7 @@  const char *test_author = "Evgeny Antysev <eantyshev@parallels.com>";
 
 #include <time.h>
 #include <stdlib.h>
+#include <math.h>
 
 # define tv_ge(a, b) \
   (((a)->tv_sec == (b)->tv_sec) ? \

Comments

Michael Holzheu July 19, 2017, 5:04 p.m.
Am Wed, 19 Jul 2017 13:40:36 +0000
schrieb Adrian Reber <adrian@lisas.de>:

> From: Adrian Reber <areber@redhat.com>
> 
> Building the uptime_grow test case fails on s390 with:
> 
> uptime_grow.o: In function `main':
> /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
> /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3'

These look like soft-float symbols. Normally you should not need to
include <math.h> in this case.

Could you please send the V=1 compile output?

Michael

> 
> Include math.h fixes it.
> 
> Signed-off-by: Adrian Reber <areber@redhat.com>
> ---
>  test/zdtm/static/uptime_grow.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/test/zdtm/static/uptime_grow.c b/test/zdtm/static/uptime_grow.c
> index 6d99509..87ae765 100644
> --- a/test/zdtm/static/uptime_grow.c
> +++ b/test/zdtm/static/uptime_grow.c
> @@ -5,6 +5,7 @@ const char *test_author = "Evgeny Antysev <eantyshev@parallels.com>";
> 
>  #include <time.h>
>  #include <stdlib.h>
> +#include <math.h>
> 
>  # define tv_ge(a, b) \
>    (((a)->tv_sec == (b)->tv_sec) ? \
Adrian Reber July 19, 2017, 7:08 p.m.
On Wed, Jul 19, 2017 at 07:04:16PM +0200, Michael Holzheu wrote:
> Am Wed, 19 Jul 2017 13:40:36 +0000
> schrieb Adrian Reber <adrian@lisas.de>:
> 
> > From: Adrian Reber <areber@redhat.com>
> > 
> > Building the uptime_grow test case fails on s390 with:
> > 
> > uptime_grow.o: In function `main':
> > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
> > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3'
> 
> These look like soft-float symbols. Normally you should not need to
> include <math.h> in this case.
> 
> Could you please send the V=1 compile output?

gcc -O2 -g  -Wall -Wformat-security -Werror -DCONFIG_S390 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_SELINUX -iquote include/ -DCONFIG_HAS_SELINUX -msoft-float -fno-optimize-sibling-calls -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -MM -MP -o uptime_grow.d uptime_grow.c
gcc -O2 -g  -Wall -Wformat-security -Werror -DCONFIG_S390 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_SELINUX -iquote include/ -DCONFIG_HAS_SELINUX -msoft-float -fno-optimize-sibling-calls -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -o uptime_grow.o uptime_grow.c
gcc  uptime_grow.o ../lib/libzdtmtst.a ../lib/libzdtmtst.a -lrt -pthread -o uptime_grow
uptime_grow.o: In function `main':
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
/tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3'
collect2: error: ld returned 1 exit status
make[2]: *** [uptime_grow] Error 1

		Adrian
Michael Holzheu July 20, 2017, 4:13 p.m.
Am Wed, 19 Jul 2017 21:08:02 +0200
schrieb Adrian Reber <areber@redhat.com>:

> On Wed, Jul 19, 2017 at 07:04:16PM +0200, Michael Holzheu wrote:
> > Am Wed, 19 Jul 2017 13:40:36 +0000
> > schrieb Adrian Reber <adrian@lisas.de>:
> > 
> > > From: Adrian Reber <areber@redhat.com>
> > > 
> > > Building the uptime_grow test case fails on s390 with:
> > > 
> > > uptime_grow.o: In function `main':
> > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
> > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3'
> > 
> > These look like soft-float symbols. Normally you should not need to
> > include <math.h> in this case.
> > 
> > Could you please send the V=1 compile output?
> 
> gcc -O2 -g  -Wall -Wformat-security -Werror -DCONFIG_S390 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_SELINUX -iquote include/ -DCONFIG_HAS_SELINUX -msoft-float -fno-optimize-sibling-calls -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -MM -MP -o uptime_grow.d uptime_grow.c
> gcc -O2 -g  -Wall -Wformat-security -Werror -DCONFIG_S390 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_SELINUX -iquote include/ -DCONFIG_HAS_SELINUX -msoft-float -fno-optimize-sibling-calls -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -o uptime_grow.o uptime_grow.c

The testsuite should *not* be compiled with the "-msoft-float" option.

When I do "make V=1 -C test/zdtm" on the current "criu-dev" branch I get the following:

# gcc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -o uptime_grow.o uptime_grow.c

So no "-msoft-float" ...

The question is: What is different on your system?

Michael
Adrian Reber July 20, 2017, 4:42 p.m.
On Thu, Jul 20, 2017 at 06:13:02PM +0200, Michael Holzheu wrote:
> Am Wed, 19 Jul 2017 21:08:02 +0200
> schrieb Adrian Reber <areber@redhat.com>:
> 
> > On Wed, Jul 19, 2017 at 07:04:16PM +0200, Michael Holzheu wrote:
> > > Am Wed, 19 Jul 2017 13:40:36 +0000
> > > schrieb Adrian Reber <adrian@lisas.de>:
> > > 
> > > > From: Adrian Reber <areber@redhat.com>
> > > > 
> > > > Building the uptime_grow test case fails on s390 with:
> > > > 
> > > > uptime_grow.o: In function `main':
> > > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> > > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__muldf3'
> > > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__floatdidf'
> > > > /tmp/2/criu/test/zdtm/static/uptime_grow.c:36: undefined reference to `__adddf3'
> > > 
> > > These look like soft-float symbols. Normally you should not need to
> > > include <math.h> in this case.
> > > 
> > > Could you please send the V=1 compile output?
> > 
> > gcc -O2 -g  -Wall -Wformat-security -Werror -DCONFIG_S390 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_SELINUX -iquote include/ -DCONFIG_HAS_SELINUX -msoft-float -fno-optimize-sibling-calls -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -MM -MP -o uptime_grow.d uptime_grow.c
> > gcc -O2 -g  -Wall -Wformat-security -Werror -DCONFIG_S390 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DCONFIG_HAS_SELINUX -iquote include/ -DCONFIG_HAS_SELINUX -msoft-float -fno-optimize-sibling-calls -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -o uptime_grow.o uptime_grow.c
> 
> The testsuite should *not* be compiled with the "-msoft-float" option.
> 
> When I do "make V=1 -C test/zdtm" on the current "criu-dev" branch I get the following:
> 
> # gcc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -o uptime_grow.o uptime_grow.c
> 
> So no "-msoft-float" ...
> 
> The question is: What is different on your system?

So, this one is a bit strange. If I checkout criu-dev and run make and
make zdtm (to just build all test cases) I get the error above.

If I do make; cd test; ./zdtm.py run -t zdtm/static/uptime_grow
I see

 CC        uptime_grow.o
 LINK      uptime_grow

No errors, it just builds and works. So building test cases from the top
level directory is different than build test cases from the test
directory:

# make -C zdtm/static/ uptime_grow V=1
make: Entering directory `/tmp/2/criu/test/zdtm/static'
make -C ../lib
make[1]: Entering directory `/tmp/2/criu/test/zdtm/lib'
make[1]: Leaving directory `/tmp/2/criu/test/zdtm/lib'
gcc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0  -D_GNU_SOURCE -I../lib -iquote ../lib/arch/s390/include  -c -o uptime_grow.o uptime_grow.c
gcc  uptime_grow.o ../lib/libzdtmtst.a ../lib/libzdtmtst.a -lrt -pthread -o uptime_grow
make: Leaving directory `/tmp/2/criu/test/zdtm/static'


And my patch does not actually work. To test it I just rebuild the test
case from the test directory and that works with and without the <math.h>
include.

So the patch is wrong and unnecessary and the buildsystem needs a fix.

		Adrian