Hi all,
I have a CL in review (
https://golang.org/cl/8773) which aims to catch
ABI breaks during runtime initialization.
This is not really so much aimed at people invoking the Go tool for
themselves but more when packages are installed by distribution
packages. If the packager slips up and creates a version of a package
that contains a shared library that can be co-installed with a package
that was built against a version of that shared library with an older
ABI, we want to find out in a loud and obvious way, not by falling
apart at some random point.
So how do we define the ABI of a shared library? My branch:
1) Defines the ABI hash of a package as the SHA1 of the __.PKGDEF for
the package.
2) Defines the ABI hash of a shared library by sorting the contained
packages sort the packages by import path, concatenating the hashes of
the packages and computing the SHA1 of that
This falls on the strict side of the fence -- there are definitely
changes to a package one can make that do not break ABI in any
reasonable sense but will change this, e.g. changing the name of the
argument to an exported function. But that's the better side of the
fence to be on: I am pretty confident that a change that does not
change this file does not break ABI (because it's all the compiler
looks at when compiling a package that imports another). It also
includes the toolchain version, which is also required. Even the
build-id field that
golang.org/cl//9154/ proposes adding is compatible
with this, although that could change (if e.g. the build-id included a
hash of the contents of the source files, we'd need to exclude it from
the abi hash calculation).
But it seems worth asking here: does this sound reasonable? Can you
think of any holes in the above or better ideas?
Cheers,
mwh