22

downloaded and compiled glibc-2.13. when i try to run a sample C program which does a malloc(). I get following error elf file OS ABI invalid

Can anybody please pass my any pointer helpful in resolving this issue.Please note that my kernel version is linux-2.6.35.9

Srinivas
  • 1,780
  • 1
  • 14
  • 27
Kapil
  • 836
  • 2
  • 8
  • 20
  • That's a bit short on information. Are you sure you're linking & running against that libc? – Mat Oct 04 '11 at 12:26

4 Answers4

34

It's not your kernel version that's the problem.

The loader on your system does not support the new Linux ABI. Until relatively recently, Linux ELF binaries used the System V ABI. Recently, in support of STT_GNU_IFUNC, the Linux ABI was added. You would have to update your system C library to have a loader that support STT_GNU_IFUNC, and then it will also recognize ELF objects with the Linux ABI type.

See Dave Miller's blog entry on STT_GNU_IFUNC for Sparc (archived) to gain an understanding of what STT_GNU_IFUNC does, if you care.

zman0900
  • 379
  • 2
  • 12
mkj
  • 1,274
  • 11
  • 8
  • 2
    Hey thanks mkj. That was a good piece of information. I just replaced the ld-linux.so (basically, ld-2.13.so) and things started working for me. Just in case you are curious, my setup is like that i have created a linux-diskless target and running it on virtual box. The problem started appearing when in the root-fs i had replaced libc.so.6 (glibc-2.9 or so) to libc.so.6 (glibc-2.13).And on comparing the OS-ABI of previous libc.so.6 it showed "system V", where the newer one had "Linux", as you said. – Kapil Oct 05 '11 at 05:59
  • 1
    Ah, I didn't realize you had replaced the system C library without also replacing the loader, or I would have been more specific in my advice. I had assumed you were doing something like using LD_LIBRARY_PATH to load an alternative library. Glad to have helped! – mkj Oct 05 '11 at 14:28
5

If you get your hands in the loader from a newer system, you might be able to make it work using that. But you'll have to carry the loader wherever your program go. You can either compile your program to use that loader as explained here, or compile your program and patch it later using patchelf, in a way similar to what I mention here. I was able to run a program that was giving me the OS ABI invalid error on a linux 2.6.18 (older than yours) that had ld-2.5.so, by copying a ld-2.15.so from somewhere else.

NOTE: do NOT overwrite your system ld*.so or ld-linux. ;-/

msb
  • 3,899
  • 3
  • 31
  • 38
3

It is possible your glibc was built with the --enable-multiarch flag that forced using ifunc and new LINUX ABI

keyser
  • 18,829
  • 16
  • 59
  • 101
cyberzx
  • 31
  • 1
2

From what I can tell is that --enable-multiarch is the default setting and you should disable it by setting --enable-multiarch=no.

Oliver R.
  • 283
  • 4
  • 6