Re: [PATCH v7 11/13] ARC: Build Infrastructure

2020-07-03 Thread Adhemerval Zanella



On 15/06/2020 17:14, Vineet Gupta via Libc-alpha wrote:
> ---
>  config.h.in|   3 +
>  sysdeps/arc/Implies|   3 +
>  sysdeps/arc/Makefile   |  21 +++
>  sysdeps/arc/Versions   |   8 +
>  sysdeps/arc/configure  | 182 +
>  sysdeps/arc/configure.ac   |  26 +++
>  sysdeps/arc/nptl/Makefile  |  22 +++
>  sysdeps/arc/preconfigure   |  14 ++
>  sysdeps/unix/sysv/linux/arc/Implies|   3 +
>  sysdeps/unix/sysv/linux/arc/Makefile   |  29 
>  sysdeps/unix/sysv/linux/arc/Versions   |  16 ++
>  sysdeps/unix/sysv/linux/arc/configure  |   4 +
>  sysdeps/unix/sysv/linux/arc/configure.ac   |   4 +
>  sysdeps/unix/sysv/linux/arc/ldconfig.h |  27 +++
>  sysdeps/unix/sysv/linux/arc/shlib-versions |   7 +

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  


>  15 files changed, 369 insertions(+)
>  create mode 100644 sysdeps/arc/Implies
>  create mode 100644 sysdeps/arc/Makefile
>  create mode 100644 sysdeps/arc/Versions
>  create mode 100644 sysdeps/arc/configure
>  create mode 100644 sysdeps/arc/configure.ac
>  create mode 100644 sysdeps/arc/nptl/Makefile
>  create mode 100644 sysdeps/arc/preconfigure
>  create mode 100644 sysdeps/unix/sysv/linux/arc/Implies
>  create mode 100644 sysdeps/unix/sysv/linux/arc/Makefile
>  create mode 100644 sysdeps/unix/sysv/linux/arc/Versions
>  create mode 100644 sysdeps/unix/sysv/linux/arc/configure
>  create mode 100644 sysdeps/unix/sysv/linux/arc/configure.ac
>  create mode 100644 sysdeps/unix/sysv/linux/arc/ldconfig.h
>  create mode 100644 sysdeps/unix/sysv/linux/arc/shlib-versions
> 
> diff --git a/config.h.in b/config.h.in
> index 831eca2fe14e..2ed684b7d4e4 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -109,6 +109,9 @@
>  /* AArch64 big endian ABI */
>  #undef HAVE_AARCH64_BE
>  
> +/* ARC big endian ABI */
> +#undef HAVE_ARC_BE
> +
>  /* C-SKY ABI version.  */
>  #undef CSKYABI
>  

Ok.

> diff --git a/sysdeps/arc/Implies b/sysdeps/arc/Implies
> new file mode 100644
> index ..780c4e246769
> --- /dev/null
> +++ b/sysdeps/arc/Implies
> @@ -0,0 +1,3 @@
> +wordsize-32
> +ieee754/flt-32
> +ieee754/dbl-64

Ok.

> diff --git a/sysdeps/arc/Makefile b/sysdeps/arc/Makefile
> new file mode 100644
> index ..d5a702e29e58
> --- /dev/null
> +++ b/sysdeps/arc/Makefile
> @@ -0,0 +1,21 @@
> +# ARC Makefile
> +# Copyright (C) 2020 Free Software Foundation, Inc.
> +# This file is part of the GNU C Library.
> +
> +# The GNU C Library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU Lesser General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +
> +# The GNU C Library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with the GNU C Library.  If not, see
> +# .
> +
> +# We don't support long doubles as a distinct type.  We don't need to set
> +# this variable; it's here mostly for documentational purposes.
> +long-double-fcts = no

Ok.

