diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index 5f4b0902d522..97edff0b87ea 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -332,6 +332,10 @@ if (C_SUPPORTS_COMMENT_LIB_PRAGMA) endif() endif() +if (RUNTIMES_EXECUTE_ONLY_CODE) + add_compile_definitions(_LIBUNWIND_EXECUTE_ONLY_CODE) +endif() + #=============================================================================== # Setup Source Code #=============================================================================== diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S index 198735fa800a..fd306ed8c523 100644 --- a/libunwind/src/UnwindRegistersRestore.S +++ b/libunwind/src/UnwindRegistersRestore.S @@ -18,6 +18,8 @@ #if defined(_AIX) .toc +#elif defined(__aarch64__) && defined(__ELF__) && defined(_LIBUNWIND_EXECUTE_ONLY_CODE) + .section .text,"axy",@progbits,unique,0 #else .text #endif diff --git a/libunwind/src/UnwindRegistersSave.S b/libunwind/src/UnwindRegistersSave.S index 619a59751151..b7ddd0a621d1 100644 --- a/libunwind/src/UnwindRegistersSave.S +++ b/libunwind/src/UnwindRegistersSave.S @@ -18,6 +18,8 @@ #if defined(_AIX) .toc +#elif defined(__aarch64__) && defined(__ELF__) && defined(_LIBUNWIND_EXECUTE_ONLY_CODE) + .section .text,"axy",@progbits,unique,0 #else .text #endif