diff mbox

[v2] uclibc: ARC: Support syscall ABI v4

Message ID 1471499553-6145-1-git-send-email-vzakhar@synopsys.com
State Accepted
Headers show

Commit Message

Zakharov Vlad Aug. 18, 2016, 5:52 a.m. UTC
When used with GCC 6 ABIv4 is used.
Missing this patch leads to numerous runtime errors.

The patch has already been accepted in uclibc-ng:
http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3e40f9669279f005f7154892539166f5081fbcb2

So the patch should be removed after update to a new version of uclibc-ng.

Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
---
Changes v1-v2:
 Added commit message and signed-off-by to the attached patch.

 .../uclibc/0003-ARC-Support-syscall-ABI-v4.patch   | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/uclibc/0003-ARC-Support-syscall-ABI-v4.patch

Comments

Thomas Petazzoni Aug. 18, 2016, 10:10 p.m. UTC | #1
Hello,

On Thu, 18 Aug 2016 08:52:33 +0300, Vlad Zakharov wrote:
> When used with GCC 6 ABIv4 is used.
> Missing this patch leads to numerous runtime errors.
> 
> The patch has already been accepted in uclibc-ng:
> http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3e40f9669279f005f7154892539166f5081fbcb2
> 
> So the patch should be removed after update to a new version of uclibc-ng.
> 
> Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
> ---
> Changes v1-v2:
>  Added commit message and signed-off-by to the attached patch.

For some reason, your patch did not apply:

thomas@skate:~/projets/buildroot (master)$ git pwam 660333
Applying patch #660333 using 'git am -s -3'
Description: [v2] uclibc: ARC: Support syscall ABI v4
Applying: uclibc: ARC: Support syscall ABI v4
fatal: corrupt patch at line 69
error: could not build fake ancestor
Patch failed at 0001 uclibc: ARC: Support syscall ABI v4
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
ethomas@skate:~/projets/buildroot (master|AM 1/1)$ cat .git/rebase-apply/patch | patch -p1
patching file package/uclibc/0003-ARC-Support-syscall-ABI-v4.patch
patch: **** malformed patch at line 68: -- 

So I simply re-created it from the uClibc-ng Git repository, and
applied to master. Thanks!

Thomas
Zakharov Vlad Aug. 19, 2016, 7:40 a.m. UTC | #2
Hi Thomas, 

Seems like the patch has been already applied:
https://git.buildroot.net/buildroot/commit/?id=9914215d8992b66bf7ccedf0befb31581955fae5

-- 
Best regards,
Vlad Zakharov <vzakhar@synopsys.com>

On Fri, 2016-08-19 at 00:10 +0200, Thomas Petazzoni wrote:
> Hello,

> 

> On Thu, 18 Aug 2016 08:52:33 +0300, Vlad Zakharov wrote:

> > 

> > When used with GCC 6 ABIv4 is used.

> > Missing this patch leads to numerous runtime errors.

> > 

> > The patch has already been accepted in uclibc-ng:

> > http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3e40f9669279f005f7154892539166f5081fbcb2

> > 

> > So the patch should be removed after update to a new version of uclibc-ng.

> > 

> > Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>

> > ---

> > Changes v1-v2:

> >  Added commit message and signed-off-by to the attached patch.

> For some reason, your patch did not apply:

> 

> thomas@skate:~/projets/buildroot (master)$ git pwam 660333

> Applying patch #660333 using 'git am -s -3'

> Description: [v2] uclibc: ARC: Support syscall ABI v4

> Applying: uclibc: ARC: Support syscall ABI v4

> fatal: corrupt patch at line 69

> error: could not build fake ancestor

> Patch failed at 0001 uclibc: ARC: Support syscall ABI v4

> The copy of the patch that failed is found in: .git/rebase-apply/patch

> When you have resolved this problem, run "git am --continue".

> If you prefer to skip this patch, run "git am --skip" instead.

> To restore the original branch and stop patching, run "git am --abort".

> ethomas@skate:~/projets/buildroot (master|AM 1/1)$ cat .git/rebase-apply/patch | patch -p1

> patching file package/uclibc/0003-ARC-Support-syscall-ABI-v4.patch

> patch: **** malformed patch at line 68: -- 

> 

> So I simply re-created it from the uClibc-ng Git repository, and

> applied to master. Thanks!

> 

> Thomas
Zakharov Vlad Aug. 19, 2016, 7:46 a.m. UTC | #3
Oh, sorry, I misread your e-mail.

On Fri, 2016-08-19 at 10:40 +0300, Vlad Zakharov wrote:
> Hi Thomas, 

> 

> Seems like the patch has been already applied:

> https://git.buildroot.net/buildroot/commit/?id=9914215d8992b66bf7ccedf0befb31581955fae5

> 

-- 
Best regards,
Vlad Zakharov <vzakhar@synopsys.com>
diff mbox

Patch

diff --git a/package/uclibc/0003-ARC-Support-syscall-ABI-v4.patch b/package/uclibc/0003-ARC-Support-syscall-ABI-v4.patch
new file mode 100644
index 0000000..f0a5ae7
--- /dev/null
+++ b/package/uclibc/0003-ARC-Support-syscall-ABI-v4.patch
@@ -0,0 +1,54 @@ 
+From 3e40f9669279f005f7154892539166f5081fbcb2 Mon Sep 17 00:00:00 2001
+From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
+Date: Tue, 16 Aug 2016 15:04:27 -0700
+Subject: [PATCH] ARC: Support syscall ABI v4
+
+The syscall ABI includes the gcc functional calling ABI since a syscall
+implies userland caller and kernel callee.
+
+The current gcc ABI (v3) for ARCv2 ISA required 64-bit data be passed in
+even-odd register pairs, (potentially punching reg holes when passing such
+values as args). This was partly driven by the fact that the double-word
+LDD/STD instructions in ARCv2 expect the register alignment and thus gcc
+forcing this avoids extra MOV at the cost of a few unused register (which we
+have plenty anyways).
+
+This however was rejected as part of upstreaming gcc port to HS. So the new
+ABI v4 doesn't enforce the even-odd reg restriction.
+
+Do note that for ARCompact ISA builds v3 and v4 are practically the same in
+terms of gcc code generation.
+
+This change is dormant for now (gcc 4.8.x based tools) and will only kick
+in with switch to gcc 6.x based tools.
+
+Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
+---
+ libc/sysdeps/linux/arc/bits/uClibc_arch_features.h | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h
+index 5160724..94e089d 100755
+--- a/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h
++++ b/libc/sysdeps/linux/arc/bits/uClibc_arch_features.h
+@@ -41,8 +41,14 @@
+ /* The default ';' is a comment on ARC. */
+ #define __UCLIBC_ASM_LINE_SEP__ `
+ 
+-/* does your target align 64bit values in register pairs ? (32bit arches only) */
+-#if defined(__A7__)
++/* does your target align 64bit values in register pairs ? (32bit arches only)
++ *  - ARC700 never had any constraint on reg pairs (even if ABI v3)
++ *  - Inital HS ABI (v3: non upstream gcc) had 64-bit data aligned in even-odd
++ *     reg pairs (thus allowed reg holes when passing such args to calls)
++ *  - Upstream gcc (6.x) HS ABI doesn't have that restriction
++ */
++
++#if defined(__A7__) || (__GNUC__ > 4)
+ #undef __UCLIBC_SYSCALL_ALIGN_64BIT__
+ #else
+ #define __UCLIBC_SYSCALL_ALIGN_64BIT__
+-- 
+2.5.5
+
-- 
2.5.5