Skip to content

Conversation

mati865
Copy link
Member

@mati865 mati865 commented Sep 19, 2025

Until now, x86_64-pc-windows-gnu linked rsbegin.o and rsend.o just like i686-pc-windows-gnu, even though they were no-ops for it. This was likely done for the simplicity back when it was introduced.
Today the things are different and these startup/end objects harm other features, like build-std. Given the demotion of i686-pc-windows-gnu from tier 1, there is no point in hurting x86_64-pc-windows-gnu, which remains a tier 1.

The files are still shipped in case downstream crates expect them, as in case of the unmaintained xargo.

Fixes #146739

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 19, 2025
@mati865
Copy link
Member Author

mati865 commented Sep 19, 2025

@bors try jobs=x86_64-unknown-linux-gnu,x86_64-pc-windows-gnu,i686-pc-windows-gnu

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 19, 2025
Stop linking rs{begin,end} on x86_64-*-windows-gnu

try-job: x86_64-unknown-linux-gnu
try-job: x86_64-pc-windows-gnu
try-job: i686-pc-windows-gnu
@rust-bors
Copy link

rust-bors bot commented Sep 19, 2025

💔 Test for 39b94f2 failed: CI. Failed job:

@mati865
Copy link
Member Author

mati865 commented Sep 19, 2025

@bors try jobs=dist-x86_64-linux,dist-x86_64-mingw,dist-i686-mingw

@rust-bors
Copy link

rust-bors bot commented Sep 19, 2025

❌ Encountered an error while executing command

@rust-log-analyzer

This comment has been minimized.

@mati865
Copy link
Member Author

mati865 commented Sep 19, 2025

@bors try jobs=dist-x86_64-linux,dist-x86_64-mingw,dist-i686-mingw

rust-bors bot added a commit that referenced this pull request Sep 19, 2025
Stop linking rs{begin,end} on x86_64-*-windows-gnu

try-job: dist-x86_64-linux
try-job: dist-x86_64-mingw
try-job: dist-i686-mingw
@rust-bors

This comment has been minimized.

@bjorn3
Copy link
Member

bjorn3 commented Sep 19, 2025

If this works we can also stop building them inside bootstrap, right?

if !target.is_windows_gnu() {
return vec![];
}
And cg_clif's build system could remove support for it entirely (as 32bit is not supported), but that is something I can do myself.

@mati865
Copy link
Member Author

mati865 commented Sep 19, 2025

If this works we can also stop building them inside bootstrap, right?

Surely, I decided to keep them for now (at least for this try build) to discuss it first. Deleting them might require an MCP because downstream crates might depend on them. Fast GitHub search shows that at least xargo uses them: https://github.com/japaric/xargo/blob/68e0ca57cd90837fe02f262f074182f9cfeb6227/src/sysroot.rs#L62

And cg_clif's build system could remove support for it entirely (as 32bit is not supported), but that is something I can do myself.

Whatever you prefer, I can include it here, or you can create a follow-up PR.

@bjorn3
Copy link
Member

bjorn3 commented Sep 19, 2025

Whatever you prefer, I can include it here, or you can create a follow-up PR.

I will do it in a follow up PR.

@rust-bors
Copy link

rust-bors bot commented Sep 19, 2025

☀️ Try build successful (CI)
Build commit: 41378ea (41378eaa0e4865b593f1d943c5f28d2e75339a63, parent: 2f4dfc753fd86c672aa4145940db075a8a149f17)

@mati865
Copy link
Member Author

mati865 commented Sep 19, 2025

  • with i686-pc-windows-gnu installed:
