On Wed, Jun 14, 2017 at 1:01 AM, Richard Biener <rguent...@suse.de> wrote:
>
> The following patch makes sure we build the 32bit multilib libgcov with
> large file support on x86_64-linux.  libgcov.h ends up using auto-host.h
> via including tconfig.h which is only valid for the main multilib
> (and on x86_64 doesn't need explicit large-file support defines).  That
> libgcc ends up using that is probably from times where it wasn't at
> the toplevel, some files already include auto-target.h generated by
> libgcc configure but most do so after including tsystem.h which is
> of course too late.  I suppose libgcc files shouldn't include tconfig.h
> from gcc/, but that's a change going to far for this bug ;)
>
> Thus, this makes libgcov.h include auto-target.h (but in the correct
> position) plus adds AC_SYS_LARGEFILE to libgccs configure.
>
> With that I properly end up with 32bit libgcov.a using fopen64 and open64
> as fopen/open seem to fail for some filesystems and inode numbers that
> do not fit 32bits even if the files in question are not large.  Failure
> mode is:
>
> int main(void) {
>         return 0;
> }
>
> niffler:/home/mue/src # gcc -m32 --coverage -o t testit.c
> niffler:/home/mue/src # ./t
> profiling:/home/mue/src/testit.gcda:Cannot open
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk and
> branches after a while?
>
> libgcov is the only libgcc module doing I/O.
>
> Other than libgcov libgomp, libcilkrts, libmpx and libstdc++
> are similarly affected (they use fopen on the 32bit multilib)
> but not fixed.  libubsan, libasan, libssp, libbacktrace and libgfortran
> use open.  While libgfortran configury has AC_SYS_LARGEFILE, the
> open use leaks in through libbacktrace (ubsan/asan might have the
> same issue, didn't investigate).  libbacktrace lacks AC_SYS_LARGEFILE.
>
> Thanks,
> Richard.
>
> 2017-06-14  Richard Biener  <rguent...@suse.de>
>
>         PR gcov-profile/81080
>         * configure.ac: Add AC_SYS_LARGEFILE.
>         * libgcov.h: Include auto-target.h before tsystem.h to pick
>         up _FILE_OFFSET_BITS which might differ for multilibs.
>         * config.in: Regenerate.
>         * configure: Likewise.


This is OK.

Thanks.

Ian

Reply via email to