Skip to content

Don't export symbols or synthetic object files in Scratchbox #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions 0009-Dont-export-symbols.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index dd9d277..04d1a21 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1904,6 +1904,10 @@ fn add_linked_symbol_object(
return;
};

+ if std::env::var("SB2_RUST_TARGET_TRIPLE").is_ok() {
+ return;
+ }
+
if file.format() == object::BinaryFormat::Coff {
// NOTE(nbdd0121): MSVC will hang if the input object file contains no sections,
// so add an empty section.
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index 0943451..1e14c79 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -669,6 +669,10 @@ impl<'a> Linker for GccLinker<'a> {
return;
}

+ if std::env::var("SB2_RUST_TARGET_TRIPLE").is_ok() {
+ return;
+ }
+
let is_windows = self.sess.target.is_like_windows;
let path = tmpdir.join(if is_windows { "list.def" } else { "list" });
1 change: 1 addition & 0 deletions rust.spec
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Patch5: 0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch
Patch6: 0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch
Patch7: 0007-Disable-aarch64-outline-atomics-for-now.patch
Patch8: 0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch
Patch9: 0009-Dont-export-symbols.patch
# This is the real rustc spec - the stub one appears near the end.
%ifarch %ix86

Expand Down