Skip to content

Conversation

@gbaraldi
Copy link
Member

Hopefully this fixes JuliaLang/PackageCompiler.jl#1019. This does mean a very slight size increase (each offset is twice as large but shouldn't make too much difference (it's an extra 32bit per gvar))

@gbaraldi gbaraldi requested a review from vtjnash February 11, 2025 21:31
@gbaraldi gbaraldi added backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 labels Feb 11, 2025
@oscardssmith oscardssmith added the bugfix This change fixes an existing bug label Feb 11, 2025
@topolarity
Copy link
Member

Can you test that this is working before merging?

@test success(`$(Base.julia_cmd()) -J $(dir)/sys.so -e 'Base.scrub_repl_backtrace(nothing); exit()'`)


if !Sys.iswindows() #Windows doesn't support large images
Copy link
Member

@giordano giordano Feb 12, 2025

Choose a reason for hiding this comment

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

Does this work on 32-bit systems? Edit: ah, you skip the test below? Isn't it simpler to just exclude 32-bit systems together with Windows here?

This was referenced Feb 14, 2025
@gbaraldi gbaraldi added the merge me PR is reviewed. Merge when all tests are passing label Feb 19, 2025
@giordano
Copy link
Member

x86_64 Darwin tests are systematically failing on this PR despite multiple retries.

@giordano
Copy link
Member

This keeps failing: https://buildkite.com/julialang/julia-master/builds/45061#01952ab6-a051-466e-aa0a-49ff9c521962/758-1238

      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x47e): relocation SIGNED is out of range: 2402433694 is not in [-2147483648, 2147483647]; references _jl_globalYY.127339
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x40b): relocation SIGNED is out of range: 2402361361 is not in [-2147483648, 2147483647]; references _SUM.CoreDOT.GenericMemoryRefYY.43295
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x399): relocation SIGNED is out of range: 2402375627 is not in [-2147483648, 2147483647]; references _jl_globalYY.214098
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x38c): relocation SIGNED is out of range: 2402376008 is not in [-2147483648, 2147483647]; references _SUM.CoreDOT.TupleYY.50182
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x385): relocation SIGNED is out of range: 2402318159 is not in [-2147483648, 2147483647]; references _jl_globalYY.180619
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x34e): relocation SIGNED is out of range: 2402390694 is not in [-2147483648, 2147483647]; references _jl_globalYY.50155
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x347): relocation SIGNED is out of range: 2402312757 is not in [-2147483648, 2147483647]; references _jl_globalYY.43543
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x227): relocation SIGNED is out of range: 2402445277 is not in [-2147483648, 2147483647]; references _jl_globalYY.73842
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x194): relocation SIGNED is out of range: 2402405512 is not in [-2147483648, 2147483647]; references _SUM.CoreDOT.ArrayYY.45751
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x188): relocation SIGNED is out of range: 2402333196 is not in [-2147483648, 2147483647]; references _jl_globalYY.44727
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x161): relocation SIGNED is out of range: 2402419971 is not in [-2147483648, 2147483647]; references _SUM.CoreDOT.TupleYY.62458
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x14f): relocation SIGNED is out of range: 2402463005 is not in [-2147483648, 2147483647]; references _jl_small_typeof
      From worker 6:	lld: error: /private/var/tmp/agent-tempdirs/default-macmini-x64-4.0/tmp/jl_jFNgE1/sys.o.a(text#0.o):(symbol _japi1_reverse_273487+0x119): relocation SIGNED is out of range: 2402305235 is not in [-2147483648, 2147483647]; references _jl_globalYY.42860
[...]

@KristofferC KristofferC mentioned this pull request Mar 11, 2025
71 tasks
Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

I think you are relying on the .ldata section existing to be allowed to use large images like this, but that is an ELF-only feature. Since we use the Small or Medium CodeModels, individual object file relocations will only be able to reference a shared object smaller than about 2GB

@gbaraldi
Copy link
Member Author

I guess we need to detect large images and switch to the large code model. (Maybe printing an info that the image is very large and will have lower performance. I think aarch64 is fine here because there the code model allows for 4GB relocations

@JeffBezanson JeffBezanson removed the merge me PR is reviewed. Merge when all tests are passing label Mar 20, 2025
This was referenced Mar 24, 2025
@KristofferC KristofferC mentioned this pull request Apr 4, 2025
51 tasks
@KristofferC KristofferC mentioned this pull request May 9, 2025
58 tasks
@KristofferC KristofferC mentioned this pull request Jun 6, 2025
60 tasks
@KristofferC KristofferC mentioned this pull request Jul 22, 2025
20 tasks
@KristofferC KristofferC mentioned this pull request Aug 6, 2025
38 tasks
@bjarthur
Copy link
Contributor

bjarthur commented Aug 7, 2025

anything i can do to help get this merged for 1.12-rc2?

@gbaraldi
Copy link
Member Author

gbaraldi commented Aug 7, 2025

The issue here is that this doesn't fix the underlying issue that OSs don't support shared libraries over 2GB/4GB.

This was referenced Aug 19, 2025
@ViralBShah
Copy link
Member

If this doesn't fix things right now, should we remove the 1.12 label?

@topolarity
Copy link
Member

Yeah, I'm in favor of trying a different approach. I think we probably need to pursue the split file (code in .so / data in .ji) setup that @vtjnash recommended to get this fixed properly

Maybe close and file an issue for the changes?

@ViralBShah
Copy link
Member

The compression also gives us quite a bit more room.

@gbaraldi gbaraldi removed backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 labels Aug 26, 2025
DilumAluthge added a commit that referenced this pull request Sep 5, 2025
Backported PRs:
- [x] #54840 <!-- Add boundscheck in speccache_eq to avoid OOB access
due to data race -->
- [x] #42080 <!-- recommend explicit `using Foo: Foo, ...` in package
code (was: "using considered harmful") -->
- [x] #58127 <!-- [DOC] Update installation docs: /downloads/ =>
/install/ -->
- [x] #58202 <!-- [release-1.11] malloc: use jl_get_current_task to fix
null check -->
- [x] #58584 <!-- Make `Ptr` values static-show w/ type-information -->
- [x] #58637 <!-- Make late gc lower handle insertelement of alloca use.
-->
- [x] #58837 <!-- fix null comparisons for non-standard address spaces
-->
- [x] #57826 <!-- Add a `similar` method for `Type{<:CodeUnits}` -->
- [x] #58293 <!-- fix trailing indices stackoverflow in reinterpreted
array -->
- [x] #58887 <!-- Pkg: Allow configuring can_fancyprint(io::IO) using
IOContext -->
- [x] #58937 <!-- Fix nthreadpools size in JLOptions -->
- [x] #58978 <!-- Fix precompilepkgs warn loaded setting -->
- [x] #58998 <!-- Bugfix: Use Base.aligned_sizeof instead of sizeof in
Mmap.mmap -->
- [x] #59120 <!-- Fix memory order typo in "src/julia_atomics.h" -->
- [x] #59170 <!-- Clarify and enhance confusing precompile test -->

Need manual backport:
- [ ] #56329 <!-- loading: clean up more concurrency issues -->
- [ ] #56956 <!-- Add "mea culpa" to foreign module assignment error.
-->
- [ ] #57035 <!-- linux: workaround to avoid deadlock inside
dl_iterate_phdr in glibc -->
- [ ] #57089 <!-- Block thread from receiving profile signal with
stackwalk lock -->
- [ ] #57249 <!-- restore non-freebsd-unix fix for profiling -->
- [ ] #58011 <!-- Remove try-finally scope from `@time_imports`
`@trace_compile` `@trace_dispatch` -->
- [ ] #58062 <!-- remove unnecessary edge from `exp_impl` to `pow` -->
- [ ] #58157 <!-- add showing a string to REPL precompile workload -->
- [ ] #58209 <!-- Specialize `one` for the `SizedArray` test helper -->
- [ ] #58108 <!-- Base.get_extension & Dates.format made public -->
- [ ] #58356 <!-- codegen: remove readonly from abstract type calling
convention -->
- [ ] #58415 <!-- [REPL] more reliable extension loading -->
- [ ] #58510 <!-- Don't filter `Core` methods from newly-inferred list
-->
- [ ] #58110 <!-- relax dispatch for the `IteratorSize` method for
`Generator` -->
- [ ] #58965 <!-- Fix `hygienic-scope`s in inner macro expansions -->
- [ ] #58971 <!-- Fix alignment of failed precompile jobs on CI -->
- [ ] #59066 <!-- build: Also pass -fno-strict-aliasing for C++ -->

Contains multiple commits, manual intervention needed:
- [ ] #55877 <!-- fix FileWatching designs and add workaround for a stat
bug on Apple -->
- [ ] #56755 <!-- docs: fix scope type of a `struct` to hard -->
- [ ] #57809 <!-- Fix fptrunc Float64 -> Float16 rounding through
Float32 -->
- [ ] #57398 <!-- Make remaining float intrinsics require float
arguments -->
- [ ] #56351 <!-- Fix `--project=@script` when outside script directory
-->
- [ ] #57129 <!-- clarify that time_ns is monotonic -->
- [ ] #58134 <!-- Note annotated string API is experimental in Julia
1.11 in HISTORY.md -->
- [ ] #58401 <!-- check that hashing of types does not foreigncall
(`jl_type_hash` is concrete evaluated) -->
- [ ] #58435 <!-- Fix layout flags for types that have oddly sized
primitive type fields -->
- [ ] #58483 <!-- Fix tbaa usage when storing into heap allocated
immutable structs -->
- [ ] #58512 <!-- Make more types jl_static_show readably -->
- [ ] #58012 <!-- Re-enable tab completion of kwargs for large method
tables -->
- [ ] #58683 <!-- Add 0 predecessor to entry basic block and handle it
in inlining -->
- [ ] #59112 <!-- Add builtin function name to add methods error -->

Non-merged PRs with backport label:
- [ ] #59329 <!-- aotcompile: destroy LLVM context after serializing
combined module -->
- [ ] #58848 <!-- Set array size only when safe to do so -->
- [ ] #58535 <!-- gf.c: include const-return methods in
`--trace-compile` -->
- [ ] #58038 <!-- strings/cstring: `transcode`: prevent Windows sysimage
invalidation -->
- [ ] #57604 <!-- `@nospecialize` for `string_index_err` -->
- [ ] #57366 <!-- Use ptrdiff_t sized offsets for gvars_offsets to allow
large sysimages -->
- [ ] #56890 <!-- Enable getting non-boxed LLVM type from Julia Type -->
- [ ] #56823 <!-- Make version of opaque closure constructor in world
-->
- [ ] #55958 <!-- also redirect JL_STDERR etc. when redirecting to
devnull -->
- [ ] #55956 <!-- Make threadcall gc safe -->
- [ ] #55534 <!-- Set stdlib sources as read-only during installation
-->
- [ ] #55499 <!-- propagate the terminal's `displaysize` to the
`IOContext` used by the REPL -->
- [ ] #55458 <!-- Allow for generically extracting unannotated string
-->
- [ ] #55457 <!-- Make AnnotateChar equality consider annotations -->
- [ ] #55220 <!-- `isfile_casesensitive` fixes on Windows -->
- [ ] #53957 <!-- tweak how filtering is done for what packages should
be precompiled -->
- [ ] #51479 <!-- prevent code loading from lookin in the versioned
environment when building Julia -->
- [ ] #50813 <!-- More doctests for Sockets and capitalization fix -->
- [ ] #50157 <!-- improve docs for `@inbounds` and
`Base.@propagate_inbounds` -->

---------

Co-authored-by: Kiran Pamnany <[email protected]>
Co-authored-by: adienes <[email protected]>
Co-authored-by: Gabriel Baraldi <[email protected]>
Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Simeon David Schaub <[email protected]>
Co-authored-by: Jameson Nash <[email protected]>
Co-authored-by: Alex Arslan <[email protected]>
Co-authored-by: Fons van der Plas <[email protected]>
Co-authored-by: Ian Butterworth <[email protected]>
Co-authored-by: JonasIsensee <[email protected]>
Co-authored-by: Curtis Vogt <[email protected]>
Co-authored-by: Dilum Aluthge <[email protected]>
Co-authored-by: DilumAluthgeBot <[email protected]>
Co-authored-by: DilumAluthge <[email protected]>
@PallHaraldsson
Copy link
Contributor

I like that you're doing a fix or some sort of workaround. Though it excludes Windows, and we really want Windows to have a level playing field?! 2GB sysimage seems way excessive, also 4GB, and could we have the gvar only 32-bit but unsigned for now, giving a bit of breathing room, even though not a full solution?

How many gvar are there? Should we be worried about them expanding (four extra zeros for each for normal sized sysimages)?

Compression is not an alternate to this you mean, you mean a mitigation to expanded pointers?

For languages we compare ourself to are 2-4+ GB .exe (or zip or .jar etc) files normal or too be expected? The sysimage is is our sort of .exe subsitute, and we rather want arbitrary large code, or at least reasonably large max. It just seems there should be ways to trim more and/ore move around to other files, ande larger sysimage a last resort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2GB limit to sysimage size?

9 participants