Skip to content

dat: fix symbol ordering, format generated source in-place - #3593

Merged
ribbanya merged 1 commit into
doldecomp:masterfrom
ribbanya:pr/dat
Sep 30, 2026
Merged

ribbanya merged 1 commit into
doldecomp:masterfrom
ribbanya:pr/dat

Conversation

@ribbanya

@ribbanya ribbanya commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
  • No header code in base objects: jobj.h redeclared the static inline HSD_JObjRefThis without inline, which made clang emit it (and iref_INC, with its assert's file name) wherever the header is included. samples report lists anything a base object has outside .data.
  • The base object's .data is laid out in the target's order, so objdiff's section match agrees with the per-symbol one. clang lays variables out where an initializer first points to them, not where they are defined, so each unit is compiled with -fdata-sections and linked (ld.lld -r) with target/.ld, which samples slice writes. Every unit's .data bytes now equal the target's.
  • Formatting in place: codegen writes src/ and the format step formats it there, with a stamp in stamp/, so there is one set of generated sources.

Also:

  • The build runs without the dev shell's environment, as objdiff runs it: NEWLIB_INCLUDE and AURORA_SRC are cached (from the environment when set; configuring without them fails), and the LLVM tools and cargo are found by absolute path. Configuring through a symlinked path fails: the build then names files by two paths, and ninja reran CMake and rebuilt everything on every build.
  • User-side switches in the build's cache: MELEE_DAT_SAMPLES_ALL (archive globs) samples every typed object of those archives, and MELEE_DAT_SAMPLES_EXCLUDE (type globs) keeps types out of the samples.
  • objdiff is pinned to v3.8.2, which no longer needs the Cargo.lock patch.

11237 of 11239 samples match, as before; the DOL still matches.

- No header code in base objects: jobj.h redeclared the static inline
  HSD_JObjRefThis without `inline`, which made clang emit it (and
  iref_INC, with its assert's file name) wherever the header is included.
  `samples report` lists anything a base object has outside .data.
- The base object's .data is laid out in the target's order, so objdiff's
  section match agrees with the per-symbol one. clang lays variables out
  where an initializer first points to them, not where they are defined,
  so each unit is compiled with -fdata-sections and linked (ld.lld -r)
  with target/<unit>.ld, which `samples slice` writes. Every unit's .data
  bytes now equal the target's.
- Formatting in place: codegen writes src/ and the format step formats it
  there, with a stamp in stamp/, so there is one set of generated sources.

Also:
- The build runs without the dev shell's environment, as objdiff runs it:
  NEWLIB_INCLUDE and AURORA_SRC are cached (from the environment when set;
  configuring without them fails), and the LLVM tools and cargo are found
  by absolute path. Configuring through a symlinked path fails: the build
  then names files by two paths, and ninja reran CMake and rebuilt
  everything on every build.
- User-side switches in the build's cache: MELEE_DAT_SAMPLES_ALL (archive
  globs) samples every typed object of those archives, and
  MELEE_DAT_SAMPLES_EXCLUDE (type globs) keeps types out of the samples.
- objdiff is pinned to v3.8.2, which no longer needs the Cargo.lock patch.

11237 of 11239 samples match, as before; the DOL still matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ribbanya ribbanya added tooling ai-assisted Utilizes a LLM to do the heavy lifting portability Improves non-matching builds labels Sep 30, 2026
@ribbanya
ribbanya marked this pull request as ready for review September 30, 2026 21:36
@ribbanya
ribbanya enabled auto-merge (squash) September 30, 2026 21:36
@ribbanya
ribbanya merged commit d532c30 into doldecomp:master Sep 30, 2026
10 checks passed
@ribbanya
ribbanya deleted the pr/dat branch September 30, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Utilizes a LLM to do the heavy lifting portability Improves non-matching builds tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant