13

The question is in the context of the following question: Why are libraries not found, even though they are clearly on the -L path? . It seems that my libraries and my object file have a different ELF format, which might cause the linker to not "find" the libraries.

Now, this leads to a couple of questions:

  1. It seems that my compiler normally generates SYSV ELF files. (Checked with file). However, for that particular C++ source, it generates a Linux/GNU ELF object file. I wonder why, so I reduced that source to an empty main method - and suddenly I get a SYSV object file. What inside a C++ source file can cause the compiler to switch the ELF format?

  2. Is it true or false that I can not link Linux/GNU together with SYSV ELF?

  3. Is there an option to force the compiler to create a certain ELF format?

I'm working with a Cray g++ (GCC) 5.3.0 20151204.

Michael
  • 7,407
  • 8
  • 41
  • 84
  • Did you find anything out? – Dustin Oprea Sep 25 '17 at 02:23
  • @DustinOprea: Not really. The problem had a completely different cause. But since it finally worked without solving the SYSV issue, I conclude that it's probably possible to link the formats together. – Michael Nov 12 '17 at 09:33
  • I was going down this path as well, having a loader 'symbol lookup error' though the symbol is plainly in the right .so and the 'linkee' is showing the right file per ldd – Geof Sawaya Feb 08 '18 at 07:27

1 Answers1

0

Regarding question 1: one of the answer seems to be that functions of type STT_GNU_IFUNC will cause the compiler/linker to switch the ELF file format of the corresponding object file from SYSV to GNU/Linux.

However, I still couldn't find out how I can identify functions in an object file which have type STT_GNU_IFUNC. Looking at object files which are GNU/Linux with objdump, readelf and nm still don't show a single function of type STT_GNU_IFUNC.

Some more information on STT_GNU_IFUNC can be found at https://www.airs.com/blog/archives/403 and in the following related question: How do I compile on linux to share with all distributions?