Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
  3.  *
  4.  * This file is part of FFmpeg.
  5.  *
  6.  * FFmpeg is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2.1 of the License, or (at your option) any later version.
  10.  *
  11.  * FFmpeg is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with FFmpeg; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19.  */
  20.  
  21. #include "config.h"
  22.  
  23. #ifdef __ELF__
  24. #   define ELF
  25. #else
  26. #   define ELF  #
  27. #endif
  28.  
  29. #if HAVE_AS_FUNC
  30. #   define FUNC
  31. #else
  32. #   define FUNC #
  33. #endif
  34.  
  35. .macro  function name, export=0, align=2
  36.     .macro endfunc
  37. ELF     .size   \name, . - \name
  38. FUNC    .endfunc
  39.         .purgem endfunc
  40.     .endm
  41.         .text
  42.         .align          \align
  43.     .if \export
  44.         .global EXTERN_ASM\name
  45. ELF     .type   EXTERN_ASM\name, %function
  46. FUNC    .func   EXTERN_ASM\name
  47. EXTERN_ASM\name:
  48.     .else
  49. ELF     .type   \name, %function
  50. FUNC    .func   \name
  51. \name:
  52.     .endif
  53. .endm
  54.  
  55. .macro  const   name, align=2, relocate=0
  56.     .macro endconst
  57. ELF     .size   \name, . - \name
  58.         .purgem endconst
  59.     .endm
  60. #if HAVE_SECTION_DATA_REL_RO
  61. .if \relocate
  62.         .section        .data.rel.ro
  63. .else
  64.         .section        .rodata
  65. .endif
  66. #elif !defined(__MACH__)
  67.         .section        .rodata
  68. #else
  69.         .const_data
  70. #endif
  71.         .align          \align
  72. \name:
  73. .endm
  74.  
  75. .macro  movrel rd, val
  76. #if CONFIG_PIC && defined(__APPLE__)
  77.         adrp            \rd, \val@PAGE
  78.         add             \rd, \rd, \val@PAGEOFF
  79. #elif CONFIG_PIC
  80.         adrp            \rd, \val
  81.         add             \rd, \rd, :lo12:\val
  82. #else
  83.         ldr             \rd, =\val
  84. #endif
  85. .endm
  86.  
  87. #define GLUE(a, b) a ## b
  88. #define JOIN(a, b) GLUE(a, b)
  89. #define X(s) JOIN(EXTERN_ASM, s)
  90.