diff mbox series

[ada] fix libgnat build on x86_64-linux-gnux32 with glibc <= 2.31

Message ID c12f3e33-3ccc-4c78-20b1-6e64049d74dc@ubuntu.com
State New
Headers show
Series [ada] fix libgnat build on x86_64-linux-gnux32 with glibc <= 2.31 | expand

Commit Message

Matthias Klose Oct. 31, 2022, 3:33 p.m. UTC
This was introduced with the fix and backports of PR103530 on 
x86_64-linux-gnux32 with older glibc versions (checked with 2.31), where dladdr 
is still in the libdl.so library, and not included in libc.so as in newer glibc 
versions.
Linking of libgnat.so fails with

[...]
/usr/x86_64-linux-gnux32/bin/ld: s-trasym.o: in function 
`system__traceback__symbolic__module_na
me__getXnn':
collect2: error: ld returned 1 exit status
make[8]: *** [gcc-interface/Makefile:677: gnatlib-shared-default] Error 1

https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=9d6c63ba490ec92245f04b5cbafc56abd28e8d22

-- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2650,13 +2650,18 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) 
$(target_os))),)
    s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
    s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
    s-taspri.ads<libgnarl/s-taspri__posix.ads \
+  $(TRASYM_DWARF_UNIX_PAIRS) \
+  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
    $(ATOMICS_TARGET_PAIRS) \
    $(X86_64_TARGET_PAIRS) \
+  $(GNATRTL_128BIT_PAIRS) \
    system.ads<libgnat/system-linux-x86.ads

The addition of s-tsmona.adb<libgnat/s-tsmona__linux.adb pulls in the reference 
to dladdr, however not setting MISCLIB to -ldl as on other architectures

Proposed patch:


  PR ada/107475
  * Makefile.rtl: Set MISCLIB for x86_64-linux-gnux32.


    LIBRARY_VERSION := $(LIB_VERSION)

Ok for the trunk and the branches?

Matthias

Comments

Arnaud Charlet Nov. 7, 2022, 1:50 p.m. UTC | #1
> This was introduced with the fix and backports of PR103530 on
> x86_64-linux-gnux32 with older glibc versions (checked with 2.31), where
> dladdr is still in the libdl.so library, and not included in libc.so as in
> newer glibc versions.
> Linking of libgnat.so fails with
> 
> [...]
> /usr/x86_64-linux-gnux32/bin/ld: s-trasym.o: in function
> `system__traceback__symbolic__module_na
> me__getXnn':
> collect2: error: ld returned 1 exit status
> make[8]: *** [gcc-interface/Makefile:677: gnatlib-shared-default] Error 1
> 
> https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=9d6c63ba490ec92245f04b5cbafc56abd28e8d22
> 
> -- a/gcc/ada/Makefile.rtl
> +++ b/gcc/ada/Makefile.rtl
> @@ -2650,13 +2650,18 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu)
> $(target_os))),)
>    s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
>    s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
>    s-taspri.ads<libgnarl/s-taspri__posix.ads \
> +  $(TRASYM_DWARF_UNIX_PAIRS) \
> +  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
>    $(ATOMICS_TARGET_PAIRS) \
>    $(X86_64_TARGET_PAIRS) \
> +  $(GNATRTL_128BIT_PAIRS) \
>    system.ads<libgnat/system-linux-x86.ads
> 
> The addition of s-tsmona.adb<libgnat/s-tsmona__linux.adb pulls in the
> reference to dladdr, however not setting MISCLIB to -ldl as on other
> architectures
> 
> Proposed patch:
> 
> 
>  PR ada/107475
>  * Makefile.rtl: Set MISCLIB for x86_64-linux-gnux32.
> 
> 
> --- a/gcc/ada/Makefile.rtl
> +++ b/gcc/ada/Makefile.rtl
> @@ -2584,6 +2584,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu)
> $(target_os))),)
>    EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
>    EH_MECHANISM=-gcc
>    THREADSLIB=-lpthread -lrt
> +  MISCLIB = -ldl
>    GNATLIB_SHARED=gnatlib-shared-dual
>    GMEM_LIB = gmemlib
>    LIBRARY_VERSION := $(LIB_VERSION)
> 
> Ok for the trunk and the branches?

Yes, thanks.
diff mbox series

Patch

--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2584,6 +2584,7 @@  ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) 
$(target_os))),)
    EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
    EH_MECHANISM=-gcc
    THREADSLIB=-lpthread -lrt
+  MISCLIB = -ldl
    GNATLIB_SHARED=gnatlib-shared-dual
    GMEM_LIB = gmemlib