Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
ANDROID_VERSION: 21
steps:
- name: Code checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -40,6 +42,30 @@ jobs:
make -C apps/basic clean
make
make -C apps/basic
- name: Build (Android)
env:
CC: aarch64-linux-android${{ env.ANDROID_VERSION }}-clang
FULL_CONTEXT: 0
USE_SYSCALL_TABLE: 0
SYSCALL_RECORD: 0
run: |
export PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
make clean
make -C apps/basic clean
make
make -C apps/basic
- name: Build (Android)
env:
CC: aarch64-linux-android${{ env.ANDROID_VERSION }}-clang
FULL_CONTEXT: 1
USE_SYSCALL_TABLE: 1
SYSCALL_RECORD: 1
run: |
export PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
make clean
make -C apps/basic clean
make
make -C apps/basic
- name: Format
run: |
make fmt
Expand Down
13 changes: 10 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ void ____asm_impl(void) {
".globl enter_syscall \n\t"
"enter_syscall: \n\t"
"mov x8, x6 \n\t"
"ldr x6, =syscall_table \n\t"
/*
* NOTE: Below assembly is same as "ldr x6, =syscall_table", but lld fails
* to resolve relocation R_AARCH64_ABS64. So, we use adrp/ldr instead.
*/
"adrp x6, :got:syscall_table \n\t"
"ldr x6, [x6, #:got_lo12:syscall_table] \n\t"
"ldr x6, [x6] \n\t"
"add x6, x6, xzr, lsl #3 \n\t"
"br x6 \n\t");
Expand Down Expand Up @@ -285,9 +290,11 @@ static inline uint32_t gen_br(uint8_t rn) {
return insn;
}

static inline uint32_t gen_ret(void) { return 0xd65f03c0; }
__attribute__((unused)) static inline uint32_t gen_ret(void) {
return 0xd65f03c0;
}

static inline uint32_t gen_svc(uint16_t imm) {
__attribute__((unused)) static inline uint32_t gen_svc(uint16_t imm) {
return 0xd4000001 | ((uint32_t)imm << 5);
}

Expand Down