[PATCH v5 00/14] port C-SKY to glibc
Mao Han
han_mao@c-sky.com
Mon Nov 26 13:25:00 GMT 2018
On Mon, Nov 19, 2018 at 04:45:09PM +0000, Joseph Myers wrote:
> As far as I can tell, in the current version of the gcc_AC_INITFINI_ARRAY
> test, the only part that's an execution test is the ia64 case. That is,
> for every other target, the 'if test "x${build}" = "x${target}" && test
> "x${build}" = "x${host}"' condition is bogus as the rest of the tests
> would work just as well for cross compilation. (In the ia64 case, the
> fourth argument to AC_RUN_IFELSE - the action if cross compiling - is
> already there. So simply removing the requirement for build = host =
> target should allow things to work for cross compiling as well as for
> native except on ia64, and someone using ia64 could always fix that case
> later to have better cross compilation defaults based on the target OS.)
>
We'v tried to remove this condition, but seems doesn't meet our expectation.
The ia64 case seems only get a test need to run on the target, return -1 when
init_array is not support. I didn't found any AC_RUN_IFELSE in current gcc 9.0
gcc/configure. The *) case seems can return gcc_cv_initfini_array=yes
on C-SKY target, but it only check whether tools can generate init_array
section, not libc use init_array or not.
On Fri, Nov 23, 2018 at 05:11:35PM +0000, Joseph Myers wrote:
> Since the way in which those platforms avoid using the files in question
> is through having their own sysdeps override files that either contain
> just comments or reimplement the functions in question, my suggestion
> would be to have statx_cp.c files in sysdeps/unix/sysv/linux/wordsize-64
> and sysdeps/unix/sysv/linux/mips/mips64, containing just a comment. Then
> the conditional in the main statx_cp.c file would be
Thanks for suggestion.
I'v tried to add statx_cp.c under sysdeps/unix/sysv/linux/mips/mips64, and
something got wrong while glibc is configured for mips:
PASS: compilers-mips64-linux-gnu-soft glibc mips64-linux-gnu-n64-soft copy
*** Error in `/home/vmh/disk2/buildmany/install/compilers/mips64-linux-gnu-soft/lib/gcc/mips64-glibc-linux-gnu/9.0.0/../../../../mips64-glibc-linux-gnu/bin/ld': free(): invalid next size (fast): 0x000000000250c100 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f45a2d417e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f45a2d4a37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f45a2d4e53c]
/home/vmh/disk2/buildmany/install/compilers/mips64-linux-gnu-soft/lib/gcc/mips64-glibc-linux-gnu/9.0.0/../../../../mips64-glibc-linux-gnu/bin/ld[0x4440c0]
/home/vmh/disk2/buildmany/install/compilers/mips64-linux-gnu-soft/lib/gcc/mips64-glibc-linux-gnu/9.0.0/../../../../mips64-glibc-linux-gnu/bin/ld[0x4926bf]
/home/vmh/disk2/buildmany/install/compilers/mips64-linux-gnu-soft/lib/gcc/mips64-glibc-linux-gnu/9.0.0/../../../../mips64-glibc-linux-gnu/bin/ld[0x467c22]
...
PASS: compilers-mips64-linux-gnu-nan2008-soft glibc mips64-linux-gnu-n64-nan2008-soft configure
The final result is PASS. I haven't found the rootcause yet.
> It's probably a bad idea to duplicate the logic for such overflow checks -
> rather, the existing stat_overflow code should be used. Maybe eliminate
> __cp_stat_statx, make the callers cast to (struct stat64 *) and call
> __cp_stat64_statx and then use stat_overflow in the callers? (As all the
> cases needing this check are in generic/wordsize-32, we know that the stat
> and stat64 layouts are the same, just differing in whether or not high
> parts are counted as padding. Because statx_cp.c is in a separate
> translation unit and glibc uses C with ABI boundaries, doing the cast in a
> caller like that is safe, whereas defining __cp_stat_statx to do such a
> cast, call and then check with stat_overflow, in the same translation unit
> as the __cp_stat64_statx definition, could run into aliasing issues.)
I used __cp_stat_statx in the last patch, the high part will cut off when
assign a 64bit variable to a 32bit one. The padding seems will never become
non-zero, so I didn't use stat_overflow in last patch. In order to return
whether st_ino, st_size, st_blocks are overflowed, the high part should
be keeped or some check is needed on statx result? So make the callers
cast to (struct stat64 *) and call __cp_stat64_statx will make the funcion
behavior exactly same as the old one?
Best Regards,
Mao Han
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-statx-conditionals-for-wordsize-32-xstat.c.patch
Type: text/x-diff
Size: 15739 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20181126/deeb06c1/attachment.bin>
More information about the Libc-alpha
mailing list