From: Richard Earnshaw Date: Tue, 28 Jan 2025 16:14:35 +0000 (+0000) Subject: arm: libgcc: make -spec=sync-*.specs compatible with LTO [PR118642] X-Git-Tag: basepoints/gcc-16~2295 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0204dcf930b5093d0811a007b7f47aa42e55e787;p=thirdparty%2Fgcc.git arm: libgcc: make -spec=sync-*.specs compatible with LTO [PR118642] The arm-none-eabi port provides some alternative implementations of __sync_synchronize for different implementations of the architecture. These can be selected using one of -specs=sync-{none,dmb,cp15dmb}.specs. These specs fragments fail, however, when LTO is used because they unconditionally add a --defsym=__sync_synchronize= to the linker arguments and that fails if libgcc is not added to the list of libraries. Fix this by only adding the defsym if libgcc will be passed to the linker. libgcc/ PR target/118642 * config/arm/sync-none.specs (link): Only add the defsym if libgcc will be used. * config/arm/sync-dmb.specs: Likewise. * config/arm/sync-cp15dmb.specs: Likewise. --- diff --git a/libgcc/config/arm/sync-cp15dmb.specs b/libgcc/config/arm/sync-cp15dmb.specs index 0bb64b97a0da..47bf68b6b99c 100644 --- a/libgcc/config/arm/sync-cp15dmb.specs +++ b/libgcc/config/arm/sync-cp15dmb.specs @@ -1,4 +1,4 @@ %rename link sync_sync_link *link: ---defsym=__sync_synchronize=__sync_synchronize_cp15dmb %(sync_sync_link) +%{!nostdlib|lgcc: --defsym=__sync_synchronize=__sync_synchronize_cp15dmb} %(sync_sync_link) diff --git a/libgcc/config/arm/sync-dmb.specs b/libgcc/config/arm/sync-dmb.specs index 13e59bdd22d9..cadad6d4626b 100644 --- a/libgcc/config/arm/sync-dmb.specs +++ b/libgcc/config/arm/sync-dmb.specs @@ -1,4 +1,4 @@ %rename link sync_sync_link *link: ---defsym=__sync_synchronize=__sync_synchronize_dmb %(sync_sync_link) +%{!nostdlib|lgcc: --defsym=__sync_synchronize=__sync_synchronize_dmb} %(sync_sync_link) diff --git a/libgcc/config/arm/sync-none.specs b/libgcc/config/arm/sync-none.specs index 0aa49602c8b6..46071ca7b04b 100644 --- a/libgcc/config/arm/sync-none.specs +++ b/libgcc/config/arm/sync-none.specs @@ -1,4 +1,4 @@ %rename link sync_sync_link *link: ---defsym=__sync_synchronize=__sync_synchronize_none %(sync_sync_link) +%{!nostdlib|lgcc: --defsym=__sync_synchronize=__sync_synchronize_none} %(sync_sync_link)