views:

191

answers:

1

There is a software package elfutils which includes a program called eu-elflint for checking ELF binaries (just as lint for C - hence the name).

Just for curiosity I have checked our own shared libraries with this tool and it found a lot of issues, e.g.:

eu-elflint libUtils.so

section [ 2] '.dynsym': _DYNAMIC symbol size 0 does not match dynamic segment size 248
section [ 2] '.dynsym': _GLOBAL_OFFSET_TABLE_ symbol size 0 does not match .got.plt     section size 3076
section [ 8] '.rel.plt': relocation 0: offset out of bounds
section [ 8] '.rel.plt': relocation 1: offset out of bounds
...
section [ 8] '.rel.plt': relocation 765: offset out of bounds

As a crosscheck I have build a very trivial shared library from the source code below

int foo(int a) {
   return a + 1;
}

// gcc -shared -fPIC -o libfoo.so foo.c

And tried again ...

eu-elflint libfoo.so

section [ 9] '.rel.plt': relocation 0: offset out of bounds
section [ 9] '.rel.plt': relocation 1: offset out of bounds
section [23] '.comment' has wrong flags: expected none, is MERGE|STRINGS
section [25] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol size 0 does not match .got.plt section size 20
section [25] '.symtab': _DYNAMIC symbol size 0 does not match dynamic segment size 200

As you can see even the trivial example also shows a lot of issues.

BTW: I am on Ubuntu-Karmic-32bit with gcc v4.4.1

BTW: ... the same happens on Debian-Lenny-64bit with gcc v4.2.4

Is this something I should be concerned about?

+5  A: 

Quick answer: "Is this something I should be concerned about?" No.

Longer answer: elflint checks not only ABI standards, but also some ELF conventions. Both ABIs and ELF conventions change over time: ABIs are extended, and have to remain backward compatible, and ELF conventions do evolve over time (to get new features, mainly). As a consequence, elflint's expectations have to be kept in sync with what your assembler/linker (the GNU binutils in this case) produce. You can find lots of reports to elflint about new ELF extensions introduced in GNU binutils, and for which elflint only catches later on. Thus, it's most probable that you have a version of elflint that is too old for your installed binutils. As elflint is not so much used, it wouldn't surprise me that a linux distro doesn't keep those two in sync so well.

FX