> diff --git a/sysdeps/arc/Versions b/sysdeps/arc/Versions
> new file mode 100644
> index ..6ac7b8e49505
> --- /dev/null
> +++ b/sysdeps/arc/Versions
> @@ -0,0 +1,8 @@
> +libc {
> +  GLIBC_2.32 {
> +__mcount;
> +  }
> +  GLIBC_PRIVATE {
> +__syscall_error;
> +  }
> +}

Ok.

> diff --git a/sysdeps/arc/configure b/sysdeps/arc/configure
> new file mode 100644
> index ..bce7d3c3773d
> --- /dev/null
> +++ b/sysdeps/arc/configure
> @@ -0,0 +1,182 @@
> +# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
> + # Local configure fragment for sysdeps/arc.
> +
> +$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> +
> +libc_cv_have_sdata_section=no
> +
> +# For ARC, historically ; was used for comments and not newline
> +# Later # also got added to comment list, but ; couldn't be switched to
> +# canonical newline as there's lots of code out there which will break
> +libc_cv_asm_line_sep='`'
> +cat >>confdefs.h <<_ACEOF
> +#define ASM_LINE_SEP $libc_cv_asm_line_sep
> +_ACEOF
> +
> +
> +# For big endian ABI, generate a symbol for selecting right dynamic linker
> +
> +
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long 
> lines and -e" >&5
> +$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
> +if ${ac_cv_path_GREP+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$GREP"; then
> +  ac_path_GREP_found=false
> +  # Loop through the user's path and test for each of PROGNAME-L

Re: [PATCH v7 12/13] build-many-glibcs.py: Enable ARC builds

2020-07-03 Thread Adhemerval Zanella



On 15/06/2020 17:14, Vineet Gupta via Libc-alpha wrote:
> ---
>  scripts/build-many-glibcs.py | 10 ++
>  1 file changed, 10 insertions(+)

LGTM, thanks.

Reviewed-by: Adhemerval Zanella 

> 
> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index 6c6615b200d9..64f5713530bd 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -162,6 +162,15 @@ class Context(object):
> 'cfg': ['--disable-multi-arch']}])
>  self.add_config(arch='aarch64_be',
>  os_name='linux-gnu')
> +self.add_config(arch='arc',
> +os_name='linux-gnu',
> +gcc_cfg=['--disable-multilib', '--with-cpu=hs38'])
> +self.add_config(arch='arc',
> +os_name='linux-gnuhf',
> +gcc_cfg=['--disable-multilib', 
> '--with-cpu=hs38_linux'])
> +self.add_config(arch='arceb',
> +os_name='linux-gnu',
> +gcc_cfg=['--disable-multilib', '--with-cpu=hs38'])
>  self.add_config(arch='alpha',
>  os_name='linux-gnu')
>  self.add_config(arch='arm',
> @@ -1224,6 +1233,7 @@ def install_linux_headers(policy, cmdlist):
>  """Install Linux kernel headers."""
>  arch_map = {'aarch64': 'arm64',
>  'alpha': 'alpha',
> +'arc': 'arc',
>  'arm': 'arm',
>  'csky': 'csky',
>  'hppa': 'parisc',
> 

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v7 13/13] Documentation for ARC port

2020-07-03 Thread Adhemerval Zanella



On 15/06/2020 17:14, Vineet Gupta via Libc-alpha wrote:
> ---
>  NEWS| 11 +++
>  README  |  1 +
>  manual/install.texi |  4 

LGTM, thanks.

Reviewed-by: Adhemerval Zanella 

>  3 files changed, 16 insertions(+)
> 
> diff --git a/NEWS b/NEWS
> index a660fc59a89e..db65fea8b6ec 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -15,6 +15,17 @@ Major new features:
>  
>  * New locale added: ckb_IQ (Kurdish/Sorani spoken in Iraq)
>  
> +* Support for Synopsys ARC HS cores (ARCv2 ISA) running Linux has been
> +  added. This port requires at least binutils-2.32, gcc-8.3 and Linux-5.1.
> +  Three ABIs are supported:
> +
> + - arc-linux-gnu
> + - arc-linux-gnuhf
> + - arceb-linux-gnu
> +
> +  The arc* ABI is little-endian while arceb is big-endian. All ABIs use
> +  64-bit time (y2038 safe) and 64-bit file offsets (LFS default).
> +
>  * The GNU C Library now loads audit modules listed in the DT_AUDIT and
>DT_DEPAUDIT dynamic section entries of the main executable.
>  

Ok.

> diff --git a/README b/README
> index 31c5da0405bd..903f07e4840a 100644
> --- a/README
> +++ b/README
> @@ -24,6 +24,7 @@ The GNU C Library supports these configurations for using 
> Linux kernels:
>  
>   aarch64*-*-linux-gnu
>   alpha*-*-linux-gnu
> + arc*-*-linux-gnu
>   arm-*-linux-gnueabi
>   csky-*-linux-gnuabiv2
>   hppa-*-linux-gnu

Ok.

> diff --git a/manual/install.texi b/manual/install.texi
> index c1e49a94fed3..74cb90a91331 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -522,6 +522,8 @@ Library with support for IEEE long double.
>  @c powerpc64le performs an autoconf test to verify the compiler compiles with
>  @c commands like "$CC -c foo.c -mabi=ibmlongdouble -mlong-double-128".
>  
> +For ARC architecture builds, GCC 8.3 or higher is needed.
> +
>  For multi-arch support it is recommended to use a GCC which has been built 
> with
>  support for GNU indirect functions.  This ensures that correct debugging
>  information is generated for functions selected by IFUNC resolvers.  This
> @@ -547,6 +549,8 @@ For PowerPC 64-bits little-endian (powerpc64le), 
> @command{objcopy} is required
>  to support @option{--update-section}.  This option requires binutils 2.26 or
>  newer.
>  
> +ARC architecture needs @code{binutils} 2.32 or higher for TLS related fixes.
> +
>  @item
>  GNU @code{texinfo} 4.7 or later
>  
> 

Ok.

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v7.1 07/13] ARC: Linux Syscall Interface

2020-07-03 Thread Vineet Gupta
On 7/2/20 7:47 PM, Adhemerval Zanella via Libc-alpha wrote:
> 
> 
> On 30/06/2020 21:08, Vineet Gupta via Libc-alpha wrote:
>> ---
>>Changes since v7:
>>  - used long int (iso int) in sysdep.h/syscall_error for handling 
>> registers
> 
> Patch looks ok, but I have question on the __NR_* undef/define. 
> 

>> diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h 
>> b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
...
>> +#define __NR_write 64
>> +#define __NR_writev 66
> 
> Looks good. As side note I think an improvement would be to add
> an annotation on update-syscall-lists.py to specify which kernel
> version it used.

Very good idea indeed. I've asked myself the very question atleast once.


>> diff --git a/sysdeps/unix/sysv/linux/arc/clone.S 
>> b/sysdeps/unix/sysv/linux/arc/clone.S
..
>> +
>> +; adjust libc args for syscall
> 
> Use the C comment style for constency with rest of the file.

Done.

>> diff --git a/sysdeps/unix/sysv/linux/arc/fixup-asm-unistd.h 
>> b/sysdeps/unix/sysv/linux/arc/fixup-asm-unistd.h

>> +
>> +/* Adjustments to ARC asm-generic syscall ABI (3.9 kernel) for 64-bit time_t
>> +   support.  */
>> +
>> +/* fstat64 and fstatat64 need to be replaced with statx.  */
>> +
>> +#undef __NR_fstat64
>> +#undef __NR_fstatat64

This is certainly needed as they are present in ARC arch-syscall.h but we need 
to
use statx.

