Giter VIP home page Giter VIP logo

Comments (4)

laanwj avatar laanwj commented on July 24, 2024

FWIW this is on K210 and all memory regions are simply aliased to SRAM, sections are not treated any differently there:

MEMORY
{
    SRAM : ORIGIN = 0x80000000, LENGTH = 6M
…
}

REGION_ALIAS("REGION_TEXT", SRAM);
REGION_ALIAS("REGION_RODATA", SRAM);
REGION_ALIAS("REGION_DATA", SRAM);
REGION_ALIAS("REGION_BSS", SRAM);
REGION_ALIAS("REGION_HEAP", SRAM);
REGION_ALIAS("REGION_STACK", SRAM);

from riscv-rt.

Disasm avatar Disasm commented on July 24, 2024

To be honest, I'm not good at writing linker scripts and almost sure we can do better. However, I have no idea how to achieve this. The output you see is probably due to the .stack section existence, and I added this section to be able to check for the total stack size like this:

riscv-rt/link.x

Lines 159 to 161 in 2d05df6

ASSERT(SIZEOF(.stack) > (_max_hart_id + 1) * _hart_stack_size, "
ERROR(riscv-rt): .stack section is too small for allocating stacks for all the harts.
Consider changing `_max_hart_id` or `_hart_stack_size`.");

from riscv-rt.

laanwj avatar laanwj commented on July 24, 2024

Pretty sure that that should work.

I looked into it a bit yesterday (even as far as looking into the lld ELF generation code) and I'm baffled. From everything I saw, (NOLOAD) should be enough to get both no PT_LOAD flag a SHT_NOBITS section, the same combination as .bss. However while PT_LOAD is successfully disabled (so this doesn't actually affect anything),, it is a SHT_PROGBITS section. This combination is sometimes used for metadata and such. But it's obviously not what we want here.

So I'm starting to think it could be some lld issue. But not sure.

Separately from this, we could consider making the section only as big as needed instead of cover all of memory. Make it start AT((_stack_start - _hart_stack_size, * (_max_hart_id + 1)) and be exactly _hart_stack_size, * (_max_hart_id + 1) bytes large.
But I'm not sure that can be expressed.

from riscv-rt.

Disasm avatar Disasm commented on July 24, 2024

This seems to be a known (and fixed) issue: rust-lang/rust#73201
Introduced in nightly-2020-05-22 by LLVM update rust-lang/rust#67759, fixed in nightly-2020-06-08 by rust-lang/rust#73072
Present in stable 1.45.0 and 1.45.1, fixed in beta 1.46.0.

from riscv-rt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.