There is a software package elfutilsthat includes a program called eu-elflintfor checking ELF binaries (just like lintfor C - hence the name).
Just for curiosity, I checked our own shared libraries with this tool and found many problems, for example:
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 cross validation, I created a very trivial shared library from the source code below
int foo(int a) {
return a + 1;
}
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 a trivial example also shows a lot of problems.
BTW: I'm on Ubuntu-Karmic-32bit with gcc v4.4.1
By the way: ... the same thing happens on Debian-Lenny-64bit with gcc v4.2.4
Is this something I should worry about?
anon