Details
❯ cargo clean -q && WINEDEBUG=fixme-all RUSTFLAGS='--print link-args' cargo +41378eaa0e4865b593f1d943c5f28d2e75339a63 r --target i686-pc-windows-gnu -Zbuild-std -q
LC_ALL="C" PATH="/home/mateusz/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/mateusz/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/home/mateusz/.local/share/JetBrains/Toolbox/scripts" VSLANG="1033" "i686-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-Wl,--large-address-aware" "/home/mateusz/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/i686-pc-windows-gnu/lib/rsbegin.o" "/tmp/rustcpN6h8q/symbols.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.0kbp6fvrl5in55grbj3y778v8.1emg57j.rcgu.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.3xt3yh9wi9do6ekhteyk1kh0n.1emg57j.rcgu.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.8ojvfkeqd68u18neuiumk30rx.1emg57j.rcgu.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.cdpuqlec2h814x3b4ebmb9mca.1emg57j.rcgu.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.ckod5tz40r39fejm4olsl5t5h.1emg57j.rcgu.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.f10mr37krx27d1y7uj1zk0sze.1emg57j.rcgu.o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.bufysymh5yitzjss7vx3tmqpu.1emg57j.rcgu.o" "-Wl,-Bstatic" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libpanic_unwind-8a1fb54627838172.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libstd-72f9215844909451.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libobject-2ee15b0bff176651.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libmemchr-aa6ab31d9d28c65f.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libaddr2line-30eef36561728eea.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libgimli-18046f783c7f5324.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libcfg_if-f8748a3e11dc9a52.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libwindows_targets-c81b89be7db82f97.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/librustc_demangle-62458615e0144f17.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libstd_detect-919accae48bbee51.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libhashbrown-b5b31ce7e70b7941.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/librustc_std_workspace_alloc-6b1592626a23c21a.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libminiz_oxide-063029267b9ae8bf.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libadler2-6bbef829e589591b.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libunwind-ae7d51fdd0b38778.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/liblibc-a458ac97c02465c9.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/librustc_std_workspace_core-7cce5fe4c6c0c539.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/liballoc-ed87263cb59b9f3e.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libcore-92ebb3dfc74557c7.rlib" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/libcompiler_builtins-7c9cf57d27b23e80.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "/home/mateusz/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/i686-pc-windows-gnu/lib/rsend.o"
013c:err:environ:init_peb starting L"Z:\\tmp\\hello\\target\\i686-pc-windows-gnu\\debug\\hello.exe" in experimental wow64 mode
Hello, world!
  • with x86_64-pc-windows-gnu target installed:
Details
❯ cargo clean -q && WINEDEBUG=fixme-all RUSTFLAGS='--print link-args' cargo +41378eaa0e4865b593f1d943c5f28d2e75339a63 r --target x86_64-pc-windows-gnu -Zbuild-std -q
LC_ALL="C" PATH="/home/mateusz/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/mateusz/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/home/mateusz/.local/share/JetBrains/Toolbox/scripts" VSLANG="1033" "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "/tmp/rustcEwxuc3/symbols.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.17dhoyy9elkmao99fojdxn7ia.1n1lfbv.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.6tmd8c7obs4frfcpzxdgcw3b2.1n1lfbv.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.7gdso4wm1wh9hd9illtcen6yd.1n1lfbv.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.956gth9q8h4949x9s7ckjmwb8.1n1lfbv.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.aoc1a37aq9rvujk3er4x54uhy.1n1lfbv.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.autpgmsmjidx11stnkvjoixat.1n1lfbv.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.drihiaun0cy9hqgdu803c7gl2.1n1lfbv.rcgu.o" "-Wl,-Bstatic" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libpanic_unwind-01ee491af66c3e43.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libstd-63eb7186b8c8d5bc.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libobject-ff7b5074a4db6efe.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libmemchr-56c85defa55bd57a.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libaddr2line-fe7bae594eb342a6.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libgimli-05696d36b2b64bcf.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libcfg_if-cd4926bcfe4ec299.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libwindows_targets-ebc1540211eacbdb.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/librustc_demangle-dbd11ec27081da4c.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libstd_detect-33da8ea679e62e08.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libhashbrown-9bb9ddcf1b0f652b.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/librustc_std_workspace_alloc-4cdb8b91dfbb8d5c.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libminiz_oxide-9c7dc8a37dcff4f9.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libadler2-ee7b42b39bb2685e.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libunwind-20c2ebda9bb636cc.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/liblibc-c29f99c305eeed31.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/librustc_std_workspace_core-66c7eaed21a249f2.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/liballoc-42e8b4347a2fbb90.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libcore-d57ffbcc97751493.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libcompiler_builtins-39bfbb91d41f29d7.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs"
Hello, world!
  • without i686-pc-windows-gnu target installed:
Details
_32" "-ldbghelp" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "rsend.o"
error: linking with `i686-w64-mingw32-gcc` failed: exit status: 1
  |
  = note:  "i686-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-Wl,--large-address-aware" "rsbegin.o" "/tmp/rustcj2OIfz/symbols.o" "<7 object files omitted>" "-Wl,-Bstatic" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/{libpanic_unwind-8a1fb54627838172,libstd-72f9215844909451,libobject-2ee15b0bff176651,libmemchr-aa6ab31d9d28c65f,libaddr2line-30eef36561728eea,libgimli-18046f783c7f5324,libcfg_if-f8748a3e11dc9a52,libwindows_targets-c81b89be7db82f97,librustc_demangle-62458615e0144f17,libstd_detect-919accae48bbee51,libhashbrown-b5b31ce7e70b7941,librustc_std_workspace_alloc-6b1592626a23c21a,libminiz_oxide-063029267b9ae8bf,libadler2-6bbef829e589591b,libunwind-ae7d51fdd0b38778,liblibc-a458ac97c02465c9,librustc_std_workspace_core-7cce5fe4c6c0c539,liballoc-ed87263cb59b9f3e,libcore-92ebb3dfc74557c7,libcompiler_builtins-7c9cf57d27b23e80}.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-o" "/tmp/hello/target/i686-pc-windows-gnu/debug/deps/hello-7dfb5090d6ec9ae4.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "rsend.o"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/lib/gcc/i686-w64-mingw32/15.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find rsbegin.o: No such file or directory
          /usr/lib/gcc/i686-w64-mingw32/15.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find rsend.o: No such file or directory
          collect2: error: ld returned 1 exit status


error: could not compile `hello` (bin "hello") due to 1 previous error
  • without x86_64-pc-windows-gnu target installed:
Details
❯ cargo clean -q && WINEDEBUG=fixme-all RUSTFLAGS='--print link-args' cargo +41378eaa0e4865b593f1d943c5f28d2e75339a63 r --target x86_64-pc-windows-gnu -Zbuild-std -q
LC_ALL="C" PATH="/home/mateusz/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/mateusz/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/home/mateusz/.local/share/JetBrains/Toolbox/scripts" VSLANG="1033" "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "/tmp/rustcGEaPoF/symbols.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.17dhoyy9elkmao99fojdxn7ia.1urk1dn.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.6tmd8c7obs4frfcpzxdgcw3b2.1urk1dn.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.7gdso4wm1wh9hd9illtcen6yd.1urk1dn.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.956gth9q8h4949x9s7ckjmwb8.1urk1dn.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.aoc1a37aq9rvujk3er4x54uhy.1urk1dn.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.autpgmsmjidx11stnkvjoixat.1urk1dn.rcgu.o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.drihiaun0cy9hqgdu803c7gl2.1urk1dn.rcgu.o" "-Wl,-Bstatic" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libpanic_unwind-01ee491af66c3e43.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libstd-63eb7186b8c8d5bc.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libobject-ff7b5074a4db6efe.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libmemchr-56c85defa55bd57a.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libaddr2line-fe7bae594eb342a6.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libgimli-05696d36b2b64bcf.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libcfg_if-cd4926bcfe4ec299.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libwindows_targets-ebc1540211eacbdb.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/librustc_demangle-dbd11ec27081da4c.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libstd_detect-33da8ea679e62e08.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libhashbrown-9bb9ddcf1b0f652b.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/librustc_std_workspace_alloc-4cdb8b91dfbb8d5c.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libminiz_oxide-9c7dc8a37dcff4f9.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libadler2-ee7b42b39bb2685e.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libunwind-20c2ebda9bb636cc.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/liblibc-c29f99c305eeed31.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/librustc_std_workspace_core-66c7eaed21a249f2.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/liballoc-42e8b4347a2fbb90.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libcore-d57ffbcc97751493.rlib" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/libcompiler_builtins-39bfbb91d41f29d7.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-o" "/tmp/hello/target/x86_64-pc-windows-gnu/debug/deps/hello-e99bfdbafa6677f7.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs"
Hello, world!

