blob: a7f6aad272f174419437ad6622eaf09736f33c2e [file] [log] [blame]
kma@webrtc.org55cd78c2012-11-17 00:22:46 +00001/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
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
Karl Wiberg7aabd392018-03-22 02:59:49 +010011#ifndef RTC_BASE_SYSTEM_ASM_DEFINES_H_
12#define RTC_BASE_SYSTEM_ASM_DEFINES_H_
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000013
Yves Gerey665174f2018-06-19 15:03:05 +020014// clang-format off
15// clang formatting breaks everything here, e.g. concatenating directives,
16// due to absence of context via asm keyword.
17
kma@webrtc.org7877b0f2012-12-12 23:22:13 +000018#if defined(__linux__) && defined(__ELF__)
19.section .note.GNU-stack,"",%progbits
20#endif
21
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000022// 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
andrew@webrtc.orga3823e22015-03-09 23:21:25 +000027.private_extern _\name
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000028.endm
29.macro DEFINE_FUNCTION name
30_\name:
31.endm
kma@webrtc.org47829112013-01-24 01:37:33 +000032.macro CALL_FUNCTION name
33bl _\name
34.endm
kma@webrtc.org16d540e2013-01-25 03:18:05 +000035.macro GLOBAL_LABEL name
36.global _\name
andrew@webrtc.orga3823e22015-03-09 23:21:25 +000037.private_extern _\name
kma@webrtc.org16d540e2013-01-25 03:18:05 +000038.endm
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000039#else
40.macro GLOBAL_FUNCTION name
41.global \name
andrew@webrtc.orga3823e22015-03-09 23:21:25 +000042.hidden \name
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000043.endm
44.macro DEFINE_FUNCTION name
Wei Zhong80154f62015-04-28 13:51:53 -070045#if defined(__linux__) && defined(__ELF__)
46.type \name,%function
47#endif
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000048\name:
49.endm
kma@webrtc.org47829112013-01-24 01:37:33 +000050.macro CALL_FUNCTION name
51bl \name
52.endm
kma@webrtc.org16d540e2013-01-25 03:18:05 +000053.macro GLOBAL_LABEL name
54.global \name
andrew@webrtc.orga3823e22015-03-09 23:21:25 +000055.hidden \name
kma@webrtc.org16d540e2013-01-25 03:18:05 +000056.endm
kma@webrtc.org55cd78c2012-11-17 00:22:46 +000057#endif
58
kma@webrtc.orga0936a62013-03-01 00:20:10 +000059// With Apple's clang compiler, for instructions ldrb, strh, etc.,
kma@webrtc.org2f9bd242013-02-23 04:16:59 +000060// the condition code is after the width specifier. Here we define
61// only the ones that are actually used in the assembly files.
kma@webrtc.orga0936a62013-03-01 00:20:10 +000062#if (defined __llvm__) && (defined __APPLE__)
kma@webrtc.org2f9bd242013-02-23 04:16:59 +000063.macro streqh reg1, reg2, num
64strheq \reg1, \reg2, \num
65.endm
66#endif
67
kma@webrtc.org7877b0f2012-12-12 23:22:13 +000068.text
69
Yves Gerey665174f2018-06-19 15:03:05 +020070// clang-format on
71
Karl Wiberg7aabd392018-03-22 02:59:49 +010072#endif // RTC_BASE_SYSTEM_ASM_DEFINES_H_