>> +/* Replace all other 32-bit time syscalls with 64-bit variants.  */
>> +
>> +# undef __NR_clock_adjtime
>> +# undef __NR_clock_getres
>> +# undef __NR_futex
>> +# undef __NR_mq_timedreceive
>> +# undef __NR_mq_timedsend
>> +# undef __NR_ppoll
>> +# undef __NR_pselect6
>> +# undef __NR_recvmmsg
>> +# undef __NR_rt_sigtimedwait
>> +# undef __NR_sched_rr_get_interval
>> +# undef __NR_semtimedop
>> +# undef __NR_timerfd_settime
>> +# undef __NR_timerfd_gettime
>> +# undef __NR_utimensat
> 
> I am trying to understand why these are required since arc does not define 
> them in arch-syscall.h.

arch-syscall.h doesn't define them precisely due to these being here. When
update-syscalls is run, the 32-bit syscalls are generated for ARC (since kernel
ABI provides these because that was v3.9 circa 2013). Adding them
fixup-asm-unistd.h removes them (perhaps I need to add this in changelog to
clarify - atleast for myself).

> And the generic implementation should handle the time64 variant.  If they
> are not this is something we need to handle it.

At the time we we doing this, arch-syscall.h generation was not yet in place,
however I tried to undef in generic/sysdep.h for TIMESIZE==64. However I was 
asked
me to add this to ARC specific fixup-asm-unistd.h
https://sourceware.org/pipermail/libc-alpha/2020-March/112395.html
https://sourceware.org/pipermail/libc-alpha/2020-April/112909.html

>> diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h 
>> b/sysdeps/unix/sysv/linux/arc/kernel_stat.h
...
>> +#define STATFS_IS_STATFS64 0
> 
> Ok.

This specific one is actually dead code. I did post a patch to this effect and
followed up with supporting data that enabling it on 64-bit arches doesn't lead 
to
any changes in generated code.

https://sourceware.org/pipermail/libc-alpha/2020-February/111259.html
https://sourceware.org/pipermail/libc-alpha/2020-June/115217.html


>> diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h 
>> b/sysdeps/unix/sysv/linux/arc/sysdep.h

...

>> +/* 32-bit time syscalls are not available, but the redefines allow generic
>> +   wrappers to work.  */
>> +#define __NR_clock_adjtime  __NR_clock_adjtime64
>> +#define __NR_clock_getres   __NR_clock_getres_time64
>> +#define __NR_futex  __NR_futex_time64
>> +#define __NR_mq_timedreceive__NR_mq_timedreceive_time64
>> +#define __NR_mq_timedsend   __NR_mq_timedsend_time64
>> +#define __NR_ppoll  __NR_ppoll_time64
>> +#define __NR_pselect6   __NR_pselect6_time64
>> +#define __NR_recvmmsg   __NR_recvmmsg_time64
>> +#define __NR_rt_sigtimedwait__NR_rt_sigtimedwait_time64
>> +#define __NR_sched_rr_get_interval  __NR_sched_rr_get_interval_time64
>> +#define __NR_semtimedop __NR_semtimedop_time64
>> +#define __NR_timerfd_gettime__NR_timerfd_gettime64
>> +#define __NR_timerfd_settime__NR_timerfd_settime64
>> +#define __NR_utimensat  __NR_utimensat_time64
> 
> As for the fixup-asm-unistd.h, the generic implementation should handle it
> without the requirement of the ABI to add such tricks.

fixup-asm-unistd.h is different, but this could be avoided. I know for sure that
ll code literally expects __NR_futex (atleast used to). But I can remove this 
and
see what comes out.

> 
> However it seems that we are still missing support for pselect 
> (__NR_pselect6_time64), recvmmsg (__NR_recvmmsg_time64), sigtimedwait 
> (__NR_rt_sigtimedwait_time64), and semtimeop (__NR_semtimedop_time64).
> 
> I think we can add the redefine hack only the aforementioned symbols for
> now and removed them once we implement the y2038 support on s