Skip to content

Fix compiler and RTS portability issues exposed by haskell.nix - #196

Merged
angerman merged 2 commits into
stable-ghc-9.14from
fix/haskell-nix-portability
Oct 16, 2026
Merged

angerman merged 2 commits into
stable-ghc-9.14from
fix/haskell-nix-portability

Conversation

@angerman

@angerman angerman commented Oct 15, 2026 •

Copy link
Copy Markdown

Profiling links can select vanilla archives, x86 PIC jump-table shortcutting can produce invalid label differences, and several compiler/RTS paths fail with toolchains and object files used by haskell.nix. Extract the bounded fixes from stable-ghc-9.14-hn and add focused regressions.

Changes

  • Restore profiling library suffixes without restoring RTS-only way suffixes.
  • Export Emscripten HEAP8/HEAPU8; test a real C object using the source RTS heap helpers.
  • Apply vector Cmm ISA flags on i386 as well as x86_64.
  • Keep relative PIC jump-table targets within their procedure and preserve required trampoline blocks and CFG nodes. Keep both parts of the fix together.
  • Accept bare Android OS names and provide missing ELF visibility macros.
  • Allocate GOT slots for supported named-local ELF OBJECT/FUNC/NOTYPE definitions, excluding unsupported TLS, absolute and undefined locals.
  • Preserve BFD function/data import types and nullable lookup outputs.
  • Trim Apple ranlib padding from wasm BSD archive members using bounded u32 LEB128 decoding; cover malformed lengths, payload preservation, metadata and following members. Supersedes SysTools.Ar: trim Apple-ranlib wasm member padding #192.

The GOT fixture localizes its definitions after assembly so older assemblers retain named, zero-addend GOT references. The BFD fixture supplies an explicit archive directory to locate the adjacent DLL, requires GNU dlltool and verifies long-form archive members; tool discovery accepts GNU's qualified-path banners and reports rejected candidates.

Build and CI prerequisites

Rebuild Windows time against the pinned dependency graph; recognize Cygwin/MinGW make; select FreeBSD Sphinx by port origin; archive only Debian 11's retired security repository; build pinned native Alex/Happy for stage3; pin ARM macOS release jobs to macOS 15 and isolate their native Cabal cache by OS/bootstrap GHC. Package the authoritative inputs for installed-compiler tests and populate Make's NCG capability field, matching Hadrian.

Suppress only complete Apple ranlib diagnostics about valid empty archive members. Preserve other diagnostics, argument handling and failing exit statuses; avoid Apple-only flags rejected by LLVM ranlib. A native process regression covers qualified and PATH-based invocations, resolved absolute tool paths, neighboring/error diagnostics and exit failures, and runs in compiled normal mode.

The shared Wasm bootstrap now downloads the full official GitHub mirror at a pinned revision and verifies its SHA256 before running upstream setup. This avoids GitLab returning anti-bot HTML with HTTP 200, including the bootstrap script's nested GitLab archive request. Full FLAVOUR=9.12 setup and consumer coverage are preserved.

Validation

Two focused commits on 93c3dc1716: portability corrections 09f5c34611 and the shared CI bootstrap repair 0aae70d65d. #197 is stacked directly above them. CI has restarted on the corrected heads. Merge by fast-forward only after the current candidates are green.

  • Astra reviewed the extraction, integration, final corrections and shared bootstrap repair. Its GHCi test-configuration finding is fixed; no findings remain in the reviewed changes.
  • The focused Windows A/B run reuses the exact previously built compiler. The bare-filename control reproduces the preexisting empty-directory crash during DLL search-path setup. The corrected ./libbfd_imports.a fixture passes every assertion: nullable lookup, first function/data relocation, shared storage update and cached lookup; stdout is OK, stderr is empty. The diagnostic workflow is red because it retains the failing control. This fixture correction does not claim to repair the loader's bare-path handling.
  • The latest Intel suite exposed a launcher-path mismatch: GHC configured bare ranlib, while Apple printed its resolved Xcode path. An actual cctools launcher reproduces the published filter's warning leak; the reviewed correction accepts only resolved absolute paths with the configured basename and complete known warning grammar. Independent POSIX/Windows path probes and the extended process regression pass.
  • The ranlib regression fails against the previous implementation and passes against the correction. Actual Apple cctools, CLT, Xcode and LLVM tools pass valid-archive probes; malformed-archive diagnostics and exit statuses remain intact. Full rebuilt-compiler static001 qualification is pending in current CI.
  • On previous head 170619c331, normal CI and Nix CI passed: four normal native suites, six Nix native suites, three MULTI cross builds and three artifact-consuming e2e jobs. The e2e jobs compile/run native, Wasm and JS hello programs and build the Miso Wasm example. ARM Linux JUnits explicitly confirm the actual RTS elf_local_got regression; x86 JUnits confirm both PIC regressions. These results qualify the earlier source, not the new head.
  • At heads 5fa0da603b / f2956276fe, both complete Windows runtime suites passed. The new Nix failures occurred during Wasm SDK bootstrap: Fix compiler and RTS portability issues exposed by haskell.nix #196 explicitly logged an Anubis HTML page, while Cmm: declare CPU requirements on RTS procedures #197's Linux consumers failed parsing the same URL before downloading compiler artifacts. The pinned-mirror repair passes HTML/corruption/failure/cleanup probes and a real Darwin SDK/libffi compile/link check. Complete setup and consumers remain current CI gates.
  • Earlier strict C11, assembler/relocation, Emscripten/Node, decoder, solver and tool-discovery probes passed. No timeout, assertion or expected result has been relaxed.

The previous Debian ARM suite stopped before tests on a transient archived-package HTTP 404; its exact package later matched the authenticated archive index and installed successfully in #197. A targeted retry is running. The new-head CI must independently pass.

The RWX pool, unconditional libc.a skip, PREL31-as-REL32 change, CRT-specific exports, OS-hardcoded C++ runtime choice and ABI-hash cleanup remain excluded.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The heap-view regression does not link Emscripten and fails independently of the export fix.

1 open finding
What changed in this PR

Backports targeted compiler and runtime portability fixes exposed by haskell.nix, with focused regression tests.

Changes:

  • Restores profiling library suffixes and preserves x86 PIC jump-table trampolines.
  • Fixes Android recognition, ELF/Windows linking, Emscripten heap exports, and wasm archive padding.
  • Adds regression fixtures and targeted diagnostic normalization.
