Permalink
Browse files

Add arm-nacl port.

  • Loading branch information...
Roland McGrath
Roland McGrath committed Apr 17, 2015
1 parent f709259 commit d1e44df1fa5fefd8a083f6c1e909bbcdc97c6438
Showing with 5,120 additions and 0 deletions.
  1. +7 −0 ChangeLog
  2. +2 −0 abi-tags
  3. +2 −0 sysdeps/arm/nacl/Implies
  4. +33 −0 sysdeps/arm/nacl/Makefile
  5. +47 −0 sysdeps/arm/nacl/____longjmp_chk.S
  6. +44 −0 sysdeps/arm/nacl/aeabi_read_tp.S
  7. +43 −0 sysdeps/arm/nacl/arm-features.h
  8. +53 −0 sysdeps/arm/nacl/dl-machine.h
  9. +278 −0 sysdeps/arm/nacl/dl-trampoline.S
  10. +38 −0 sysdeps/arm/nacl/include/bits/setjmp.h
  11. +4 −0 sysdeps/arm/nacl/shlib-versions
  12. +1 −0 sysdeps/arm/nacl/start.c
  13. +69 −0 sysdeps/arm/nacl/sysdep.h
  14. +2 −0 sysdeps/arm/nacl/tls.h
  15. +3 −0 sysdeps/nacl/Implies
  16. +135 −0 sysdeps/nacl/Makefile
  17. +3 −0 sysdeps/nacl/Subdirs
  18. +21 −0 sysdeps/nacl/Versions
  19. +34 −0 sysdeps/nacl/_exit.c
  20. +28 −0 sysdeps/nacl/access.c
  21. +1 −0 sysdeps/nacl/backtrace.c
  22. +52 −0 sysdeps/nacl/bits/dirent.h
  23. +149 −0 sysdeps/nacl/bits/fcntl.h
  24. +64 −0 sysdeps/nacl/bits/local_lim.h
  25. +24 −0 sysdeps/nacl/bits/mman.h
  26. +23 −0 sysdeps/nacl/bits/param.h
  27. +210 −0 sysdeps/nacl/bits/posix_opt.h
  28. +147 −0 sysdeps/nacl/bits/stat.h
  29. +71 −0 sysdeps/nacl/bits/typesizes.h
  30. +93 −0 sysdeps/nacl/brk.c
  31. +28 −0 sysdeps/nacl/chdir.c
  32. +23 −0 sysdeps/nacl/check_fds.c
  33. +28 −0 sysdeps/nacl/chmod.c
  34. +29 −0 sysdeps/nacl/clock.c
  35. +28 −0 sysdeps/nacl/clock_getres.c
  36. +29 −0 sysdeps/nacl/clock_gettime.c
  37. +31 −0 sysdeps/nacl/close.c
  38. +18 −0 sysdeps/nacl/configure
  39. +18 −0 sysdeps/nacl/configure.ac
  40. +46 −0 sysdeps/nacl/createthread.c
  41. +238 −0 sysdeps/nacl/dl-map-segments.h
  42. +34 −0 sysdeps/nacl/dl-osinfo.h
  43. +89 −0 sysdeps/nacl/dl-sysdep.c
  44. +30 −0 sysdeps/nacl/dl-sysdep.h
  45. +65 −0 sysdeps/nacl/dl-unmap-segments.h
  46. +45 −0 sysdeps/nacl/dl-writev.h
  47. +30 −0 sysdeps/nacl/dup.c
  48. +31 −0 sysdeps/nacl/dup2.c
  49. +6 −0 sysdeps/nacl/entry.h
  50. +87 −0 sysdeps/nacl/errnos.awk
  51. +27 −0 sysdeps/nacl/euidaccess.c
  52. +35 −0 sysdeps/nacl/exit-thread.h
  53. +28 −0 sysdeps/nacl/fchdir.c
  54. +28 −0 sysdeps/nacl/fchmod.c
  55. +28 −0 sysdeps/nacl/fdatasync.c
  56. +3 −0 sysdeps/nacl/fork.c
  57. +27 −0 sysdeps/nacl/fsync.c
  58. +32 −0 sysdeps/nacl/ftruncate.c
  59. +1 −0 sysdeps/nacl/ftruncate64.c
  60. +45 −0 sysdeps/nacl/fxstat.c
  61. +1 −0 sysdeps/nacl/fxstat64.c
  62. +56 −0 sysdeps/nacl/getcwd.c
  63. +29 −0 sysdeps/nacl/getdents.c
  64. +1 −0 sysdeps/nacl/getdents64.c
  65. +28 −0 sysdeps/nacl/getdtsz.c
  66. +1 −0 sysdeps/nacl/getpagesize.c
  67. +32 −0 sysdeps/nacl/getpid.c
  68. +65 −0 sysdeps/nacl/getsysstats.c
  69. +40 −0 sysdeps/nacl/gettimeofday.c
  70. +26 −0 sysdeps/nacl/glob.c
  71. +1 −0 sysdeps/nacl/glob64.c
  72. +2 −0 sysdeps/nacl/ifaddrs.c
  73. +27 −0 sysdeps/nacl/init-first.c
  74. +26 −0 sysdeps/nacl/iofdopen.c
  75. +12 −0 sysdeps/nacl/irt.sed
  76. +38 −0 sysdeps/nacl/isatty.c
  77. +28 −0 sysdeps/nacl/kernel-features.h
  78. +35 −0 sysdeps/nacl/ldsodefs.h
  79. +4 −0 sysdeps/nacl/libc-start.c
  80. +28 −0 sysdeps/nacl/link.c
  81. +87 −0 sysdeps/nacl/lowlevellock-futex.h
  82. +43 −0 sysdeps/nacl/lseek.c
  83. +1 −0 sysdeps/nacl/lseek64.c
  84. +46 −0 sysdeps/nacl/lxstat.c
  85. +1 −0 sysdeps/nacl/lxstat64.c
  86. +28 −0 sysdeps/nacl/mkdir.c
  87. +49 −0 sysdeps/nacl/mmap.c
  88. +1 −0 sysdeps/nacl/mmap64.c
  89. +33 −0 sysdeps/nacl/mprotect.c
  90. +32 −0 sysdeps/nacl/munmap.c
  91. +69 −0 sysdeps/nacl/nacl-after-link.sh
  92. +47 −0 sysdeps/nacl/nacl-interface-list.h
  93. +43 −0 sysdeps/nacl/nacl-interface-table.c
  94. +123 −0 sysdeps/nacl/nacl-interfaces.c
  95. +108 −0 sysdeps/nacl/nacl-interfaces.h
  96. +25 −0 sysdeps/nacl/nacl-interfaces.mk.in
  97. +280 −0 sysdeps/nacl/nacl-test-wrapper.sh
  98. +49 −0 sysdeps/nacl/nacl_interface_query.c
  99. +33 −0 sysdeps/nacl/nanosleep.c
  100. +52 −0 sysdeps/nacl/open.c
  101. +1 −0 sysdeps/nacl/open64.c
  102. +7 −0 sysdeps/nacl/preconfigure
  103. +2 −0 sysdeps/nacl/profil.c
  104. +32 −0 sysdeps/nacl/read.c
  105. +11 −0 sysdeps/nacl/readdir.c
  106. +1 −0 sysdeps/nacl/readdir64.c
  107. +1 −0 sysdeps/nacl/readdir64_r.c
  108. +8 −0 sysdeps/nacl/readdir_r.c
  109. +32 −0 sysdeps/nacl/readlink.c
  110. +27 −0 sysdeps/nacl/rename.c
  111. +28 −0 sysdeps/nacl/rmdir.c
  112. +31 −0 sysdeps/nacl/sched_yield.c
  113. +9 −0 sysdeps/nacl/shlib-versions
  114. +11 −0 sysdeps/nacl/sigaction.c
  115. +2 −0 sysdeps/nacl/sprofil.c
  116. +73 −0 sysdeps/nacl/start.c
  117. +28 −0 sysdeps/nacl/symlink.c
  118. +41 −0 sysdeps/nacl/tls.h
  119. +32 −0 sysdeps/nacl/truncate.c
  120. +1 −0 sysdeps/nacl/truncate64.c
  121. +28 −0 sysdeps/nacl/unlink.c
  122. +29 −0 sysdeps/nacl/utimes.c
  123. +33 −0 sysdeps/nacl/write.c
  124. +45 −0 sysdeps/nacl/xstat.c
  125. +1 −0 sysdeps/nacl/xstat64.c
  126. +76 −0 sysdeps/nacl/xstatconv.c
  127. +32 −0 sysdeps/nacl/xstatconv.h
