https://gcc.gnu.org/g:0204dcf930b5093d0811a007b7f47aa42e55e787

commit r15-7258-g0204dcf930b5093d0811a007b7f47aa42e55e787
Author: Richard Earnshaw <rearn...@arm.com>
Date:   Tue Jan 28 16:14:35 2025 +0000

    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=<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.

Diff:
---
 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 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)

Reply via email to