Discussion:
glibc build with gcov support
Tatiana Udalova
2013-11-19 06:54:37 UTC
Permalink
Hi!

Could you advise the right way to build Glibc2.17 with gcov coverage testing
support?

I couldn't find any working solution on how to do it.

I was trying to add extra CFLAGS="--coverage" (or CFLAGS="-fprofile-arcs
-ftest-coverage") for glibc configuration and build.
The following configuration error occur:
./configure --prefix=/usr --host=arm-none-linux-gnueabi
--enable-add-ons=ports,nptl --without-fp ...
checking whether to put _rtld_local into .sdata section... no checking for
.preinit_array/.init_array/.fini_array support... no
configure: error: Need linker with .init_array/.fini_array support.

Hence I can successfully build Glibc without mentioned CFLAGS.

The second solution I've tried was configuring Glibc without extra CFLAGS
and adding these CFLAGS on make stage only.
Make stage failed with the following error:

arm-none-linux-gnueabi-gcc -nostdlib -nostartfiles -r -o
/home/t.udalova/glibc-build/elf/librtld.map.o '-Wl,-('
/home/t.udalova/glibc-build/elf/dl-allobjs.os
/home/t.udalova/glibc-build/libc_pic.a -lgcc '-Wl,-)'
-Wl,-Map,/home/t.udalova/glibc-build/elf/librtld.mapT
/home/t.udalova/glibc-build/libc_pic.a(dl-addr.os): In function
`_GLOBAL__sub_I_65535_0_dl_addr.c':
/home/t.udalova/sources/glibc/libc/elf/dl-addr.c:155: multiple definition of
`_dl_addr_inside_object'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/fox-p/vd47_a15
/toolchain/build/sources/glibc/libc/elf/dl-open.c:755: first defined here
/home/t.udalova/glibc-build/libc_pic.a(init-first.os):(.data+0x0): multiple
definition of `__libc_multiple_libcs'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/fox-p/vd47_a15
/toolchain/build/sources/glibc/libc/elf/rtld.c:2160: first defined here
/home/t.udalova/glibc-build/libc_pic.a(_itoa.os): In function `_itoa':
/home/t.udalova/sources/glibc/libc/stdio-common/_itoa.c:199: multiple
definition of `_itoa'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/sources/glibc/
libc/elf/dl-minimal.c:317: first defined here
collect2: error: ld returned 1 exit status

There are no --enable-coverage or --enable-gcov options for Glibc
configuration.

Tatiana
Ondřej Bílka
2013-11-19 08:08:08 UTC
Permalink
Post by Tatiana Udalova
Hi!
Could you advise the right way to build Glibc2.17 with gcov coverage testing
support?
How do you plan to use gcov? Does oprofile not suffice?
Post by Tatiana Udalova
I couldn't find any working solution on how to do it.
I was trying to add extra CFLAGS="--coverage" (or CFLAGS="-fprofile-arcs
-ftest-coverage") for glibc configuration and build.
./configure --prefix=/usr --host=arm-none-linux-gnueabi
--enable-add-ons=ports,nptl --without-fp ...
checking whether to put _rtld_local into .sdata section... no checking for
.preinit_array/.init_array/.fini_array support... no
configure: error: Need linker with .init_array/.fini_array support.
Hence I can successfully build Glibc without mentioned CFLAGS.
The second solution I've tried was configuring Glibc without extra CFLAGS
and adding these CFLAGS on make stage only.
arm-none-linux-gnueabi-gcc -nostdlib -nostartfiles -r -o
/home/t.udalova/glibc-build/elf/librtld.map.o '-Wl,-('
/home/t.udalova/glibc-build/elf/dl-allobjs.os
/home/t.udalova/glibc-build/libc_pic.a -lgcc '-Wl,-)'
-Wl,-Map,/home/t.udalova/glibc-build/elf/librtld.mapT
/home/t.udalova/glibc-build/libc_pic.a(dl-addr.os): In function
/home/t.udalova/sources/glibc/libc/elf/dl-addr.c:155: multiple definition of
`_dl_addr_inside_object'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/fox-p/vd47_a15
/toolchain/build/sources/glibc/libc/elf/dl-open.c:755: first defined here
/home/t.udalova/glibc-build/libc_pic.a(init-first.os):(.data+0x0): multiple
definition of `__libc_multiple_libcs'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/fox-p/vd47_a15
/toolchain/build/sources/glibc/libc/elf/rtld.c:2160: first defined here
/home/t.udalova/sources/glibc/libc/stdio-common/_itoa.c:199: multiple
definition of `_itoa'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/sources/glibc/
libc/elf/dl-minimal.c:317: first defined here
collect2: error: ld returned 1 exit status
There are no --enable-coverage or --enable-gcov options for Glibc
configuration.
Tatiana
Tatiana Udalova
2013-11-19 08:55:04 UTC
Permalink
I wanna check Glibc test coverage to be able to find untested functions.

As far as I understand oprofile isn't suitable for it:
It'll give me information about running code only.

Tatiana

-----Original Message-----
From: Ondřej Bílka [mailto:neleai-***@public.gmane.org]
Sent: Tuesday, November 19, 2013 12:08 PM
To: Tatiana Udalova
Cc: libc-help-9JcytcrH/bA+***@public.gmane.org; 'Slava Garbuzov'; 'Evgeny Gavrin'
Subject: Re: glibc build with gcov support
Post by Tatiana Udalova
Hi!
Could you advise the right way to build Glibc2.17 with gcov coverage
testing support?
How do you plan to use gcov? Does oprofile not suffice?
Post by Tatiana Udalova
I couldn't find any working solution on how to do it.
I was trying to add extra CFLAGS="--coverage" (or
CFLAGS="-fprofile-arcs
-ftest-coverage") for glibc configuration and build.
./configure --prefix=/usr --host=arm-none-linux-gnueabi
--enable-add-ons=ports,nptl --without-fp ...
checking whether to put _rtld_local into .sdata section... no checking
for .preinit_array/.init_array/.fini_array support... no
configure: error: Need linker with .init_array/.fini_array support.
Hence I can successfully build Glibc without mentioned CFLAGS.
The second solution I've tried was configuring Glibc without extra
CFLAGS and adding these CFLAGS on make stage only.
arm-none-linux-gnueabi-gcc -nostdlib -nostartfiles -r -o
/home/t.udalova/glibc-build/elf/librtld.map.o '-Wl,-('
/home/t.udalova/glibc-build/elf/dl-allobjs.os
/home/t.udalova/glibc-build/libc_pic.a -lgcc '-Wl,-)'
-Wl,-Map,/home/t.udalova/glibc-build/elf/librtld.mapT
/home/t.udalova/glibc-build/libc_pic.a(dl-addr.os): In function
/home/t.udalova/sources/glibc/libc/elf/dl-addr.c:155: multiple
definition of `_dl_addr_inside_object'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/fox-p/vd
47_a15
/toolchain/build/sources/glibc/libc/elf/dl-open.c:755: first defined here
multiple definition of `__libc_multiple_libcs'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/fox-p/vd
47_a15
/toolchain/build/sources/glibc/libc/elf/rtld.c:2160: first defined here
/home/t.udalova/sources/glibc/libc/stdio-common/_itoa.c:199: multiple
definition of `_itoa'
/home/t.udalova/glibc-build/elf/dl-allobjs.os:/home/t.udalova/sources/
glibc/
libc/elf/dl-minimal.c:317: first defined here
collect2: error: ld returned 1 exit status
There are no --enable-coverage or --enable-gcov options for Glibc
configuration.
Tatiana
Carlos O'Donell
2013-11-19 20:24:39 UTC
Permalink
Post by Tatiana Udalova
I wanna check Glibc test coverage to be able to find untested functions.
It'll give me information about running code only.
It is currently not possible to build glibc with coverage support.
The circular dependencies from the code coverage system to the C
library make it impossible to compile glibc.

I would be happy to review patches to add support for building
glibc with code coverage (gcov support), but it would take some
effort to implement and is not a small weekend project.

The alternative as Ondrej suggests is to use oprofile. Using
oprofile is suitable for coverage measurement of glibc.

Your statement "It'll give me information about running code only"
is true for all coverage testing, both gcov and oprofile require
you run code in order to get coverage data. There is no other way
to determine if a code path is taken without running code and
analysing the resulting data (except for static analysis).

So you have two options:
* Implement gcov support for glibc.
* Use oprofile.

If you use oprofile I would be interested in seeing a published
report of how you used it and what kind of coverage you had?

I'm sure the community would be interested in maintaining
oprofile scripts to get coverage data on the project e.g.
Use oprofile in conjunction with the entire testsuite run
to gather coverage information.

Keep us updated.

Cheers,
Carlos.

Loading...