18

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.

4
  • Did you find anything out? Commented Sep 25, 2017 at 2: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. Commented Nov 12, 2017 at 9: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 Commented Feb 8, 2018 at 7:27
  • 6 yrs past no upvoted answer, somebody call some binutils guy to help. Commented Nov 29, 2023 at 9:09

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.