Skip to content

riscv32imac-unknown-xous-elf: rust-lld gives offset is outside the section errors #103949

Open
@xobs

Description

Version it worked on

It most recently worked on: Rust 1.64.0

Version with regression

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-pc-windows-msvc
release: 1.65.0
LLVM version: 15.0.0

Description

Building crates for the riscv32imac-unknown-xous-elf target sometimes results in a link error. This began with Rust 1.65.0. For example:

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "C:\\Users\\Sean\\AppData\\Local\\Temp\\rustcR77RGd\\symbols.o" "E:\\Code\\Xous\\Core\\target\\riscv32imac-unknown-xous-elf\\release\\deps\\pddb-8aba67b084ba8fc1.pddb-b3f235aec8c95441.n927u1iqdxcieg4.rcgu.o.rcgu.o" "--as-needed" "-L" "E:\\Code\\Xous\\Core\\target\\riscv32imac-unknown-xous-elf\\release\\deps" "-L" "E:\\Code\\Xous\\Core\\target\\release\\deps" "-L" "E:\\Code\\Xous\\Core\\target\\riscv32imac-unknown-xous-elf\\release\\build\\xous-08f083a692e5c29b\\out" "-L" "C:\\Users\\Sean\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-xous-elf\\lib" "-Bstatic" "C:\\Users\\Sean\\AppData\\Local\\Temp\\rustcR77RGd\\libxous-26655dcc7bb206b6.rlib" "C:\\Users\\Sean\\AppData\\Local\\Temp\\rustcR77RGd\\libxous-d175a8531300a7f7.rlib" "C:\\Users\\Sean\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-xous-elf\\lib\\libcompiler_builtins-67716ddc427f4546.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "C:\\Users\\Sean\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\riscv32imac-unknown-xous-elf\\lib" "-o" "E:\\Code\\Xous\\Core\\target\\riscv32imac-unknown-xous-elf\\release\\deps\\pddb-8aba67b084ba8fc1" "--gc-sections" "-O1"
  = note: rust-lld: error: E:\Code\Xous\Core\target\riscv32imac-unknown-xous-elf\release\deps\pddb-8aba67b084ba8fc1.pddb-b3f235aec8c95441.n927u1iqdxcieg4.rcgu.o.rcgu.o:(.rodata.cst32): offset is outside the section


error: could not compile `pddb` due to previous error

Background

We build a custom libstd for the riscv32imac-unknown-xous-elf target, which is a Tier-3 target. This repository is at https://github.com/betrusted-io/rust. We are working on preparing patches for upstream that do not add any external dependencies, but this work is taking time. As a result, we generally forward-port our patchset every six weeks once the stable build is released.

When building packages for the Betrusted platform, our build system compiles around 27 packages. Many of these packages succeed, but with Rust 1.65.0 we have three packages fail.

This target does not have a linker script, and instead relies on the default one provided by rust-lld.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.O-xousOS: A microkernel OS for privacy in computingP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions