This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v5 00/14] port C-SKY to glibc


On Mon, 19 Nov 2018, Mao Han wrote:

> I've replace ctri.S crtn.S with init-array in this patch.
> Thanks Palmer for giving some background information about this change.
> But I still got some trouble with this. GCC seems can not detect whether
> glibc use init-array or not, and default to not use init-array. 
> Option --enable-initfini-array is needed while configuring gcc, otherwise
> some init function won't be called.

The correct thing to do there is to fix the GCC configure test so you 
don't need --enable-initfini-array in build-many-glibcs.py.

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.)

> Another issue is Linux kernel have remove stat64 family from default 
> syscall set, and C-SKY dont' define __ARCH_WANT_STAT64. The generic
> version seems can't work without stat64. So I added fxstat, fxstatat, 
> lxstat, xstat implemented with statx for C-SKY.

I am supposing this is the preferred default for all future architectures 
added to the Linux kernel - they won't have the stat64 syscalls because 
the relevant functions are supposed to be implemented in userspace using 
statx instead.

If so, the implementations in terms of statx do not belong in a csky 
sysdeps directory.  Rather, all the 
sysdeps/unix/sysv/linux/generic/wordsize-32/ implementations should gain 
appropriate conditionals, so that if __NR_<whatever-old-syscall> is 
defined they follow the existing logic, and if it's not defined they 
follow the logic to use statx instead.

(If we get new 64-bit architectures in the kernel and glibc in the future, 
further implementations in sysdeps/unix/sysv/linux/ and 
sysdeps/unix/sysv/linux/generic/ will also need such conditionals.  
However, it would be hard to test such changes at present, and I think the 
wordsize-32 files cover all that you need for this architecture.)

Note that statx_cp.c would similarly be a generic file with an appropriate 
non-architecture-specific Makefile causing it to be built, and with its 
contents conditioned out in the case where the old syscalls exist.  Note 
also that there should be a corresponding header - it's a bad idea to 
duplicate an extern declaration of __cp_stat_statx (which should be 
declared as hidden) in lots of separate .c files.

>   - remove support for big endian

I'd expect an explicit error somewhere (either header #error of in the 
preconfigure script) for an attempt to build for big endian.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]