Skip to content

Add leading underscore to asm symbols on Mach-O#1630

Merged
bjorn3 merged 1 commit intorust-lang:mainfrom
CathalMullan:mach-o
Mar 2, 2026
Merged

Add leading underscore to asm symbols on Mach-O#1630
bjorn3 merged 1 commit intorust-lang:mainfrom
CathalMullan:mach-o

Conversation

@CathalMullan
Copy link
Contributor

Fixes the linking error mentioned in ctz/graviola#127 (comment)

Tested manually on a M1 host.

Copy link
Member

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

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

@bjorn3
Copy link
Member

bjorn3 commented Mar 2, 2026

How long do a from-scratch cargo build and cargo test take for graviola? If it is fairly short (ideally <1min), maybe it could be added to CI?

@CathalMullan
Copy link
Contributor Author

Yeah, should take less than a minute to run the lib tests.

@bjorn3
Copy link
Member

bjorn3 commented Mar 2, 2026

If you want to work on adding it to CI, you can add it to https://github.com/rust-lang/rustc_codegen_cranelift/blob/main/build_system/tests.rs

The git repo and cargo project are defined like

pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
"rust-lang",
"regex",
"061ee815ef2c44101dba7b0b124600fcb03c1912",
"dc26aefbeeac03ca",
"regex",
);
static REGEX: CargoProject = CargoProject::new(REGEX_REPO.source_dir(), "regex_target");
and should be added after
crate::tests::REGEX_REPO.fetch(dirs);
The actual test instructions should be added to
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
TestCase::custom("test.rust-random/rand", &|runner| {
RAND_REPO.patch(&runner.dirs);
RAND.clean(&runner.dirs);
if runner.is_native {
let mut test_cmd = RAND.test(&runner.target_compiler, &runner.dirs);
test_cmd.arg("--workspace").arg("--").arg("-q");
spawn_and_wait(test_cmd);
} else {
eprintln!("Cross-Compiling: Not running tests");
let mut build_cmd = RAND.build(&runner.target_compiler, &runner.dirs);
build_cmd.arg("--workspace").arg("--tests");
spawn_and_wait(build_cmd);
}
}),
TestCase::custom("test.regex", &|runner| {
REGEX_REPO.patch(&runner.dirs);
REGEX.clean(&runner.dirs);
if runner.is_native {
let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs);
// regex-capi and regex-debug don't have any tests. Nor do they contain any code
// that is useful to test with cg_clif. Skip building them to reduce test time.
run_cmd.args([
"-p",
"regex",
"-p",
"regex-syntax",
"--release",
"--all-targets",
"--",
"-q",
]);
spawn_and_wait(run_cmd);
let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs);
// don't run integration tests for regex-autonata. they take like 2min each without
// much extra coverage of simd usage.
run_cmd.args(["-p", "regex-automata", "--release", "--lib", "--", "-q"]);
spawn_and_wait(run_cmd);
} else {
eprintln!("Cross-Compiling: Not running tests");
let mut build_cmd = REGEX.build(&runner.target_compiler, &runner.dirs);
build_cmd.arg("--tests");
spawn_and_wait(build_cmd);
}
}),
TestCase::custom("test.portable-simd", &|runner| {
apply_patches(
&runner.dirs,
"portable-simd",
&runner.stdlib_source.join("library/portable-simd"),
&PORTABLE_SIMD_SRC.to_path(&runner.dirs),
);
PORTABLE_SIMD.clean(&runner.dirs);
let build_cmd = PORTABLE_SIMD.build(&runner.target_compiler, &runner.dirs);
// FIXME uncomment once examples work: https://github.com/rust-lang/portable-simd/issues/470
//build_cmd.arg("--all-targets");
spawn_and_wait(build_cmd);
if runner.is_native {
let mut test_cmd = PORTABLE_SIMD.test(&runner.target_compiler, &runner.dirs);
// FIXME remove --tests once examples work: https://github.com/rust-lang/portable-simd/issues/470
test_cmd.arg("-q").arg("--tests");
spawn_and_wait(test_cmd);
}
}),
];
and finally it should be added to
testsuite.extended_sysroot
test.rust-random/rand
test.regex
test.portable-simd
to enable the test.

Alternatively I may have time to add it somewhere in the coming days.

@bjorn3 bjorn3 merged commit 8b478b4 into rust-lang:main Mar 2, 2026
24 checks passed
@CathalMullan CathalMullan deleted the mach-o branch March 2, 2026 23:00
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