@@ -1,3 +1,10 @@
2015-04-17 Roland McGrath <roland@hack.frob.com>

Add preliminary port to Google Native Client on ARM.
* abi-tags (.*-.*-nacl.*): New entry.
* sysdeps/arm/nacl: New directory.
* sysdeps/nacl: New directory.

2015-04-16 David S. Miller <davem@davemloft.net>

* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Make use of
@@ -28,5 +28,7 @@

.*-.*-syllable.* 5 2.0.0 # just an arbitrary value

.*-.*-nacl.* 6 42.0.0 # earliest compatible Chromium version

# There is no catch-all default here because every supported OS that uses
# ELF must have its own unique ABI tag.
@@ -0,0 +1,2 @@
arm/nptl
init_array
@@ -0,0 +1,33 @@
# Makefile fragment for ARM/NaCl configurations.

# Copyright (C) 2015 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
# <http://www.gnu.org/licenses/>.

# sysdeps/nacl/Makefile needs this set to the architecture suffix used in
# the NaCl SDK.
nacl-sdk-arch = arm

# We don't really support TLSDESC, even though the compiler thinks it does.
have-arm-tls-desc = no

ifeq ($(subdir),csu)
sysdep_routines += aeabi_read_tp
endif

ifeq ($(subdir),elf)
sysdep-rtld-routines += aeabi_read_tp
endif
@@ -0,0 +1,47 @@
/* longjmp that validates stack addresses. ARM/NaCl version.
Copyright (C) 2015 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
<http://www.gnu.org/licenses/>. */

