Author: kan
Date: Fri Apr  7 22:58:20 2017
New Revision: 316624
URL: https://svnweb.freebsd.org/changeset/base/316624

Log:
  Do not use b.cs instruction to jump to cerror.
  
  The conditional jump can only be performed to targets up to 1MB in
  either direction and does not work too well when linker places cerror
  further that that from the caller. In that case linker will complain
  about relocation overflows.
  
  Reviewed by: emaste, andrew
  Differential Revision:  https://reviews.freebsd.org/D10305

Modified:
  head/lib/libc/aarch64/SYS.h

Modified: head/lib/libc/aarch64/SYS.h
==============================================================================
--- head/lib/libc/aarch64/SYS.h Fri Apr  7 21:06:50 2017        (r316623)
+++ head/lib/libc/aarch64/SYS.h Fri Apr  7 22:58:20 2017        (r316624)
@@ -45,12 +45,19 @@ ENTRY(__sys_##name);                                        
        \
        ret;                                                    \
 END(__sys_##name)
 
+/*
+ * Conditional jumps can only go up to one megabyte in either
+ * direction, and cerror can be located anywhere, so we have
+ * to jump around to use more capable unconditional branch
+ * instruction.
+ */
 #define        PSEUDO(name)                                            \
 ENTRY(__sys_##name);                                           \
        WEAK_REFERENCE(__sys_##name, _##name);                  \
        _SYSCALL(name);                                         \
-       b.cs    cerror;                                         \
+       b.cs    1f;                                             \
        ret;                                                    \
+1:     b       cerror;                                         \
 END(__sys_##name)
 
 #define        RSYSCALL(name)                                          \
@@ -58,6 +65,7 @@ ENTRY(__sys_##name);                                          
\
        WEAK_REFERENCE(__sys_##name, name);                     \
        WEAK_REFERENCE(__sys_##name, _##name);                  \
        _SYSCALL(name);                                         \
-       b.cs    cerror;                                         \
+       b.cs    1f;                                             \
        ret;                                                    \
+1:     b       cerror;                                         \
 END(__sys_##name)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to