Skip to content

Commit 0c451d3

Browse files
authored
Unrolled build for rust-lang#117118
Rollup merge of rust-lang#117118 - bzEq:aix-linker, r=wesleywiser [AIX] Remove AixLinker's debuginfo() implementation AIX ld's `-s` option doesn't perfectly fit` debuginfo()`'s semantics and may unexpectedly remove metadata in shared libraries. Remove the implementation of `AixLinker` and suggest user to use `strip` utility instead.
2 parents f4b771b + b1c3909 commit 0c451d3

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+15
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,21 @@ fn link_natively<'a>(
10811081
}
10821082
}
10831083

1084+
if sess.target.is_like_aix {
1085+
let stripcmd = "/usr/bin/strip";
1086+
match strip {
1087+
Strip::Debuginfo => {
1088+
// FIXME: AIX's strip utility only offers option to strip line number information.
1089+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-l"))
1090+
}
1091+
Strip::Symbols => {
1092+
// Must be noted this option might remove symbol __aix_rust_metadata and thus removes .info section which contains metadata.
1093+
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-r"))
1094+
}
1095+
Strip::None => {}
1096+
}
1097+
}
1098+
10841099
Ok(())
10851100
}
10861101

compiler/rustc_codegen_ssa/src/back/linker.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1640,16 +1640,7 @@ impl<'a> Linker for AixLinker<'a> {
16401640

16411641
fn ehcont_guard(&mut self) {}
16421642

1643-
fn debuginfo(&mut self, strip: Strip, _: &[PathBuf]) {
1644-
match strip {
1645-
Strip::None => {}
1646-
// FIXME: -s strips the symbol table, line number information
1647-
// and relocation information.
1648-
Strip::Debuginfo | Strip::Symbols => {
1649-
self.cmd.arg("-s");
1650-
}
1651-
}
1652-
}
1643+
fn debuginfo(&mut self, _: Strip, _: &[PathBuf]) {}
16531644

16541645
fn no_crt_objects(&mut self) {}
16551646

0 commit comments

Comments
 (0)