Commit 3e57554e authored by Janne Grunau's avatar Janne Grunau Committed by Fiona Glaser

aarch64: add utility functions for asm

parent efaf0b88
* asm.S: AArch64 utility macros
* Copyright (C) 2008-2014 x264 project
* Authors: Mans Rullgard <>
* David Conrad <>
* Janne Grunau <>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
* This program is also available under a commercial proprietary license.
* For more information, contact us at
#include "config.h"
#ifdef PREFIX
# define EXTERN_ASM _
# define EXTERN_ASM
#ifdef __ELF__
# define ELF
# define ELF #
#ifdef __MACH__
# define MACH
# define MACH #
# define FUNC
# define FUNC #
.macro function name, export=0, align=2
.macro endfunc
ELF .size \name, . - \name
FUNC .endfunc
.purgem endfunc
.align \align
.if \export
.global EXTERN_ASM\name
ELF .type EXTERN_ASM\name, %function
FUNC .func EXTERN_ASM\name
ELF .type \name, %function
FUNC .func \name
.macro const name, align=2
.macro endconst
ELF .size \name, . - \name
.purgem endconst
ELF .section .rodata
MACH .const_data
.align \align
.macro movrel rd, val
#if defined(PIC) && defined(__APPLE__)
adrp \rd, \val@PAGE
add \rd, \rd, \val@PAGEOFF
#elif defined(PIC)
adrp \rd, \val
add \rd, \rd, :lo12:\val
ldr \rd, =\val
#define GLUE(a, b) a ## b
#define JOIN(a, b) GLUE(a, b)
#define X(s) JOIN(EXTERN_ASM, s)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment