From 86c2724e75375ceb165c378ed4261c551136e593 Mon Sep 17 00:00:00 2001 From: KJ Tsanaktsidis Date: Mon, 19 Aug 2024 16:25:09 +1000 Subject: [PATCH] Don't emit ELF notes on non-ELF platforms These apparently break compilation on old MacOS toolchains, because the MachO section name is capped to 16 chars (although, on my MacOS, at least, the section name just gets truncated). Nevertheless, these serve no purpose on non-ELF platforms (they're part of the LSB Linux ABI). [Bug #20677] --- coroutine/amd64/Context.S | 3 +++ coroutine/arm64/Context.S | 2 ++ 2 files changed, 5 insertions(+) diff --git a/coroutine/amd64/Context.S b/coroutine/amd64/Context.S index fad59ecdda..eebf9bf18e 100644 --- a/coroutine/amd64/Context.S +++ b/coroutine/amd64/Context.S @@ -60,6 +60,8 @@ PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): .section .note.GNU-stack,"",%progbits #endif +#if defined(__ELF__) + #if defined(__CET__) && (__CET__ & 0x01) != 0 # define IBT_FLAG 0x01 #else @@ -84,3 +86,4 @@ PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): .long 0x0 /* 8-byte alignment padding */ /* End descriptor */ .popsection +#endif diff --git a/coroutine/arm64/Context.S b/coroutine/arm64/Context.S index 5101c3f75e..2391333cae 100644 --- a/coroutine/arm64/Context.S +++ b/coroutine/arm64/Context.S @@ -90,6 +90,7 @@ PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): #endif #if (defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT != 0) || (defined(__ARM_FEATURE_PAC_DEFAULT) && __ARM_FEATURE_PAC_DEFAULT != 0) +#if defined(__ELF__) /* See "ELF for the Arm 64-bit Architecture (AArch64)" https://github.com/ARM-software/abi-aa/blob/2023Q3/aaelf64/aaelf64.rst#program-property */ # define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1<<0) @@ -122,3 +123,4 @@ PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer): # End descriptor .popsection #endif +#endif