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=<implementation> 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. --- libgcc/config/arm/sync-cp15dmb.specs | 2 +- libgcc/config/arm/sync-dmb.specs | 2 +- libgcc/config/arm/sync-none.specs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libgcc/config/arm/sync-cp15dmb.specs b/libgcc/config/arm/sync-cp15dmb.specs index 0bb64b97a0d..47bf68b6b99 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 13e59bdd22d..cadad6d4626 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 0aa49602c8b..46071ca7b04 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) -- 2.34.1