Skip to content
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

[SOL] Set default visibility of symbols in SBF binaries to hidden #83

Merged
merged 2 commits into from
Aug 19, 2023
Merged
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
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/sbf_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SECTIONS
TargetOptions {
allow_asm: true,
c_int_width: "64".into(),
default_hidden_visibility: true,
dll_prefix: "".into(),
dynamic_linking: true,
eh_frame_header: false,
Expand Down
9 changes: 9 additions & 0 deletions library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ pub mod __alloc_error_handler {
// called via generated `__rust_alloc_error_handler` if there is no
// `#[alloc_error_handler]`.
#[rustc_std_internal_symbol]
#[cfg(not(target_family = "solana"))]
pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
extern "Rust" {
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
Expand All @@ -417,6 +418,14 @@ pub mod __alloc_error_handler {
))
}
}

#[rustc_std_internal_symbol]
#[cfg(target_family = "solana")]
pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
core::panicking::panic_nounwind_fmt(format_args!(
"memory allocation of {size} bytes failed"
))
}
}

/// Specialize clones into pre-allocated, uninitialized memory.
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/sbf-solana-solana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

RUN PATH="${HOME}/.cargo/bin:${PATH}" \
cargo install --git https://github.com/solana-labs/cargo-run-solana-tests.git \
--rev 12186c99173cc30771897932159b53acca836321 \
--rev 6d90ebb6bde748a4ce6f415ed85dc3fb42b1e97b \
--bin cargo-run-solana-tests --root /usr/local

COPY scripts/sccache.sh /scripts/
Expand Down
Loading