On Fri, 26 Nov 2021 at 22:10:45 -0800, Otto Kekäläinen wrote:
> Lintian in Debian unstable has a new test that my package is failing on:
> https://lintian.debian.org/tags/no-code-sections

As with any Lintian tag, I would recommend doing your own assessment
of whether this is a real error before assuming there is a bug that you
need to fix.

This particular one looks like it's a Lintian bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000469 (fixed in git)

Looking at the results reported with current Lintian, it seems to me
that this check was initially assuming that every object file (.o) in
a static library is expected to contain at least some executable code,
but I don't think that's really true:

* some translation units end up effectively empty, because they contain
  only functions that are #ifdef'd out under the build options in use,
  for example SDL_evdev_kbd_freebsd.o in a Linux build of libSDL2.a

* some translation units contain global variables but no executable code,
  for example (guessing from its name) decomposition-table.o in libunistring

The resolution in Lintian git was to make this check only trigger if
*the entire static library* contains no executable code, which seems
reasonable (and in the rare case that a static library intentionally
contains only variables and no code, it would be appropriate for a
maintainer who knows that to override the hint).

If feasible, an excellent way to verify that a static library is
practically usable would be to add an autopkgtest that statically links
a simple executable that calls one of your library's functions, and then
runs that executable. If you add a test like this, please remember to
flag it as 'superficial' to indicate that it doesn't provide thorough
test coverage.

    smcv

Reply via email to