Force PIC as the final x64 compiler flag.
Some checks failed
Tagged release / prepare-release (push) Successful in 3m0s
Tagged release / build-linux-x64 (push) Failing after 12m8s
Tagged release / build-macos (push) Has been skipped
Tagged release / build-linux-arm64 (push) Has been skipped
Tagged release / build-windows (push) Has been skipped
Tagged release / publish-release (push) Has been skipped

This commit is contained in:
Hermes Agent
2026-08-14 19:40:11 +00:00
parent cfe3aa5c2c
commit 35eec1d000
4 changed files with 29 additions and 4 deletions

View File

@@ -148,8 +148,8 @@ fn tagged_releases_are_built_and_packaged_with_rust_tools() {
"publish",
"PKG_CONFIG_ALLOW_CROSS",
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER",
"CC_x86_64_unknown_linux_gnu: x86_64-linux-gnu-gcc -fPIC",
"CXX_x86_64_unknown_linux_gnu: x86_64-linux-gnu-g++ -fPIC",
"export CC_x86_64_unknown_linux_gnu=\"$PWD/.gitea/scripts/x86_64-linux-gnu-gcc-pic\"",
"export CXX_x86_64_unknown_linux_gnu=\"$PWD/.gitea/scripts/x86_64-linux-gnu-g++-pic\"",
"unset ZSTD_SYS_USE_PKG_CONFIG",
] {
assert!(
@@ -260,3 +260,22 @@ fn tagged_releases_are_built_and_packaged_with_rust_tools() {
assert!(release_source.contains("rewrite_macho_rpaths"));
assert!(!release_source.contains("Linux releases contain the portable CLI tools"));
}
#[test]
fn x64_cross_compiler_wrappers_append_pic_last() {
for (script, compiler) in [
("x86_64-linux-gnu-gcc-pic", "x86_64-linux-gnu-gcc"),
("x86_64-linux-gnu-g++-pic", "x86_64-linux-gnu-g++"),
] {
let contents = fs::read_to_string(
Path::new(CRATE_DIR)
.join("../../.gitea/scripts")
.join(script),
)
.unwrap();
assert_eq!(
contents,
format!("#!/bin/sh\nexec {compiler} \"$@\" -fPIC\n")
);
}
}