From e063c9bc924c8e731e7528ecaaaac6737f2f798f Mon Sep 17 00:00:00 2001 From: Ayrton Munoz Date: Mon, 14 Oct 2024 14:30:53 -0400 Subject: [PATCH] cmake: Disable PartitionAlloc on ARM PartitionAlloc needs to be built with -ffixed-x18 on ARM to avoid clobbering x18. However linking it in also pulls in libstdc++ which can also clobber x18 so this commit just disables PartitionAlloc on ARM for now. It shouldn't be too hard to build LLVM's libc++ with -ffixed-x18 since that's what Android uses so we should probably just do that when we want to re-enable PA. --- cmake/ia2.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/ia2.cmake b/cmake/ia2.cmake index 970d5a455..db7622d98 100644 --- a/cmake/ia2.cmake +++ b/cmake/ia2.cmake @@ -69,7 +69,12 @@ function(add_ia2_compartment NAME TYPE) target_link_options(${NAME} PRIVATE ${UBSAN_FLAG}) endif() - target_link_libraries(${NAME} PRIVATE dl libia2 partition-alloc) + if (LIBIA2_AARCH64) + set(ALLOCATOR_LIB "") + else() + set(ALLOCATOR_LIB "partition-alloc") + endif() + target_link_libraries(${NAME} PRIVATE dl libia2 ${ALLOCATOR_LIB}) target_link_options(${NAME} PRIVATE "-Wl,--export-dynamic") target_link_libraries(${NAME} PRIVATE ${ARG_LIBRARIES})