#include <sysdep.h>

.section .rodata.str1.1,"aMS",%progbits,1
.type longjmp_msg,%object
longjmp_msg:
.string "longjmp causes uninitialized stack frame"
.size longjmp_msg, .-longjmp_msg

.text

/* We don't have sigaltstack and so any longjmp must be to an outer frame. */
.macro check_sp reg
cmp sp, \reg
bls .Lok
#ifdef PIC
movw r0, #:lower16:longjmp_msg-(.LPIC0+8)
movt r0, #:upper16:longjmp_msg-(.LPIC0+8)
.LPIC0: add r0, r0, pc
#else
movw r0, #:lower16:longjmp_msg
movt r0, #:upper16:longjmp_msg
#endif
b HIDDEN_JUMPTARGET(__fortify_fail)
.Lok:
.endm

#define CHECK_SP(reg) check_sp reg
#define __longjmp ____longjmp_chk
#include <__longjmp.S>
@@ -0,0 +1,44 @@
/* ARM EABI helper function for reading the thread pointer. NaCl version.
Copyright (C) 2015 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<http://www.gnu.org/licenses/>. */

#include <sysdep.h>

/* GCC will emit calls to this routine under -mtp=soft. */

.hidden __aeabi_read_tp
ENTRY (__aeabi_read_tp)
ldr r0, [r9]
sfi_bx lr
END (__aeabi_read_tp)
@@ -0,0 +1,43 @@
/* Macros to test for CPU features on ARM. NaCl version.
Copyright (C) 2015 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
<http://www.gnu.org/licenses/>. */

#ifndef _NACL_ARM_FEATURES_H
#define _NACL_ARM_FEATURES_H 1

#ifdef __SOFTFP__
# error NaCl should always have VFP enabled
#endif

/* NaCl does not support iWMMXt at all. */
#define ARM_ASSUME_NO_IWMMXT 1

/* NaCl does not allow instructions to target the pc register. */
#define ARM_ALWAYS_BX 1

/* Computed branch targets must be bundle-aligned, which is to 16 bytes. */
#define ARM_BX_ALIGN_LOG2 4

/* Two-register addressing modes are never allowed. */
#define ARM_NO_INDEX_REGISTER 1

/* Only ARM mode code is allowed, never Thumb mode. */
#define NO_THUMB

#include_next <arm-features.h>

#endif /* arm-features.h */
@@ -0,0 +1,53 @@
/* Machine-dependent ELF dynamic relocation inline functions. ARM/NaCl version.
Copyright (C) 2015 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
<http://www.gnu.org/licenses/>. */

#ifndef dl_machine_h

/* This is only needed for handling TEXTRELs and NaCl will never
support TEXTRELs at all. */
#define CLEAR_CACHE(start, end) __builtin_trap ()

#endif

/* The rest is just machine-specific.
This #include is outside the #ifndef because the parts of
dl-machine.h used only by dynamic-link.h are outside the guard. */
#include <sysdeps/arm/dl-machine.h>

#ifdef dl_machine_h

/* Initial entry point code for the dynamic linker.
The C function `_dl_start' is the real entry point;
its return value is the user program's entry point. */
#undef RTLD_START
#define RTLD_START asm ("\
.text\n\
.globl _start\n\
.type _start, %function\n\
.p2align 4\n\
_start:\n\
@ r0 has the pointer to the info block (see nacl_startup.h)\n\
mov r1, sp @ Save stack base for __libc_stack_end.\n\
push {r0-r3} @ Push those, maintaining alignment to 16.\n\
mov r0, sp @ Pointer to {info, sp} is argument.\n\
sfi_bl _dl_start\n\
pop {r1-r4} @ Restore stack, getting info block into r1.\n\
mov lr, #0 @ Return address for noreturn call.\n\
b _dl_start_user");

#endif
Oops, something went wrong.

0 comments on commit d1e44df

Please sign in to comment.