[debhelper-devel] Bug#789351: Bug#789351: please strip .comment sections from static libraries

Helmut Grohne helmut at subdivi.de
Sat Jun 20 21:03:32 UTC 2015


On Sat, Jun 20, 2015 at 12:59:40PM +0200, Niels Thykier wrote:
> As discussed on #debian-devel, I am open to the change.  However, it
> seems that (at least) OCaml is storing bytecode in the .comment section
> of its binaries (presumably including static libraries).

To validate this conjecture, I collected all .comment and .note sections
from sid amd64. I looked at all files matching lib*.a, but not *_g.a
(like dh_strip), obtained a section listing using objdump -h and dumped
all .comment and .note sections using readelf -p where available.

For the time being, you can find the collected data at
http://subdivi.de/~helmut/static_lib_comment_and_note_sections.tar.xz.

The vast majority of .comments is gcc, ghc and clang versions. Further
analysis of .comment sections can lead to amusement or depression. In
any case, I was not able to find bytecode in them. In particular, it
seems that OCaml libraries generally lack .comment sections unless they
contain C code.

> I think we need a (cheap and "fairly") reliable indicator of whether
> something is likely to be an OCaml (etc.) static lib, which is storing
> bytecode or other "important" data in these sections.
> 
> Other languages that /might/ be doing something similar:
> 
>  * Haskell
>  * Go
>  * ... ?

Given my findings, I believe that there is no need to take special
measures here.

Do you agree with the observation methodology?

Helmut




More information about the debhelper-devel mailing list