Re: [PATCH v2] ARC: update definitions in elf/elf.h

2022-11-21 Thread Adhemerval Zanella Netto



On 21/11/22 10:06, Shahab Vahedi via Libc-alpha wrote:
> While porting ARCv2 to elfutils [1], it was brought up that the
> necessary changes to the project's libelf/elf.h must come from
> glibc, because they sync it from glibc [2].  Therefore, this patch
> is to update ARC entries in elf/elf.h.
> 
> The majority of the update is about adding new definitions,
> specially for the relocations.  However, there is one rename, one
> deletion, and one change:
> 
> - R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
> - R_ARC_B26 removed because it is unused and deprecated.
> - R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.
> 
> [1]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html
> 
> [2]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html
> 
> Signed-off-by: Shahab Vahedi 

We discussed this briefly on glibc patchwork review meeting [1],
and if does not trigger any regression it ok to arch maintainers
to handle such changes.

[1] https://sourceware.org/glibc/wiki/PatchworkReviewMeetings

> ---
> Chagelog:
> v2:
>   - Rename instances of R_ARC_JUMP_SLOT to R_ARC_JMP_SLOT.
>   - Remove an unnecessary extra empty line introduced in elf/elf.h.
> 
>  elf/elf.h| 29 -
>  sysdeps/arc/dl-machine.h |  8 
>  2 files changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/elf/elf.h b/elf/elf.h
> index 920e6891e6..da41bad34b 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -4159,6 +4159,15 @@ enum
>  #define R_LARCH_GNU_VTINHERIT  57
>  #define R_LARCH_GNU_VTENTRY  58
>  
> +/* ARC specific declarations.  */
> +
> +/* Processor specific flags for the Ehdr e_flags field.  */
> +#define EF_ARC_MACH_MSK  0x00ff
> +#define EF_ARC_OSABI_MSK0x0f00
> +#define EF_ARC_ALL_MSK   (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
> +
> +/* Processor specific values for the Shdr sh_type field.  */
> +#define SHT_ARC_ATTRIBUTES   (SHT_LOPROC + 1) /* ARC attributes section.  */
>  
>  /* ARCompact/ARCv2 specific relocs.  */
>  #define R_ARC_NONE   0x0
> @@ -4166,7 +4175,7 @@ enum
>  #define R_ARC_16 0x2
>  #define R_ARC_24 0x3
>  #define R_ARC_32 0x4
> -#define R_ARC_B260x5
> +
>  #define R_ARC_B22_PCREL  0x6
>  #define R_ARC_H300x7
>  #define R_ARC_N8 0x8
> @@ -4206,16 +4215,23 @@ enum
>  #define R_ARC_SECTOFF_ME_2   0x2A
>  #define R_ARC_SECTOFF_1  0x2B
>  #define R_ARC_SECTOFF_2  0x2C
> +#define R_ARC_SDA_12 0x2D
> +#define R_ARC_SDA16_ST2  0x30
> +#define R_ARC_32_PCREL   0x31
>  #define R_ARC_PC32   0x32
>  #define R_ARC_GOTPC320x33
>  #define R_ARC_PLT32  0x34
>  #define R_ARC_COPY   0x35
>  #define R_ARC_GLOB_DAT   0x36
> -#define R_ARC_JUMP_SLOT  0x37
> +#define R_ARC_JMP_SLOT   0x37
>  #define R_ARC_RELATIVE   0x38
>  #define R_ARC_GOTOFF 0x39
>  #define R_ARC_GOTPC  0x3A
>  #define R_ARC_GOT32  0x3B
> +#define R_ARC_S21W_PCREL_PLT 0x3C
> +#define R_ARC_S25H_PCREL_PLT 0x3D
> +
> +#define R_ARC_JLI_SECTOFF0x3F
>  
>  #define R_ARC_TLS_DTPMOD 0x42
>  #define R_ARC_TLS_DTPOFF 0x43
> @@ -4224,9 +4240,12 @@ enum
>  #define R_ARC_TLS_GD_LD  0x46
>  #define R_ARC_TLS_GD_CALL0x47
>  #define R_ARC_TLS_IE_GOT 0x48
> -#define R_ARC_TLS_DTPOFF_S9  0x4a
> -#define R_ARC_TLS_LE_S9  0x4a
> -#define R_ARC_TLS_LE_32  0x4b
> +#define R_ARC_TLS_DTPOFF_S9  0x49
> +#define R_ARC_TLS_LE_S9  0x4A
> +#define R_ARC_TLS_LE_32  0x4B
> +#define R_ARC_S25W_PCREL_PLT 0x4C
> +#define R_ARC_S21H_PCREL_PLT 0x4D
> +#define R_ARC_NPS_CMEM16 0x4E
>  
>  /* OpenRISC 1000 specific relocs.  */
>  #define R_OR1K_NONE  0
> diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h
> index c6ad232384..8420cd0006 100644
> --- a/sysdeps/arc/dl-machine.h
> +++ b/sysdeps/arc/dl-machine.h
> @@ -183,14 +183,14 @@ __start:
> \n\
> ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
> of the main executable's symbols, as for a COPY reloc.  */
>  #define elf_machine_type_class(type) \
> -  type) == R_ARC_JUMP_SLOT   \
> +  type) == R_ARC_JMP_SLOT\
>   || (type) == R_ARC_TLS_DTPMOD   \
>   || (type) == R_ARC_TLS_DTPOFF   \
>   || (type) == R_ARC_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT)\
> | (((type) == R_ARC_COPY) * ELF_RTYPE_CLASS_COPY))
>  
>  /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
> -#define ELF_MACHINE_JMP_SLOT  R_ARC_JUMP_SLOT
> +#define ELF_MACHINE_JMP_SLOT  R_ARC_JMP_SLOT
>  
>  /* Fixup a PLT

Re: [PATCH] ARC: align child stack in clone

2023-01-16 Thread Adhemerval Zanella Netto



On 21/12/22 13:19, Pavel.Kozlov--- via Libc-alpha wrote:
> From: Pavel Kozlov 
> 
> The ARCv2 ABI requires 4 byte stack pointer alignment. Don't allow to
> use unaligned child stack in clone. As the stack grows down,
> align it down.
> 
> This was pointed by misc/tst-misalign-clone-internal and
> misc/tst-misalign-clone tests. Stack alignmet fixes these tests
> fails.

LGTM, although I can't really test it since the Synopsys qemu tree does not
have qemu-user support [1].

Reviewed-by: Adhemerval Zanella  

[1] https://github.com/foss-for-synopsys-dwc-arc-processors/qemu

> ---
>  sysdeps/unix/sysv/linux/arc/clone.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/arc/clone.S 
> b/sysdeps/unix/sysv/linux/arc/clone.S
> index bd924890844a..f32c83f17a65 100644
> --- a/sysdeps/unix/sysv/linux/arc/clone.S
> +++ b/sysdeps/unix/sysv/linux/arc/clone.S
> @@ -41,6 +41,7 @@
>  
>  ENTRY (__clone)
>   cmp r0, 0   /* @fn can't be NULL.  */
> + and r1,r1,-4/* @child_stack be 4 bytes aligned per ABI.  */
>   cmp.ne  r1, 0   /* @child_stack can't be NULL.  */
>   bz  L (__sys_err)
>  

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


Re: [PATCH] ARC:fpu: add extra capability check before use of sqrt and fma builtins

2023-01-16 Thread Adhemerval Zanella Netto



On 21/12/22 13:28, Pavel.Kozlov--- via Libc-alpha wrote:
> From: Pavel Kozlov 
> 
> Add extra check for compiler definitions to ensure that compiler provides
> sqrt and fma hw fpu instructions else use software implementation.
> 
> As divide/sqrt and FMA hw support from CPU side is optional,
> the compiler can be configured by options to generate hw FPU instructions,
> but without use of FDDIV, FDSQRT, FSDIV, FSSQRT, FDMADD and FSMADD
> instructions. In this case __builtin_sqrt and __builtin_sqrtf provided by
> compiler can't be used inside the glibc code, as these builtins are used
> in implementations of sqrt() and sqrtf() functions but at the same time
> these builtins unfold to sqrt() and sqrtf(). So it is possible to receive
> code like that:
> 
> 0001c4b4 <__ieee754_sqrtf>:
>1c4b4:0001   b 0 ;1c4b4 <__ieee754_sqrtf>
> 
> The same is also true for __builtin_fma and __builtin_fmaf.
> ---
>  sysdeps/arc/fpu/math-use-builtins-fma.h  | 14 --
>  sysdeps/arc/fpu/math-use-builtins-sqrt.h | 14 --
>  2 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/arc/fpu/math-use-builtins-fma.h 
> b/sysdeps/arc/fpu/math-use-builtins-fma.h
> index eede75aa41be..082badf48201 100644
> --- a/sysdeps/arc/fpu/math-use-builtins-fma.h
> +++ b/sysdeps/arc/fpu/math-use-builtins-fma.h
> @@ -1,4 +1,14 @@
> -#define USE_FMA_BUILTIN 1
> -#define USE_FMAF_BUILTIN 1
> +#if defined __ARC_FPU_DP_DIV__
> +# define USE_SQRT_BUILTIN 1
> +#else
> +# define USE_SQRT_BUILTIN 0
> +#endif
> +
> +#if defined __ARC_FPU_SP_DIV__
> +# define USE_SQRTF_BUILTIN 1
> +#else
> +# define USE_SQRTF_BUILTIN 0
> +#endif
> +
>  #define USE_FMAL_BUILTIN 0
>  #define USE_FMAF128_BUILTIN 0

