Skip to content

cmd/loopvec-toolexec: rewrite default builds on darwin, ios, android and windows - #9

Open
thesyncim wants to merge 2 commits into
mauri870:masterfrom
thesyncim:toolexec-default-pie
Open

thesyncim wants to merge 2 commits into
mauri870:masterfrom
thesyncim:toolexec-default-pie

Conversation

@thesyncim

@thesyncim thesyncim commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

On macOS the wrapper never rewrites anything. darwin builds PIE by default, the go command passes -shared to every compile, and -shared is on the unsupported list. The same goes for windows, ios and android (they're the targets where internal/platform.DefaultPIE is true). Seven of the eight toolexec scripts fail on macOS because of it.

The concern with -shared is that the nested simd build wouldn't match. But when PIE is the target's default, the nested build is PIE too. So -shared is now accepted when GOOS, which the go command sets for its tools, is one of those four. Anywhere else, an explicit -buildmode=pie is still skipped. toolexec_buildmode_pie.txt covers both sides: a default darwin build is rewritten and prints the same output, and -buildmode=pie on linux is skipped.

toolexec_tests_simd_dependency still fails on macOS, because it reads the parent go command from /proc. I left that alone.

Without this I couldn't use the wrapper on goav1 on a Mac at all.

@thesyncim
thesyncim force-pushed the toolexec-default-pie branch from 7f2af16 to 5403ba1 Compare November 1, 2026 13:36
mauri870 added a commit that referenced this pull request Nov 3, 2026
`flag_diff.txt` fails on macOS. The `-d` headers carry `diff`'s
timestamp, and BSD diff prints it differently from GNU diff (no
fractional seconds, no zone). It's the timestamp of a temp file anyway,
so it doesn't tell the reader anything.

This passes `-L path` for both sides (GNU, BSD and busybox diff all have
it), so the headers are just `--- path` / `+++ path` like `gofmt -d`,
and the filename replacement goes away. The four diff scripts now expect
the path alone.

It's one of three small fixes to get the suite passing on macOS, along
with #8 and #9, which I needed while trying loopvec on
[goav1](https://github.com/thesyncim/goav1).

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
@mauri870
mauri870 enabled auto-merge (squash) November 3, 2026 21:32
@mauri870

mauri870 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Thanks! I have to admit that I haven't tested on mac or windows at all, nor CI does it. Appreciate you looking into it.

…and windows

The wrapper leaves a package alone when its compile has -shared, since
the nested build of simd and its dependencies would not match its
objects. But -shared is also how the go command compiles a
position-independent executable, the default build mode on darwin, ios,
android and windows. There every default build was left alone, so
loopvec-toolexec rewrote nothing on macOS, and seven of the toolexec
scripts failed there.

On those targets the nested build is position-independent by default
too, so -shared is accepted. Elsewhere, where -buildmode=pie must be
asked for, it still leaves the package alone, as
toolexec_buildmode_pie.txt checks on linux. The go command sets GOOS for
the tools it runs.
auto-merge was automatically disabled November 4, 2026 15:33

Head branch was pushed to by a user without write access

@thesyncim
thesyncim force-pushed the toolexec-default-pie branch from 48c6bf9 to 42b58b8 Compare November 4, 2026 15:33
mauri870 pushed a commit that referenced this pull request Nov 4, 2026
The runners have moved to ubuntu-26.04, so this is the qemu part of #1
you said you'd take when that happened. `qemu-user-static` has no
installation candidate there, so every PR now fails at that step and the
arm64 runs, the golden check, fmt and lint get skipped. You can see it
on #7, #9 and #19, where Build, Test and the amd64 tsvc run all pass
first. master's last run predates the move, so the next push will hit it
too.

`qemu-user` has the static emulators on 26.04, just without the
`-static` names, so this installs that and links `qemu-aarch64-static`
when it's missing, since the Makefile runs that name. It's been passing
on my fork's ubuntu-26.04 runners, and this PR's own CI runs it too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants