You are not logged in.

#1 2023-02-01 21:57:54

jghodd
Member
From: Jetersville, VA
Registered: 2019-07-14
Posts: 54

libbfd.so producing ldconfig warnings

I had been seeing the following message recently:

ldconfig: /usr/lib/libbfd.so is not an ELF file - it has the wrong magic bytes at the start

so I checked out /usr/lib/libbfd.so and it turns out it's a text file, containing the following:

[root@bslxhp32 lib]# cat libbfd.so 
INPUT( /usr/lib/libbfd.a -lsframe -liberty -lz -lzstd -ldl )

I double-checked this file against the 64-bit version, and archlinux's libbfd.so is exactly the same, so the package build is right (which I confirmed with my own rebuild), but I don't see the linker warning on my 64-bit archlinux system (I'm assuming it's a warning since so far it hasn;t seemed to crash anything). Any thoughts as to why the difference between the 2 systems, and is there any way to silence the warnings (the 2 questions may have the same answer)?

Last edited by jghodd (2023-02-01 22:00:56)

Offline

#2 2023-02-02 07:57:03

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 856
Website

Re: libbfd.so producing ldconfig warnings

Yeah, noticed that to. libbfd.so is a linker script file on 32-bit and upstream on 64-bit. Calling ldconfig on 64-bit doesn't show this warning, 32-bit does.
Both versions of ldconfig from glibc are 2.36 (package 2.36-7). glibc 2.37 is in testing, so let's wait and see if the error persists.
This is something ldconfig should know and not treat linker scripts like ELF libraries.. :-)

Offline

#3 2023-02-02 23:21:48

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 1,194

Re: libbfd.so producing ldconfig warnings

On my 32-bit system, I've not yet updated this year because I've nun out of space in my /usr partiton, and have glibc2.36-6.0. That doesn't report errors either.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

#4 2023-02-03 07:54:16

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 856
Website

Re: libbfd.so producing ldconfig warnings

glibc/src/glibc/elf/ldconfig.c:

elf_header = (ElfW(Ehdr) *) file_contents;
  if (memcmp (elf_header->e_ident, ELFMAG, SELFMAG) != 0)
    {
      /* The file is neither ELF nor aout.  Check if it's a linker
         script, like libc.so - otherwise complain.  Only search the
         beginning of the file.  */
      size_t len = MIN (statbuf.st_size, 512);
      if (memmem (file_contents, len, "GROUP", 5) == NULL
          && memmem (file_contents, len, "GNU ld script", 13) == NULL
          && !is_gdb_python_file (file_name))
        error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
               file_name);
      ret = 1;
    }

So, libbfd is just a little bit older and the signature "GNU ld script" is missing in the beginning.
So, we have to rebuild libbfd for the error to go away.
Still, this is not a real problem but rather a cosmetic bug..
There is also the possibility that 32-bit and 64-bit have different linker scripts and nobody bothers
to adapt the 32-bit version.. :-)

Offline

#5 2023-02-03 07:59:55

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 856
Website

Re: libbfd.so producing ldconfig warnings

# No shared linking to these files outside binutils
  rm -f "$pkgdir"/usr/lib/lib{bfd,opcodes}.so
  echo 'INPUT( /usr/lib/libbfd.a -lsframe -liberty -lz -lzstd -ldl )' > "$pkgdir/usr/lib/libbfd.so"
  echo 'INPUT( /usr/lib/libopcodes.a -lbfd )' > "$pkgdir/usr/lib/libopcodes.so"

So the bug is in the upstream PKGBUILD, why we have a newer version than upstream
is unclear to me though..

I'll open a bug upsteam..

Offline

#6 2023-02-03 08:05:59

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 856
Website

Re: libbfd.so producing ldconfig warnings

Offline

Board footer

Powered by FluxBB