| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #ifndef RTC_BASE_SYSTEM_ASM_DEFINES_H_ |
| 12 | #define RTC_BASE_SYSTEM_ASM_DEFINES_H_ |
| 13 |
| 14 | // clang-format off |
| 15 | // clang formatting breaks everything here, e.g. concatenating directives, |
| 16 | // due to absence of context via asm keyword. |
| 17 |
| 18 | #if defined(__linux__) && defined(__ELF__) |
| 19 | .section .note.GNU-stack,"",%progbits |
| 20 | #endif |
| 21 |
| 22 | // Define the macros used in ARM assembly code, so that for Mac or iOS builds |
| 23 | // we add leading underscores for the function names. |
| 24 | #ifdef __APPLE__ |
| 25 | .macro GLOBAL_FUNCTION name |
| 26 | .global _\name |
| 27 | .private_extern _\name |
| 28 | .endm |
| 29 | .macro DEFINE_FUNCTION name |
| 30 | _\name: |
| 31 | .endm |
| 32 | .macro CALL_FUNCTION name |
| 33 | bl _\name |
| 34 | .endm |
| 35 | .macro GLOBAL_LABEL name |
| 36 | .global _\name |
| 37 | .private_extern _\name |
| 38 | .endm |
| 39 | #else |
| 40 | .macro GLOBAL_FUNCTION name |
| 41 | .global \name |
| 42 | .hidden \name |
| 43 | .endm |
| 44 | .macro DEFINE_FUNCTION name |
| 45 | #if defined(__linux__) && defined(__ELF__) |
| 46 | .type \name,%function |
| 47 | #endif |
| 48 | \name: |
| 49 | .endm |
| 50 | .macro CALL_FUNCTION name |
| 51 | bl \name |
| 52 | .endm |
| 53 | .macro GLOBAL_LABEL name |
| 54 | .global \name |
| 55 | .hidden \name |
| 56 | .endm |
| 57 | #endif |
| 58 |
| 59 | // With Apple's clang compiler, for instructions ldrb, strh, etc., |
| 60 | // the condition code is after the width specifier. Here we define |
| 61 | // only the ones that are actually used in the assembly files. |
| 62 | #if (defined __llvm__) && (defined __APPLE__) |
| 63 | .macro streqh reg1, reg2, num |
| 64 | strheq \reg1, \reg2, \num |
| 65 | .endm |
| 66 | #endif |
| 67 |
| 68 | .text |
| 69 |
| 70 | // clang-format on |
| 71 |
| 72 | #endif // RTC_BASE_SYSTEM_ASM_DEFINES_H_ |
| 73 |