Page MenuHomeFreeBSD

dtrace/tests: compile D sources at runtime on test target
ClosedPublic

Authored by siva on Aug 20 2026, 4:15 AM.
Tags
None
Referenced Files
F174906642: D59030.diff
Tue, Oct 6, 9:43 PM
F174885733: D59030.id185641.diff
Tue, Oct 6, 6:42 PM
Unknown Object (File)
Mon, Oct 5, 3:55 PM
Unknown Object (File)
Sun, Oct 4, 4:45 PM
Unknown Object (File)
Fri, Oct 2, 7:41 AM
Unknown Object (File)
Fri, Oct 2, 7:24 AM
Unknown Object (File)
Tue, Sep 29, 11:59 AM
Unknown Object (File)
Mon, Sep 28, 12:27 PM
Subscribers

Details

Summary

Previously, we would precompile D test dependencies using the
host's dtrace, which unconditionally outputs ELF files in the
host's format. This breaks the cross-compile build with errors
like the following:

dtrace: failed to link script: incorrect ELF machine type for
object file: tst.usdt.pieo

  • usdt.o ---
  • Failed target: usdt.o

This patch moves compilation to runtime for all C-based testcases
that have a dependent D source file.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

siva requested review of this revision.Aug 20 2026, 4:15 AM

This is fine I guess, but ideally dtrace would support cross-compilation. It'd take some work though: to start, dt_link.c would need some notion of a target platform where today it uses ifdefs. I don't object to your approach though, if it solves some immediate problem.

cddl/usr.sbin/dtrace/tests/tools/dtest.sh
59

There should be some comment explaining what this is doing, and why.

cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
70

Can't we just set this to ${TFILES} ${CFILES} in each makefile? That should make the diff smaller.

cddl/usr.sbin/dtrace/tests/tools/dtest.sh
59

Hope this is sufficient. Yeah I'd like to get the tests running on all archs first, this is just a short term fix.

cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
70

Good idea, thanks!

This revision is now accepted and ready to land.Aug 25 2026, 6:03 PM