Index: compiler-rt/lib/builtins/aarch64/lse.S =================================================================== --- compiler-rt/lib/builtins/aarch64/lse.S +++ compiler-rt/lib/builtins/aarch64/lse.S @@ -102,8 +102,13 @@ // Macro for branch to label if no LSE available .macro JUMP_IF_NOT_LSE label +#if !defined(__APPLE__) adrp x(tmp0), __aarch64_have_lse_atomics ldrb w(tmp0), [x(tmp0), :lo12:__aarch64_have_lse_atomics] +#else + adrp x(tmp0), __aarch64_have_lse_atomics@page + ldrb w(tmp0), [x(tmp0), __aarch64_have_lse_atomics@pageoff] +#endif cbz w(tmp0), \label .endm Index: compiler-rt/lib/builtins/assembly.h =================================================================== --- compiler-rt/lib/builtins/assembly.h +++ compiler-rt/lib/builtins/assembly.h @@ -27,7 +27,13 @@ #define FILE_LEVEL_DIRECTIVE .subsections_via_symbols #define SYMBOL_IS_FUNC(name) #define CONST_SECTION .const - +#if defined(__arm__) || defined(__aarch64__) +#define FUNC_ALIGN \ + .text SEPARATOR \ + .balign 16 SEPARATOR +#else +#define FUNC_ALIGN +#endif #define NO_EXEC_STACK_DIRECTIVE #elif defined(__ELF__)