This is wrong, sqrt use macro do not belong for the fma switch file.

> diff --git a/sysdeps/arc/fpu/math-use-builtins-sqrt.h 
> b/sysdeps/arc/fpu/math-use-builtins-sqrt.h
> index e94c915ba66a..a449bc609295 100644
> --- a/sysdeps/arc/fpu/math-use-builtins-sqrt.h
> +++ b/sysdeps/arc/fpu/math-use-builtins-sqrt.h
> @@ -1,4 +1,14 @@
> -#define USE_SQRT_BUILTIN 1
> -#define USE_SQRTF_BUILTIN 1
> +#if defined __ARC_FPU_DP_DIV__
> +# define USE_SQRT_BUILTIN 1
> +#else
> +# define USE_SQRT_BUILTIN 0
> +#endif
> +
> +#if defined __ARC_FPU_SP_DIV__
> +# define USE_SQRTF_BUILTIN 1
> +#else
> +# define USE_SQRTF_BUILTIN 0
> +#endif
> +
>  #define USE_SQRTL_BUILTIN 0
>  #define USE_SQRTF128_BUILTIN 0

This is ok.

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


Re: [PATCH v2] ARC:fpu: add extra capability check before use of sqrt and fma builtins

2023-01-17 Thread Adhemerval Zanella Netto



On 17/01/23 09:12, Pavel.Kozlov--- via Libc-alpha wrote:
> From: Pavel Kozlov 
> 
> Add extra check for compiler definitions to ensure that compiler provides
> sqrt and fma hw fpu instructions else use software implementation.
> 
> As divide/sqrt and FMA hw support from CPU side is optional,
> the compiler can be configured by options to generate hw FPU instructions,
> but without use of FDDIV, FDSQRT, FSDIV, FSSQRT, FDMADD and FSMADD
> instructions. In this case __builtin_sqrt and __builtin_sqrtf provided by
> compiler can't be used inside the glibc code, as these builtins are used
> in implementations of sqrt() and sqrtf() functions but at the same time
> these builtins unfold to sqrt() and sqrtf(). So it is possible to receive
> code like that:
> 
> 0001c4b4 <__ieee754_sqrtf>:
>1c4b4:0001   b 0 ;1c4b4 <__ieee754_sqrtf>
> 
> The same is also true for __builtin_fma and __builtin_fmaf.

LGTM, thanks.  You might need to check with Carlos O'Donnel to see it you
could install this for 2.36.

Reviewed-by: Adhemerval Zanella  

