Skip to content

LLD crash: Inserting c.j Reset at Entry point instead of jal zero, Reset #2

@aurabindo

Description

@aurabindo

I tried the following change in global_asm where I renamed the original Reset in the example to Premain.
The linker is crashing :

global_asm!(r#"
.section .text
global Reset
Reset:
.option rvc
	c.j Premain

.globl abort
abort:
  jal zero, abort
"#);

But the linker crashes:

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name rust_picosoc src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="simple_uart"' -C metadata=8032c5e0bc7a6620 -C extra-filename=-8032c5e0bc7a6620 --out-dir /media/aj/Buffer/git-clones/picosoc-example/target/riscv32imac-unknown-none-elf/release/deps --target riscv32imac-unknown-none-elf -L dependency=/media/aj/Buffer/git-clones/picosoc-example/target/riscv32imac-unknown-none-elf/release/deps -L dependency=/media/aj/Buffer/git-clones/picosoc-example/target/release/deps --extern panic_abort=/media/aj/Buffer/git-clones/picosoc-example/target/riscv32imac-unknown-none-elf/release/deps/libpanic_abort-7fe772e4504c44d7.rlib --extern r0=/media/aj/Buffer/git-clones/picosoc-example/target/riscv32imac-unknown-none-elf/release/deps/libr0-a508df8919a0e554.rlib --extern volatile_register=/media/aj/Buffer/git-clones/picosoc-example/target/riscv32imac-unknown-none-elf/release/deps/libvolatile_register-819b7aad3e10e33f.rlib -C link-arg=-Tlink.x` (signal: 11, SIGSEGV: invalid memory reference)

Am I doing it right, or should it be done in another way ? main.rs: https://pastebin.com/7AfTcNV1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions