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]
This commit is contained in:
KJ Tsanaktsidis 2024-08-19 16:25:09 +10:00 committed by KJ Tsanaktsidis
parent 6a746e1bc9
commit 86c2724e75
Notes: git 2024-08-22 07:36:03 +00:00
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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