Compare commits

...

2 Commits

Author SHA1 Message Date
Andrew G. Morgan
542d7d86ec Revert "libcap: Add build ldflags to _makenames rule"
This reverts commit c3ddf45d9afaab85d3b7db0dc7bfd1aafb8fde50.

The details of what this broke are here:

  https://bugzilla.kernel.org/show_bug.cgi?id=220691#c2

Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
2025-11-10 18:26:34 -08:00
Will Fancher
d628b3bfe4 Do not cross compile mknames.go
`GOOS` and `GOARCH` can be set to cross compile the Go code. But
`good-names.go` is generated at build time using `mknames.go`, which
must be built for the build platform. `GOOS` and `GOARCH` can be unset
to do this. In many circumstances, Go will use its own internal linker
to build the binary, which means it won't need to use `$CC`. But in
some scenarios, e.g. when building PIE binaries, it will use `$CC` as
the linker, so this needs to be set to the build platform's compiler
for `go run`.

Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
2025-11-10 18:21:52 -08:00
2 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ $(topdir)/libcap/cap_names.h:
$(MAKE) -C $(topdir)/libcap cap_names.h
good-names.go: $(topdir)/libcap/cap_names.h vendor/$(IMPORTDIR)/cap mknames.go
CC="$(CC)" $(GO) run -mod=vendor mknames.go --header=$< --textdir=$(topdir)/doc/values | gofmt > $@ || rm -f $@
CC="$(BUILD_CC)" GOOS= GOARCH= $(GO) run -mod=vendor mknames.go --header=$< --textdir=$(topdir)/doc/values | gofmt > $@ || rm -f $@
diff -u ../cap/names.go $@
PSXGOPACKAGE: vendor/$(IMPORTDIR)/psx ../psx/*.go $(DEPS)

View File

@ -80,7 +80,7 @@ $(PSXTITLE).pc: $(PSXTITLE).pc.in
$< >$@
_makenames: _makenames.c cap_names.list.h
$(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@ $(BUILD_LDFLAGS)
$(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
cap_names.h: _makenames
./_makenames > cap_names.h