Skip to content

export symbols: support macos/windows(32/64)#155535

Open
cezarbbb wants to merge 4 commits intorust-lang:mainfrom
cezarbbb:cstyle-export-symbols
Open

export symbols: support macos/windows(32/64)#155535
cezarbbb wants to merge 4 commits intorust-lang:mainfrom
cezarbbb:cstyle-export-symbols

Conversation

@cezarbbb
Copy link
Copy Markdown
Contributor

@cezarbbb cezarbbb commented Apr 20, 2026

View all comments

Previously, in the pr #150992 , export symbols only supported Linux. The special prefix and suffix rules for some symbols in macOS and Windows were not fully supported. This pull request attempts to clarify these rules and add corresponding support.

Currently, the undecorate_c_symbol() function has been added to handle macOS _ prefixes, Windows x86 calling convention modifiers (cdecl/stdcall/fastcall/vectorcall), and Arm64EC # prefixes.

r? @bjorn3

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 20, 2026

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: codegen, compiler
  • codegen, compiler expanded to 72 candidates
  • Random selection from 16 candidates

@rustbot rustbot assigned bjorn3 and unassigned wesleywiser Apr 20, 2026
@cezarbbb
Copy link
Copy Markdown
Contributor Author

Could someone pls give me permission to test whether the current modifications will work correctly on Windows and macOS?
Cause I don't have the corresponding devices.

@adwinwhite
Copy link
Copy Markdown
Contributor

@bors delegate=try

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 20, 2026

✌️ @cezarbbb, you can now perform try builds on this pull request!

You can now post @bors try to start a try build.

@cezarbbb
Copy link
Copy Markdown
Contributor Author

@bors delegate=try

Thanks!!! It helps me a lot:>

@cezarbbb
Copy link
Copy Markdown
Contributor Author

@bors try jobs=x86_64-msvc-*

rust-bors bot pushed a commit that referenced this pull request Apr 20, 2026
export symbols: support macos/windows(32/64)


try-job: x86_64-msvc-*
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 20, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 20, 2026

💔 Test for 22e628f failed: CI. Failed job:

@cezarbbb
Copy link
Copy Markdown
Contributor Author

@bors try jobs=x86_64-msvc-*

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 20, 2026
export symbols: support macos/windows(32/64)


try-job: x86_64-msvc-*
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 20, 2026

💔 Test for 71d836c failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@cezarbbb
Copy link
Copy Markdown
Contributor Author

@bors try jobs=x86_64-msvc-*

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 20, 2026
export symbols: support macos/windows(32/64)


try-job: x86_64-msvc-*
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 20, 2026

☀️ Try build successful (CI)
Build commit: 6d8d88e (6d8d88e3ab7025c82dc5ed03d96874614fdf1189, parent: e22c616e4e87914135c1db261a03e0437255335e)

@cezarbbb
Copy link
Copy Markdown
Contributor Author

@bors try jobs=aarch64-*

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 20, 2026
export symbols: support macos/windows(32/64)


try-job: aarch64-*
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
[TIMING:end] tool::ToolBuild { build_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 12.141
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/tests/run-make/cdylib-export-c-library-symbols/rmake.rs:15:
     rustc().input("foo.rs").arg("-lstatic=foo").crate_type("cdylib").run();
 
     if is_darwin() {
-        llvm_nm()
-            .input(dynamic_lib_name("foo"))
-            .run()
-            .assert_stdout_not_contains("T _my_function");
+        llvm_nm().input(dynamic_lib_name("foo")).run().assert_stdout_not_contains("T _my_function");
     } else if is_windows() {
         llvm_readobj()
             .arg("--coff-exports")
Diff in /checkout/tests/run-make/cdylib-export-c-library-symbols/rmake.rs:26:
             .run()
             .assert_stdout_not_contains("my_function");
     } else {
-        llvm_nm()
-            .input(dynamic_lib_name("foo"))
-            .run()
-            .assert_stdout_not_contains("T my_function");
+        llvm_nm().input(dynamic_lib_name("foo")).run().assert_stdout_not_contains("T my_function");
     }
 
     rustc().input("foo_export.rs").arg("-lstatic:+export-symbols=foo").crate_type("cdylib").run();
fmt: checked 6810 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:00:49
  local time: Mon Apr 20 12:59:27 UTC 2026
  network time: Mon, 20 Apr 2026 12:59:27 GMT

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-apple failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: aarch64-apple-darwin, forced_compiler: false }, target: aarch64-apple-darwin } -- 0.001
fmt check
fmt: skipped untracked file AWSCLIV2.pkg
fmt: checked 6810 files
Diff in /Users/runner/work/rust/rust/tests/run-make/cdylib-export-c-library-symbols/rmake.rs:15:
     rustc().input("foo.rs").arg("-lstatic=foo").crate_type("cdylib").run();
 
     if is_darwin() {
-        llvm_nm()
-            .input(dynamic_lib_name("foo"))
-            .run()
-            .assert_stdout_not_contains("T _my_function");
+        llvm_nm().input(dynamic_lib_name("foo")).run().assert_stdout_not_contains("T _my_function");
     } else if is_windows() {
         llvm_readobj()
             .arg("--coff-exports")
Diff in /Users/runner/work/rust/rust/tests/run-make/cdylib-export-c-library-symbols/rmake.rs:26:
             .run()
             .assert_stdout_not_contains("my_function");
     } else {
-        llvm_nm()
-            .input(dynamic_lib_name("foo"))
-            .run()
-            .assert_stdout_not_contains("T my_function");
+        llvm_nm().input(dynamic_lib_name("foo")).run().assert_stdout_not_contains("T my_function");
     }
 
     rustc().input("foo_export.rs").arg("-lstatic:+export-symbols=foo").crate_type("cdylib").run();
Bootstrap failed while executing `--stage 2 test --host=aarch64-apple-darwin --target=aarch64-apple-darwin`
Build completed unsuccessfully in 0:02:18
  local time: Mon Apr 20 13:04:01 UTC 2026
  network time: Mon, 20 Apr 2026 13:04:02 GMT
##[error]Process completed with exit code 1.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 20, 2026

💔 Test for 6bcaf55 failed: CI. Failed jobs:

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

Labels

A-run-make Area: port run-make Makefiles to rmake.rs 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants