Repository navigation
Default library binaries split by target triple, then build, then memory model - #526
Merged
Merged
Conversation
…ory model
defaultlib/{lib,dll}/<arch>/<vendor>/<os>/<env>/{debug,release}/{gc,rc,none}/ for every
target (the host included), each segment the canonical name LLVM gives the parsed triple
component, so i686/i386, an Android API level or an MSVC version share one tree. The
declarations and everything else stay at the defaultlib root, shared by every build, so
Android no longer needs a tree of its own.
getDefaultLibSubDir moves from Defines.h (which the runtime includes without LLVM) to
defaultlib.cpp and takes the triple; the linker, the JIT, --install-default-lib and the new
--print-default-lib-dir=<lib|dll> all call it. Build scripts and CMake templates ask
--print-default-lib-dir instead of spelling the layout out; test-default-lib-dir pins it.
check-x86-libs.sh: the stand-in default-library trees get a lib.d.ts, missing since #371
made an unreadable reference an error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The compiled default library is now split by target triple for every target (the host included), then by build mode, then by memory model:
getArchTypeNameetc.), soi686/i386, an Android API level (android29) or an MSVC version share one tree. The x86 arch is thereforei386. The environment is included because Android's OS islinux: without it Android and glibc Linux would collide.defaultlibroot, common to all builds. Android no longer has its own__build/android/<abi>/defaultlibtree: it takes--default-lib-path=<the folder holding defaultlib>like every other target.getDefaultLibSubDirmoves fromDefines.h(which the async runtime includes without LLVM) todefaultlib.cppand takes anllvm::Triple. The linker (exe.cpp), the JIT (host triple),--install-default-liband the new option all call it. The oldDEFAULT_LIB_ARCH_X86special case is gone.tslang --print-default-lib-dir=<lib|dll> [-mtriple=...] [--di] -mm=<model>prints the folder. Build scripts, CMake templates and tests ask it instead of spelling the layout out, so producer and consumer cannot drift.test-default-lib-dirpins the strings.no default library built for x86_64-pc-windows-msvc -mm=rc: ....Consumers updated:
defaultlib-collector.cmake,android-link.cmake,check-x86-libs.sh,check-x86-run.sh, the VSCode/CMake template inFiles.h,docs/how/cmake_{tslang,dll,bgfx},create-release.yml(the Android default library now ships in the shareddefaultlibtree;android/<abi>/libkeeps onlylibgc.aandlibTypeScriptAsyncRuntime.a).Also:
check-x86-libs.sh's stand-in default-library trees get alib.d.ts, missing since #371 made an unreadable reference an error. Three of its cases were failing before this change.Merge order
DefaultLib counterpart: ASDAlexander77/TypeScriptCompilerDefaultLib#30. Merge this one first: the DefaultLib build scripts call
--print-default-lib-dirand refuse to run with a tslang that lacks it. Old release zips and a new compiler are incompatible (and vice versa), so the next tag needs a full default-library rebuild, whichcreate-release.ymlalready does.Test plan
test-default-lib-dir,test-compile-android-codegentest-jit-gc-defaultlib-collector,test-compile-gc-defaultlib-collectorwithTSLANG_REQUIRE_DEFAULT_LIB=1(not skipped)test-compile-android-linkagainst the shared tree (not skipped)check-x86-libs.shall ok, including the x64 control against the real librarycheck-x86-run.shdefault-library section all ok against thei386tree. Two unrelated failures (both--no-default-lib) are pre-existing: the-mm=noneframe-allocator IR check expectsaligned_allocbut frames now come from__tslang_heap_malloc, andawait_order -mm=gcoutput order is flaky. Filed separately.tslang --cmakeproject configures and resolvesdefaultlib/lib/x86_64/pc/windows/msvc/release/rcfor-DTSLANG_MEMORY_MODEL=rcscripts/build.shonly syntax-checked locally; thebuild_on_linuxrelease job is the real test🤖 Generated with Claude Code