[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in dynamic linker ld 2.37.20211103-150100.7.29

From: pierre.lauber
Subject: Bug in dynamic linker ld 2.37.20211103-150100.7.29
Date: Fri, 10 Jun 2022 15:37:03 +0000

Dear Sir or Madam,

with an update of a linux distribution, the output executable fails always.
The linker does not report any error/warning and it's exit status is zero.
Using the linker ld of the old version with identical input (object + library files
and command line arguments), the output executable works.
See version details attached below.

We are using an old Intel Fortran 77 compiler (licensed non-commercial).
This compiler was made around the year 2005 and is in the point of view of object and
executable formats not really old. It already generates 64 bit objects.
To run this compiler an gcc version 4.8 has to be installed. Attached you will find
for simplicity the required libraries and objects for later use below.
This Fortran compiler sub-calls the linux system assembler as and dynamic linker ld from binutils.
During updating of the linux distro, the Fortran compiler does not change the dynamic linker
ld command line due to it's own unchanged installation.
The object files the compiler generates are still the same.
The only which slightly changed are some crt*.o files from the new distro which are linked in.
The old ld is still working with the new crt*.o files from the new distro.

Mounting and chrooting into a backup filesystem with the old state, I was mixing the
object files from the old and the new distro keeping all the rest of the command line the same.
It does not depend on the object files. The new dynamic linker ld shows always two bugs:
1. The output executables fails (depending of calling from the command line or within the
  gdb debugger mostly by SIGSEGV or exit code 8, issuing sometimes
  'forrtl: severe (48): invalid argument to FORTRAN Run-Time Library'
  which arises due to the signal handling of the compiler.
2. The linker does not report any warning, error or exit status of unequal zero.
If something strange is happening I expect a least some warnings during linking and an exit
status unequal zero for executables which are not runnable, especially with wrong lib versions.
The verbose linker output shows up only new supported binary files formats
brought in by the update of the libbfd (See diff below).
Assuming the linker supports all the older binary file formats, it should be capable to
link all things together correctly. If something would be bad it should report it at least.

The following second command line (taken in principle from the Intel Fortran verbose output)
generates the bad executable.
bash> cd /tmp; tar -xpzf ~/objects+libraries.tgz # Intel Fortran plus gcc-4.8 libraries
bash> cd /tmp/tmp2; ld.bfd crt1.o crti.o crtbegin.o --eh-frame-hdr -dynamic-linker ld-2.31.so -o a.out for_main.o test.o -L/tmp/tmp2 -L/lib64 -Bstatic -lsvml -lifport -lifcore -Bdynamic -limf -lm -Bstatic -lirc -Bdynamic -lgcc_s -Bdynamic -lc -lgcc_s -Bstatic -lirc_s crtend.o crtn.o

Only prefixing ld.bfd by the path to the old ld.bfd, the output executable is working again
(Ok, I had to copy the old libbfd...so to a location where the old ld.bfd can find it).
What is different?
- All linked in object/library files are the same.
- The command line is the same.
- The binary PATH and library LD_LIBRARY_PATH environment variables are the same.
- Apart from the other linker binary ld.bfd, the loader takes the different version of the libbfd.
- Nothing else is different.
The problem must be located where there are differences. This is in the new linker binary or
it's new used libraries.

Checks done, without any effect or giving something special/new
- Removing the entire environment using env -i from the calling command.
- All referenced shared object or binary files are really there, everything is found.
- strace especially checking the accessed files.
- Replacing ld.bfd by the LLVM ld.lld ! (libbfd statically linked?)
- Two full force reinstall packages of the entire OpenSuse distro, especially not any problem
  with broken dependencies.
- File system state is clean.
- In the new version some linux system libraries changed. But this is not relevant because the
  old linker gives a working executable with the above command line on the old and new libraries.
- Clean power down and ups of the machine etc.

Hope this helps for fixing.
If you have any questions do not hesitate to contact me.

Best regards,

P.S.: New things do not help if old things do no longer work.
The ld --verbose output differs only in the following
< GNU ld (GNU Binutils; SUSE Linux Enterprise 15) 2.37.20211103-150100.7.29
> GNU ld (GNU Binutils; SUSE Linux Enterprise 15)
<    elf64briscv
<    elf64briscv_lp64f
<    elf64briscv_lp64
<    elf32briscv
<    elf32briscv_ilp32f
<    elf32briscv_ilp32
... some changes in the comments only and
<   .debug_addr     0 : { *(.debug_addr) }
<   .debug_line_str 0 : { *(.debug_line_str) }
<   .debug_loclists 0 : { *(.debug_loclists) }
>   /* DWARF Extension.  */
<   .debug_names    0 : { *(.debug_names) }
<   .debug_rnglists 0 : { *(.debug_rnglists) }
<   .debug_str_offsets 0 : { *(.debug_str_offsets) }
<   .debug_sup      0 : { *(.debug_sup) }
>   .debug_addr     0 : { *(.debug_addr) }
< ld.bfd: mode elf_x86_64
> /mnt/aiuli3-16.5.2022/usr/bin/ld.bfd: mode elf_x86_64
Version details:

Linux distribution (from cat /etc/os-release): OpenSuse Leap 15.3
What I call here "new": OpenSuse 15.3, Repository update to 07.06.2022
What I call here "old": OpenSuse 15.3, only some months before "new". It was running all the years before.

# Versions of used programs/libraries/packages
# NEW:
ld -v
GNU ld (GNU Binutils; SUSE Linux Enterprise 15) 2.37.20211103-150100.7.29
uname -a
Linux aiuli3 5.3.18-150300.59.68-default #1 SMP Wed May 4 11:29:09 UTC 2022 (ea30951) x86_64 x86_64 x86_64 GNU/Linux
gcc -v
gcc version 7.5.0 (SUSE Linux) 

# OLD:
ld -v
GNU ld (GNU Binutils; SUSE Linux Enterprise 15)
# uname -a # no longer accessible
grep vmlinuz /boot/grub2/grub.cfg
gcc -v
gcc version 7.5.0 (SUSE Linux) 

# gcc-4.8 install packages (for above test all the needed libraries are in the attached file):
libasan0-4.8.5-192.1.x86_64.rpm libmpfr4-3.1.2-11.53.x86_64.rpm compat-libmpc-1.0.1-3.el7.x86_64.rpm libmpfr1-2.3.2-3.8.x86_64.rpm cpp48-4.8.5-192.1.x86_64.rpm libcloog-isl4-0.18.4-23.2.x86_64.rpm libisl10-0.12.2-1.36.x86_64.rpm gcc48-4.8.5-192.1.x86_64.rpm libstdc++48-devel-4.8.5-192.1.x86_64.rpm gcc48-c++-4.8.5-192.1.x86_64.rpm
/opt/intel/fce/9.0/bin/ifort -v
Version 9.0 
cat ~/test.f # compiled object in the attached file
C /opt/intel/fce/9.0/bin/ifort test.f

      WRITE(*,*)'HELLO WORLD1.'
      WRITE(*,*)'HELLO WORLD2.'
      WRITE(*,*)'HELLO WORLD3.'
      WRITE(*,*)'HELLO WORLD4.'

c     STOP
'forrtl: severe (48): invalid argument to FORTRAN Run-Time Library'
From intel Website: FOR$IOS_INVARGFOR. The compiler passed an invalid or
improperly coded argument to the IntelĀ® Fortran RTL. This can occur if the
compiler is newer than the RTL in use.

Pierre Lauber                  eMail:    pierre.lauber@aiub.unibe.ch
Astronomical Institute         www:      http://www.aiub.unibe.ch/
University of Berne            Phone:    +41 31 684 91 95 (Switchboard)
Sidlerstrasse 5                Phone:    +41 31 684 85 87 (Office)
CH-3012 Bern, Switzerland

Attachment: objects+libraries.tgz
Description: objects+libraries.tgz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]