This basically confirms that for x86_64-pc-windows-gnu, Rust specific objects are not linked any more and build-std now works without installing target specific files.

Also in case somebody doubts whether these files were really unnecessary on x86_64, here is the proof:

Details
❯ llvm-nm ~/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o
00000000 a @feat.00

❯ llvm-nm ~/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o
00000000 a @feat.00

❯ llvm-nm ~/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/i686-pc-windows-gnu/lib/rsbegin.o
00000001 a @feat.00
00000000 R __ZN7rsbegin9eh_frames10mingw_init6P_INIT17h4156b2bc56f176a6E
00000000 R __ZN7rsbegin9eh_frames10mingw_init8P_UNINIT17hb20e0b5443dba632E
00000000 b __ZN7rsbegin9eh_frames3OBJ17hc223562bbd389026E
00000000 T __ZN7rsbegin9eh_frames4init17h24d07f20f4cd03fdE
00000030 T __ZN7rsbegin9eh_frames6uninit17h426ebb2ad0494657E
00000000 R ___EH_FRAME_BEGIN__
         U ___deregister_frame_info
         U ___register_frame_info
00000000 D __imp___ZN7rsbegin9eh_frames10mingw_init6P_INIT17h4156b2bc56f176a6E
00000004 D __imp___ZN7rsbegin9eh_frames10mingw_init8P_UNINIT17hb20e0b5443dba632E
00000008 D __imp____EH_FRAME_BEGIN__

❯ llvm-nm ~/.rustup/toolchains/41378eaa0e4865b593f1d943c5f28d2e75339a63/lib/rustlib/i686-pc-windows-gnu/lib/rsend.o
00000001 a @feat.00
00000000 R ___EH_FRAME_END__
00000000 D __imp____EH_FRAME_END__

@mati865 mati865 changed the title Stop linking rs{begin,end} on x86_64-*-windows-gnu Stop linking rs{begin,end} objects on x86_64-*-windows-gnu Sep 19, 2025
Until now, x86_64-pc-windows-gnu linked `rsbegin.o` and `rsend.o` just
like i686-pc-windows-gnu, even though they were no-ops for it.
This was likely done for the simplicity back when it was introduced.

Today the things are different and these startup/end objects harm other
features, like `build-std`. Given the demotion of i686-pc-windows-gnu
from tier 1, there is no point in hurting x86_64-pc-windows-gnu,
which remains a tier 1.

The files are still shipped in case downstream crates expect them, as in
case of the unmaintained `xargo`.
@mati865 mati865 force-pushed the amd64_mingw_no_rs_objects branch from 3b391e3 to 7eea65f Compare September 19, 2025 17:06
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Sep 19, 2025
@mati865
Copy link
Member Author

mati865 commented Sep 19, 2025

@workingjubilee
Copy link
Member

I believe separating out the question of whether or not to ship the artifacts from whether or not to link the artifacts is correct, as it basically is a T-compiler decision how we use them and a T-release decision whether we ship them. ( We work closely together but there's still, yanno, process. )

@petrochenkov petrochenkov self-assigned this Sep 22, 2025
@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 22, 2025
@mati865 mati865 marked this pull request as ready for review September 23, 2025 07:46
@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@petrochenkov
Copy link
Contributor

Started the discussion at #t-compiler > Removing rs{begin,end}.o objects for x86_64-pc-windows-gnu

I don't think this change needs any additional process if we are still shipping the objects.
@bors r+

@bors
Copy link
Collaborator

bors commented Sep 26, 2025

📌 Commit 7eea65f has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 26, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 26, 2025
… r=petrochenkov

Stop linking rs{begin,end} objects on x86_64-*-windows-gnu

Until now, x86_64-pc-windows-gnu linked `rsbegin.o` and `rsend.o` just like i686-pc-windows-gnu, even though they were no-ops for it. This was likely done for the simplicity back when it was introduced.
Today the things are different and these startup/end objects harm other features, like `build-std`. Given the demotion of i686-pc-windows-gnu from tier 1, there is no point in hurting x86_64-pc-windows-gnu, which remains a tier 1.

The files are still shipped in case downstream crates expect them, as in case of the unmaintained `xargo`.

Fixes rust-lang#146739
bors added a commit that referenced this pull request Sep 26, 2025
Rollup of 10 pull requests

Successful merges:

 - #145113 (resolve: Do not finalize shadowed bindings)
 - #146523 (Demote both armebv7r-none-* targets.)
 - #146704 (port `#[debugger_visualizer]` to the new attribute system)
 - #146758 (Stop linking rs{begin,end} objects on x86_64-*-windows-gnu)
 - #146778 (Use standard attribute logic for allocator shim)
 - #146849 (Reduce some uses of `LegacyBang`)
 - #147016 (fix doc comments to be more standard)
 - #147027 (Add new `tyalias` intra-doc link disambiguator)
 - #147031 (mbe: Simplify check_redundant_vis_repetition)
 - #147058 (Ignore more failing ui tests for GCC backend)

Failed merges:

 - #147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 27, 2025
Rollup of 10 pull requests

Successful merges:

 - #145113 (resolve: Do not finalize shadowed bindings)
 - #146523 (Demote both armebv7r-none-* targets.)
 - #146704 (port `#[debugger_visualizer]` to the new attribute system)
 - #146758 (Stop linking rs{begin,end} objects on x86_64-*-windows-gnu)
 - #146778 (Use standard attribute logic for allocator shim)
 - #146849 (Reduce some uses of `LegacyBang`)
 - #147016 (fix doc comments to be more standard)
 - #147027 (Add new `tyalias` intra-doc link disambiguator)
 - #147031 (mbe: Simplify check_redundant_vis_repetition)
 - #147058 (Ignore more failing ui tests for GCC backend)

Failed merges:

 - #147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ebe90c7 into rust-lang:master Sep 27, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 27, 2025
rust-timer added a commit that referenced this pull request Sep 27, 2025
Rollup merge of #146758 - mati865:amd64_mingw_no_rs_objects, r=petrochenkov

Stop linking rs{begin,end} objects on x86_64-*-windows-gnu

Until now, x86_64-pc-windows-gnu linked `rsbegin.o` and `rsend.o` just like i686-pc-windows-gnu, even though they were no-ops for it. This was likely done for the simplicity back when it was introduced.
Today the things are different and these startup/end objects harm other features, like `build-std`. Given the demotion of i686-pc-windows-gnu from tier 1, there is no point in hurting x86_64-pc-windows-gnu, which remains a tier 1.

The files are still shipped in case downstream crates expect them, as in case of the unmaintained `xargo`.

Fixes #146739
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Sep 29, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145113 (resolve: Do not finalize shadowed bindings)
 - rust-lang/rust#146523 (Demote both armebv7r-none-* targets.)
 - rust-lang/rust#146704 (port `#[debugger_visualizer]` to the new attribute system)
 - rust-lang/rust#146758 (Stop linking rs{begin,end} objects on x86_64-*-windows-gnu)
 - rust-lang/rust#146778 (Use standard attribute logic for allocator shim)
 - rust-lang/rust#146849 (Reduce some uses of `LegacyBang`)
 - rust-lang/rust#147016 (fix doc comments to be more standard)
 - rust-lang/rust#147027 (Add new `tyalias` intra-doc link disambiguator)
 - rust-lang/rust#147031 (mbe: Simplify check_redundant_vis_repetition)
 - rust-lang/rust#147058 (Ignore more failing ui tests for GCC backend)

Failed merges:

 - rust-lang/rust#147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows GNU target: rsbegin.o / rsend.o injection is unconfigurable and breaks cross-compilation
7 participants