> 
> ---
> Changes in v2:
>  - Fixed macros definitions for FMA
> 
>  sysdeps/arc/fpu/math-use-builtins-fma.h  | 14 --
>  sysdeps/arc/fpu/math-use-builtins-sqrt.h | 14 --
>  2 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/arc/fpu/math-use-builtins-fma.h 
> b/sysdeps/arc/fpu/math-use-builtins-fma.h
> index eede75aa41be..2acd8113ce2c 100644
> --- a/sysdeps/arc/fpu/math-use-builtins-fma.h
> +++ b/sysdeps/arc/fpu/math-use-builtins-fma.h
> @@ -1,4 +1,14 @@
> -#define USE_FMA_BUILTIN 1
> -#define USE_FMAF_BUILTIN 1
> +#if defined __ARC_FPU_DP_FMA__
> +# define USE_FMA_BUILTIN 1
> +#else
> +# define USE_FMA_BUILTIN 0
> +#endif
> +
> +#if defined __ARC_FPU_SP_FMA__
> +# define USE_FMAF_BUILTIN 1
> +#else
> +# define USE_FMAF_BUILTIN 0
> +#endif
> +
>  #define USE_FMAL_BUILTIN 0
>  #define USE_FMAF128_BUILTIN 0
> diff --git a/sysdeps/arc/fpu/math-use-builtins-sqrt.h 
> b/sysdeps/arc/fpu/math-use-builtins-sqrt.h
> index e94c915ba66a..a449bc609295 100644
> --- a/sysdeps/arc/fpu/math-use-builtins-sqrt.h
> +++ b/sysdeps/arc/fpu/math-use-builtins-sqrt.h
> @@ -1,4 +1,14 @@
> -#define USE_SQRT_BUILTIN 1
> -#define USE_SQRTF_BUILTIN 1
> +#if defined __ARC_FPU_DP_DIV__
> +# define USE_SQRT_BUILTIN 1
> +#else
> +# define USE_SQRT_BUILTIN 0
> +#endif
> +
> +#if defined __ARC_FPU_SP_DIV__
> +# define USE_SQRTF_BUILTIN 1
> +#else
> +# define USE_SQRTF_BUILTIN 0
> +#endif
> +
>  #define USE_SQRTL_BUILTIN 0
>  #define USE_SQRTF128_BUILTIN 0

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


Re: Pavel new maintainer of ARC port

2023-02-21 Thread Adhemerval Zanella Netto



On 21/02/23 10:55, Pavel Kozlov via Libc-alpha wrote:
> Hi all,
> 
> I'm excited to introduce myself and become a part of the community. 
> 
> I'm a software engineer in Synopsys and member of a team working to enhance 
> support for ARC CPUs in the GNU Linux ecosystem.
> 
> I would appreciate any guidance or advice on how I can get involved and 
> contribute to the community. I'm always looking for opportunities to connect 
> with other developers and learn from their experiences.
> 
> As a final step of setup, I've updated wiki and added myself as ARC 
> maintainer. Also, thanks Carlos, for help with my setup.
> 
> Best regards,
> Pavel Kozlov

Hi Pavel,

Carlos might already brought to your attention, but we have a weekly
call [1] where we discuss the current patchwork status [2], any blocker
someone might have, future work, or to discuss bug report or any other
issue.  So fell free to hop in if you have anything to discuss.

[1] https://sourceware.org/glibc/wiki/PatchworkReviewMeetings
[2] https://patchwork.sourceware.org/project/glibc/list/

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


Re: Pavel new maintainer of ARC port

2023-02-22 Thread Adhemerval Zanella Netto



On 21/02/23 15:59, Adhemerval Zanella Netto wrote:
> 
> 
> On 21/02/23 10:55, Pavel Kozlov via Libc-alpha wrote:
>> Hi all,
>>
>> I'm excited to introduce myself and become a part of the community. 
>>
>> I'm a software engineer in Synopsys and member of a team working to enhance 
>> support for ARC CPUs in the GNU Linux ecosystem.
>>
>> I would appreciate any guidance or advice on how I can get involved and 
>> contribute to the community. I'm always looking for opportunities to connect 
>> with other developers and learn from their experiences.
>>
>> As a final step of setup, I've updated wiki and added myself as ARC 
>> maintainer. Also, thanks Carlos, for help with my setup.
>>
>> Best regards,
>> Pavel Kozlov
> 
> Hi Pavel,
> 
> Carlos might already brought to your attention, but we have a weekly
> call [1] where we discuss the current patchwork status [2], any blocker
> someone might have, future work, or to discuss bug report or any other
> issue.  So fell free to hop in if you have anything to discuss.
> 
> [1] https://sourceware.org/glibc/wiki/PatchworkReviewMeetings
> [2] https://patchwork.sourceware.org/project/glibc/list/

Another thing you might want to check is to do some triage on the
ARC failures reported by on the 2.37 release page. Some might be
just due timeout issues (test taking to long), however some might
require some work (the test-float64-trunc for instance).

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


Re: [PATCH 2/2] ARC: run child from the separate start block in __clone

2023-03-07 Thread Adhemerval Zanella Netto



On 02/03/23 13:10, Pavel Kozlov via Libc-alpha wrote:
> From: Pavel Kozlov 
> 
> For better debug experience use separate code block with extra
> cfi_* directives to run child (same as in __clone3).

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  

> ---
>  sysdeps/unix/sysv/linux/arc/clone.S | 40 ++---
>  1 file changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/arc/clone.S 
> b/sysdeps/unix/sysv/linux/arc/clone.S
> index 766649625658..0029aaeb8170 100644
> --- a/sysdeps/unix/sysv/linux/arc/clone.S
> +++ b/sysdeps/unix/sysv/linux/arc/clone.S
> @@ -20,9 +20,6 @@
>  #include 
>  #define _ERRNO_H 1
>  #include 
> -#include 
> -
> -#define CLONE_SETTLS 0x0008
>  
>  /* int clone(int (*fn)(void *), void *child_stack,
> int flags, void *arg, ...
> @@ -63,19 +60,9 @@ ENTRY (__clone)
>   ARC_TRAP_INSN
>  
>   cmp r0, 0   /* return code : 0 new process, !0 parent.  */
> + beq thread_start_clone
>   blt L (__sys_err2)  /* < 0 (signed) error.  */
> - jnz [blink] /* Parent returns.  */
> -
> - /* child jumps off to @fn with @arg as argument
> -   TP register already set by kernel.  */
> - jl.d[r10]
> - mov r0, r11
> -
> - /* exit() with result from @fn (already in r0).  */
> - mov r8, __NR_exit
> - ARC_TRAP_INSN
> - /* In case it ever came back.  */
> - flag1
> + j   [blink] /* Parent returns.  */
>  
>  L (__sys_err):
>   mov r0, -EINVAL
> @@ -89,5 +76,28 @@ L (__sys_err2):
>  position independent.  */
>   b   __syscall_error
>  PSEUDO_END (__clone)
> +
> +
> + .align 4
> + .type thread_start_clone, %function
> +thread_start_clone:
> + cfi_startproc
> + /* Terminate call stack by noting ra is undefined.  */
> + cfi_undefined (blink)
> +
> + /* Child jumps off to @fn with @arg as argument.  */
> + jl.d[r10]
> + mov r0, r11
> +
> + /* exit() with result from @fn (already in r0).  */
> + mov r8, __NR_exit
> + ARC_TRAP_INSN
> +
> + /* In case it ever came back.  */
> + flag1
> +
> + cfi_endproc
> + .size thread_start_clone, .-thread_start_clone
> +
>  libc_hidden_def (__clone)
>  weak_alias (__clone, clone)

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


Re: [PATCH 1/2] ARC: Add the clone3 wrapper

2023-03-07 Thread Adhemerval Zanella Netto



On 02/03/23 13:10, Pavel Kozlov via Libc-alpha wrote:
> From: Pavel Kozlov 
> 
> Use the clone3 wrapper on ARC. It doesn't care about stack alignment.
> All callers should provide an aligned stack.
> It follows the internal signature:
> 
> extern int clone3 (struct clone_args *__cl_args, size_t __size,
>  int (*__func) (void *__arg), void *__arg);

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  

> ---
> Checked on arc-linux-gnu. Previously observed tst-misaling-clone-internal
> test fail was because I used outdated master branch.
> Full testsuite runs without regressions.
> But I also see fail of the new tst-spawn7, as already repoted at [1].
> 
> [1]
> https://sourceware.org/pipermail/libc-alpha/2023-February/145937.html
> 
>  sysdeps/unix/sysv/linux/arc/clone3.S | 90 
>  sysdeps/unix/sysv/linux/arc/sysdep.h |  2 +
>  2 files changed, 92 insertions(+)
>  create mode 100644 sysdeps/unix/sysv/linux/arc/clone3.S
> 
> diff --git a/sysdeps/unix/sysv/linux/arc/clone3.S 
> b/sysdeps/unix/sysv/linux/arc/clone3.S
> new file mode 100644
> index ..87a8272a3977
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/arc/clone3.S
> @@ -0,0 +1,90 @@
> +/* The clone3 syscall wrapper.  Linux/arc version.
> +   Copyright (C) 2023 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
> +   .  */
> +
> +#include 
> +#define _ERRNO_H 1
> +#include 
> +
> +/* The userland implementation is:
> +   int clone3 (struct clone_args *cl_args, size_t size,
> +   int (*func)(void *arg), void *arg);
> +
> +   the kernel entry is:
> +   int clone3 (struct clone_args *cl_args, size_t size);
> +
> +   The parameters are passed in registers from userland:
> +   r0: cl_args
> +   r1: size
> +   r2: func
> +   r3: arg  */
> +
> +ENTRY(__clone3)
> +
> + /* Save args for the child.  */
> + mov r10, r0 /* cl_args  */
> + mov r11, r2 /* func  */
> + mov r12, r3 /* args  */
> +
> + /* Sanity check args.  */
> + breqr10, 0, L (__sys_err)   /* No NULL cl_args pointer.  */
> + breqr11, 0, L (__sys_err)   /* No NULL function pointer.  */
> +
> + /* Do the system call, the kernel expects:
> +r8: system call number
> +r0: cl_args
> +r1: size  */
> + mov r0, r10
> + mov r8, __NR_clone3
> + ARC_TRAP_INSN
> +
> + cmp r0, 0
> + beq thread_start_clone3 /* Child returns.  */
> + blt L (__sys_err2)
> + j   [blink] /* Parent returns.  */
> +
> +L (__sys_err):
> + mov r0, -EINVAL
> +L (__sys_err2):
> + b   __syscall_error
> +PSEUDO_END (__clone3)
> +
> +
> + .align 4
> + .type thread_start_clone3, %function
> +thread_start_clone3:
> + cfi_startproc
> + /* Terminate call stack by noting ra is undefined.  */
> + cfi_undefined (blink)
> +
> + /* Child jumps off to @fn with @arg as argument.  */
> + jl.d[r11]
> + mov r0, r12
> +
> + /* exit() with result from @fn (already in r0).  */
> + mov r8, __NR_exit
> + ARC_TRAP_INSN
> +
> + /* In case it ever came back.  */
> + flag1
> +
> + cfi_endproc
> + .size thread_start_clone3, .-thread_start_clone3
> +
> +libc_hidden_def (__clone3)
> +weak_alias (__clone3, clone3)
> diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h 
> b/sysdeps/unix/sysv/linux/arc/sysdep.h
> index dd6fe73445f9..88dc1dff017f 100644
> --- a/sysdeps/unix/sysv/linux/arc/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
> @@ -141,6 +141,8 @@ hidden_proto (__syscall_error)
>  
>  # define ARC_TRAP_INSN   "trap_s 0   \n\t"
>  
> +# define HAVE_CLONE3_WRAPPER 1
> +
>  # undef INTERNAL_SYSCALL_NCS
>  # define INTERNAL_SYSCALL_NCS(number, nr_args, args...)  \
>({ \

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