1
0
Files
gcc-14/debian/patches/ada-armel-libatomic.diff
Konstantin Demin c2c1923c7b initial import from Debian
version: 14.3.0-5
commit: bee30ab0fff2fd6af94c62376c8aa4221bb831e0
2025-08-11 15:00:09 +03:00

91 lines
3.6 KiB
Diff

Description: link libgnarl with libatomic on armel and sparc
On other architectures, the library is ignored thanks to --as-needed.
.
Seen with 14-20240429-1 on armel:
cd rts; [bla]/./gcc/xgcc [bla] -shared [bla] -o libgnarl-14.so [bla]
/usr/bin/arm-linux-gnueabi-ld: libgnat-14.so: undefined reference to `__atomic_compare_exchange_8'
/usr/bin/arm-linux-gnueabi-ld: libgnat-14.so: undefined reference to `__atomic_load_8'
.
Seen with 13.2.0-25 on sparc:
checking fp.h usability... /usr/sparc-linux-gnu/bin/ld: libgnat-13.so: undefined reference to `__atomic_compare_exchange_8'
.
Libatomic becomes an artificial dependency for Ada in Makefile.def,
so a better solution is welcome.
.
Autogen should refresh src/Makefile.in from src/Makefile.{def,tpl}
at build time, but we do not want to Build-Depend: guile.
# export QUILT_PATCHES=debian/patches
# quilt pop $this.diff
# quilt add src/Makefile.in
# (cd src && autogen Makefile.def)
# quilt refresh --no-timestamps --no-index -pab
# quilt push -a
.
The issue is hidden without -Wl,--no-allow-shlib-undefined.
(ada-gnattools-cross.diff adds checking options to LDFLAGS,
then adds LDFLAGS to the command line).
Bug-Debian: https://bugs.debian.org/861734
Bug-Debian: https://bugs.debian.org/1072071
Author: Matthias Klose <doko@debian.org>
Author: Nicolas Boulenguez <nicolas@debian.org>
--- a/src/gcc/ada/Makefile.rtl
+++ b/src/gcc/ada/Makefile.rtl
@@ -2302,6 +2302,7 @@ endif
# ARM linux, GNU eabi
ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
+ MISCLIB = ../../../$(target_alias)/libatomic/.libs/libatomic.so
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
@@ -2375,6 +2376,7 @@ endif
# SPARC Linux
ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
+ MISCLIB = ../../../$(target_alias)/libatomic/.libs/libatomic.so
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
--- a/src/Makefile.def
+++ b/src/Makefile.def
@@ -417,6 +417,8 @@ dependencies = { module=all-target-libad
dependencies = { module=all-gnattools; on=all-target-libada; };
dependencies = { module=all-gnattools; on=all-target-libstdc++-v3; };
+dependencies = { module=all-target-libada; on=all-target-libatomic; };
+
// Depending on the specific configuration, the LTO plugin will either use the
// generic libiberty build or the specific build for linker plugins.
dependencies = { module=all-lto-plugin; on=all-libiberty; };
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -68678,6 +68678,9 @@ configure-m4: stage_last
@endif gcc-bootstrap
@if gcc-bootstrap
+@unless target-libatomic-bootstrap
+all-target-libada: maybe-all-target-libatomic
+@endunless target-libatomic-bootstrap
@unless target-zlib-bootstrap
configure-target-fastjar: maybe-configure-target-zlib
@endunless target-zlib-bootstrap
@@ -68713,6 +68716,7 @@ configure-target-libgo: maybe-all-target
@unless gcc-bootstrap
all-target-libada: maybe-all-gcc
all-gnattools: maybe-all-target-libstdc++-v3
+all-target-libada: maybe-all-target-libatomic
configure-libcc1: maybe-configure-gcc
all-libcc1: maybe-all-gcc
all-c++tools: maybe-all-gcc
--- a/src/gcc/ada/gcc-interface/Makefile.in
+++ b/src/gcc/ada/gcc-interface/Makefile.in
@@ -714,6 +714,7 @@ gnatlib-shared-default:
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(hyphen)$(LIBRARY_VERSION).so \
+ $(MISCLIB) \
$(THREADSLIB)
cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnat$(soext)