diff options
author | Fabian Meumertzheim <fabian@meumertzhe.im> | 2021-10-16 23:52:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-16 15:52:42 -0600 |
commit | f4c5bd72dacd89085c011b0f6fdea59400f9eee8 (patch) | |
tree | f5fc899efc2d7adb29fc4da857446947fda82c2e /CONTRIBUTORS | |
parent | 027d78bed3952d73c6fb7099b3247f903aa7318d (diff) | |
download | bazelbuild-rules_go-f4c5bd72dacd89085c011b0f6fdea59400f9eee8.tar.gz |
Emit correct header in CGo c-archive (#2874)
A go_binary target with linkmode c-archive emits only a single
_cgo_exports.h header instead of all such headers of all transitive
dependencies.
Currently, this header is taken to be the first element in a list
obtained from the depset of these transitive _cgo_exports.h files
via to_list(). While deterministic, this choice is not guaranteed to
give the correct _cgo_exports.h (i.e., the one of the go_binary
itself) as the depset iteration order is not specified.
This commit ensures that the _cgo_exports.h of the target itself is
added as the first element of the `direct` list of a depset with
iteration order specified as `preorder` and will thus always be the
first element when the depset is converted to a list.
The commit adds a testcase that does not compile without it:
If a Go library that depends on a CGo library (in this case x/sys/unix)
is itself depended on by a cc_library as a c-archive, the emitted CGo
header is that of the CGo library, not the Go library itself.
Diffstat (limited to 'CONTRIBUTORS')
-rw-r--r-- | CONTRIBUTORS | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d14036aa..4315c06f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -14,6 +14,7 @@ Brian Silverman <bsilver16384@gmail.com> Damien Martin-Guillerez <dmarting@google.com> David Chen <dzc@google.com> David Santiago <david.santiago@gmail.com> +Fabian Meumertzheim <fabian@meumertzhe.im> Han-Wen Nienhuys <hanwen@google.com> Ian Cottrell <iancottrell@google.com> Jake Voytko <jake@reviewninja.com> |