File Description
testsuite/​tests/​rts/​linker/​Makefile Builds new linker regressions.
testsuite/​tests/​rts/​linker/​elf_visibility.py Checks visibility macro fallbacks.
testsuite/​tests/​rts/​linker/​elf_local_got.stdout Records expected success.
testsuite/​tests/​rts/​linker/​elf_local_got.s Exercises local GOT references.
testsuite/​tests/​rts/​linker/​elf_local_got.hs Loads and executes GOT fixture.
testsuite/​tests/​rts/​linker/​elf_got_symbols.c Checks GOT symbol selection.
testsuite/​tests/​rts/​linker/​bfd_imports.stdout Records expected success.
testsuite/​tests/​rts/​linker/​bfd_imports.hs Exercises Windows import resolution.
testsuite/​tests/​rts/​linker/​bfd_imports.def Declares fixture exports.
testsuite/​tests/​rts/​linker/​bfd_imports_library.c Supplies imported functions and data.
testsuite/​tests/​rts/​linker/​bfd_imports_client.c References fixture imports.
testsuite/​tests/​rts/​linker/​bfd_imports_check.py Checks BFD archive markers.
testsuite/​tests/​rts/​linker/​all.T Registers linker regressions.
testsuite/​tests/​javascript/​JSHeapViews.stdout Records expected heap checks.
testsuite/​tests/​javascript/​JSHeapViews.hs Adds heap-view regression.
testsuite/​tests/​javascript/​all.T Registers heap-view test.
testsuite/​tests/​ghc-api/​X86JumpTableShortcut.hs Checks jump-table shortcut behavior.
testsuite/​tests/​ghc-api/​UnitHsLibs.hs Checks library naming across ways.
testsuite/​tests/​ghc-api/​all.T Registers compiler API regressions.
testsuite/​tests/​driver/​WasmArchivePadding.stdout Records expected success.
testsuite/​tests/​driver/​WasmArchivePadding.hs Checks archive padding and malformed lengths.
testsuite/​tests/​driver/​Makefile Runs Android conversion probe.
testsuite/​tests/​driver/​android_target_os.py Exercises OS conversion through autoconf.
testsuite/​tests/​driver/​all.T Registers driver regressions.
testsuite/​tests/​codeGen/​should_gen_asm/​pic-jump-table.cmm Supplies PIC switch fixture.
testsuite/​tests/​codeGen/​should_gen_asm/​pic-jump-table.asm Checks relative tables and trampolines.
testsuite/​tests/​codeGen/​should_gen_asm/​pic-jump-table-split.cmm Reuses fixture for split sections.
testsuite/​tests/​codeGen/​should_gen_asm/​pic-jump-table-split.asm Checks split-section assembly.
testsuite/​tests/​codeGen/​should_gen_asm/​all.T Registers PIC assembly regressions.
testsuite/​driver/​testlib.py Normalizes specific older Emscripten warnings.
rts/​rts.cabal Extends vector ISA flags to i386.
rts/​linker/​PEi386.c Preserves imported symbol types.
rts/​linker/​ElfTypes.h Supplies missing visibility macros.
rts/​linker/​elf_got.c Includes supported named-local GOT definitions.
rts/​js/​mem.js Exports Emscripten byte heap views.
m4/​ghc_convert_os.m4 Accepts bare Android OS components.
compiler/​GHC/​Unit/​Info.hs Restores profiling library suffixes.
compiler/​GHC/​SysTools/​Ar.hs Trims wasm BSD archive padding safely.
compiler/​GHC/​CmmToAsm/​X86/​Instr.hs Keeps relative jump-table targets local.
compiler/​GHC/​CmmToAsm.hs Retains PIC trampolines and CFG nodes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread testsuite/tests/javascript/JSHeapViews.hs Outdated
angerman added a commit that referenced this pull request Oct 15, 2026
Reuse the Windows time/bootstrap and make-host fixes, FreeBSD Sphinx port selection, and archived Debian 11 repositories already carried by #196. These unblock release jobs before they reach compiler validation.
@angerman
angerman force-pushed the fix/haskell-nix-portability branch from 9e5d829 to 170619c Compare October 15, 2026 11:50
@angerman
angerman marked this pull request as ready for review October 15, 2026 13:02
@angerman
angerman force-pushed the fix/haskell-nix-portability branch from 170619c to 5fa0da6 Compare October 15, 2026 23:38
Restore profiling library suffixes, export the Emscripten heap views, and
apply vector ISA flags consistently on both x86 widths. Keep PIC jump-table
shortcuts within their procedure and preserve the required trampolines.

Handle Android target names, ELF visibility fallbacks and supported local
GOT definitions. Preserve BFD import types and nullable lookup outputs.
Trim Apple ranlib padding from wasm archive members with bounded decoding.

Add focused regressions, including assembler-independent local GOT and GNU
BFD fixtures. Repair Windows, FreeBSD, Debian and macOS CI prerequisites,
provide pinned native Alex/Happy for stage3, and wire Make test capabilities.

Qualify the BFD regression archive path to locate its adjacent DLL. Filter
only complete Apple ranlib warnings about empty archive members, preserving
other diagnostics and exit failures without Apple-only command-line flags.

Handle PATH launchers whose diagnostics name a resolved absolute ranlib
path, and cover both qualified and PATH invocations in the regression.
@angerman
angerman force-pushed the fix/haskell-nix-portability branch from db223fb to 0aae70d Compare October 16, 2026 11:46
@angerman
angerman merged commit 0aae70d into stable-ghc-9.14 Oct 16, 2026
106 of 109 checks passed
@angerman
angerman deleted the fix/haskell-nix-portability branch October 16, 2026 22:23
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