Permalink
Browse files

arch: Added initial arm support

  • Loading branch information...
Snaipe committed Oct 3, 2016
1 parent 726a3fe commit f135dcd0663ea4f79743de76d8d2652e896779db
Showing with 76 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +18 −0 .travis.yml
  3. +6 −0 CMakeLists.txt
  4. +50 −0 src/asm/trampoline-arm.S
@@ -3,6 +3,8 @@

!src/*.c
!src/*.h
!src/asm/*.S
!src/asm/*.asm
!sample/*.c
!test/*.t
!.cmake/*/*.cmake
@@ -7,12 +7,23 @@ _packages:
apt:
packages:
- gcc-multilib
- &arm-packages
apt:
packages:
- qemu-user
- gcc-arm-linux-gnueabihf
- libc6-dev-armhf-cross

_environments:
- &i386-env
- TOOLCHAIN=gcc-i686
- &i386-darwin-env
- TOOLCHAIN=gcc-darwin-i686
- &arm-env
- ARCH=arm
- TARGET=linux-gnueabihf
- TOOLCHAIN=gcc-generic
- CMAKE_OPTS=-DUSE_QEMU=ON

matrix:
include:
@@ -29,6 +40,13 @@ matrix:
- env: [CONFIGURATION=RelWithDebInfo, *i386-env]
addons: *i386-packages
compiler: gcc
# ARM
- env: [CONFIGURATION=Debug, *arm-env]
addons: *arm-packages
compiler: gcc
- env: [CONFIGURATION=RelWithDebInfo, *arm-env]
addons: *arm-packages
compiler: gcc
# OS X
# x86_64
- env: CONFIGURATION=Debug
@@ -17,6 +17,7 @@ include (CheckCompile)

set (I386 "^(i[3-7]|x)86$")
set (AMD64 "^(x86_|x86-|AMD|amd|x)64$")
set (ARM32 "^(arm|ARM|A)(32)?$")

if (CMAKE_GENERATOR_PLATFORM)
set (_ARCH "${CMAKE_GENERATOR_PLATFORM}")
@@ -71,6 +72,11 @@ else ()
set (BXF_ARCH "x86_64")
set (BXF_BITS 64)
set (BXF_ARCH_x86_64 1)
elseif (_ARCH MATCHES "${ARM32}")
set (BXF_ARCH "arm")
set (BXF_ABI "arm")
set (BXF_BITS 32)
set (BXF_ARCH_ARM 1)
else ()
message (FATAL_ERROR "Architecture '${_ARCH}' is not supported.")
endif ()
@@ -0,0 +1,50 @@
/*
* The MIT License (MIT)
*
* Copyright © 2016 Franklin "Snaipe" Mathieu <http://snai.pe/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "config.h"
#include "mangling.h"

#ifdef ASSEMBLER_SUPPORTS_HIDDEN
.hidden MANGLE(bxfi_trampoline)
#endif
.globl MANGLE(bxfi_trampoline)
MANGLE(bxfi_trampoline):
ldr pc, addr_data

.align 2

#ifdef ASSEMBLER_SUPPORTS_HIDDEN
.hidden MANGLE(bxfi_trampoline_addr)
#endif
.globl MANGLE(bxfi_trampoline_addr)
MANGLE(bxfi_trampoline_addr):
addr_data:
.fill 4, 1, 0

#ifdef ASSEMBLER_SUPPORTS_HIDDEN
.hidden MANGLE(bxfi_trampoline_end)
#endif
.globl MANGLE(bxfi_trampoline_end)
MANGLE(bxfi_trampoline_end):

#include "stackfix.h"

0 comments on commit f135dcd

Please sign in to comment.