Skip to content

Commit a825b51

Browse files
Respect LDFLAGS in memcmp_check (#958)
This check invokes the compiled executable and hence needs to link it. CMake handles this via LDFLAGS but `cc` doesn't. In setups with custom linker setups this could lead to a mismatch between the expected and the actually used linker. Explicitly respecting LDFLAGS here brings us back to parity with CMake. Fixes #858 whose resolution is not applicable if ignoring compiler warnings is not an option. Co-authored-by: Aaron Siddhartha Mondal <aaron.mondal@gmail.com>
1 parent f67e605 commit a825b51

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

aws-lc-sys/builder/cc_builder.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,18 @@ impl CcBuilder {
602602
return;
603603
}
604604
let mut memcmp_compile_args = Vec::from(memcmp_compiler.args());
605+
606+
// This check invokes the compiled executable and hence needs to link
607+
// it. CMake handles this via LDFLAGS but `cc` doesn't. In setups with
608+
// custom linker setups this could lead to a mismatch between the
609+
// expected and the actually used linker. Explicitly respecting LDFLAGS
610+
// here brings us back to parity with CMake.
611+
if let Ok(ldflags) = std::env::var("LDFLAGS") {
612+
for flag in ldflags.split_whitespace() {
613+
memcmp_compile_args.push(flag.into());
614+
}
615+
}
616+
605617
memcmp_compile_args.push(
606618
self.manifest_dir
607619
.join("aws-lc")

0 commit comments

Comments
 (0)