public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][AArch64] Fix link error for ioctl syscall wrapper.
@ 2013-05-12 12:00 Marcus Shawcroft
  0 siblings, 0 replies; only message in thread
From: Marcus Shawcroft @ 2013-05-12 12:00 UTC (permalink / raw)
  To: libc-ports

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

Hello,

The ioctl() and clone() system call wrappers for AArch64 are currently written
to use a conditional branch to reach the sycall error handler when the
relevant system call returns an error value.  The use of conditional
branch for this purpose is inappropriate due to the limited range of
these instructions.   The generated syscall wrappers take care to use
the unconditional branch form, which has greater range.

This patch corrects the behavior of both wrappers.

I shall commit this patch shortly.

/Marcus

Proposed ChangeLog:

2013-05-12  Marcus Shawcroft  <marcus.shawcroft@linaro.org>

        * sysdeps/unix/sysv/linux/aarch64/clone.S (__clone):
        Do not call sycall_error directly with a confitional branch.

        * sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl):
        Do not call sycall_error directly with a confitional branch.

[-- Attachment #2: glibc-cb-syscall-error.diff --]
[-- Type: application/octet-stream, Size: 858 bytes --]

diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/clone.S b/ports/sysdeps/unix/sysv/linux/aarch64/clone.S
index 999ecf2..b359e6e 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -65,9 +65,10 @@ ENTRY(__clone)
 	svc	0x0
 	cmp	x0, #0
 	beq	2f
-	blt	C_SYMBOL_NAME(__syscall_error)
+	blt	3f
 	RET
 1:	mov	x0, #-EINVAL
+3:
 	b	syscall_error
 
 2:
diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S b/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S
index b089bb5..2e08cf7 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S
@@ -24,9 +24,7 @@ ENTRY(__ioctl)
         sxtw	x0, w0
         svc	#0x0
 	cmn	x0, #0x1, lsl #12
-	b.hi	C_SYMBOL_NAME(__syscall_error)
-	ret
-
+	PSEUDO_RET
 	PSEUDO_END (__ioctl)
 
 weak_alias (__ioctl, ioctl)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-12 12:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-12 12:00 [PATCH][AArch64] Fix link error for ioctl syscall wrapper Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).