Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

_stext fails to move .text with lld #188

@yodaldevoid

Description

@yodaldevoid

I have an older program/library that I am moving to lld so that I can work with ease on more than just Linux. The code in question is https://github.com/yodaldevoid/mkl26/tree/lld_port. Please note that the example/library currently require nightly and should be built for thumbv6m-none-eabi.

To start, the code compiles and runs correctly using gcc's linker.

When attempting to compile the blink example with lld using cargo build --example blink I get the following error:

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "-L" "C:\\Users\\ga29s\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv6m-none-eabi\\lib" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\examples\\blink-288c8e46abd20a15.blink.2hpe9hsl-cgu.0.rcgu.o" "-o" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\examples\\blink-288c8e46abd20a15" "--gc-sections" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\deps" "-L" "E:\\mkl26\\target\\debug\\deps" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\build\\mkl26-36049ce57ff99828\\out" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\build\\mkl26-36049ce57ff99828\\out" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\build\\cortex-m-rt-6e1f169148af1ece\\out" "-L" "C:\\Users\\ga29s\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv6m-none-eabi\\lib" "-Bstatic" "C:\\Users\\ga29s\\AppData\\Local\\Temp\\rustcVhEipN\\libcortex_m_rt-193fc16ad349c2cc.rlib" "C:\\Users\\ga29s\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv6m-none-eabi\\lib\\libcompiler_builtins-41a0f49e919d94c0.rlib" "-Tlink.x" "-Bdynamic"
  = note: rust-lld: error:
          ERROR(cortex-m-rt): The .text section can't be placed inside the .vector_table section
          Set _stext to an address greater than the end of .vector_table (See output of `nm`)


error: aborting due to previous error

error: Could not compile `mkl26`.

To learn more, run the command again with --verbose.

If I change line 20 in memory.x to _stext = 0x410; I then get the following error:

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "-L" "C:\\Users\\ga29s\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv6m-none-eabi\\lib" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\examples\\blink-288c8e46abd20a15.blink.2hpe9hsl-cgu.0.rcgu.o" "-o" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\examples\\blink-288c8e46abd20a15" "--gc-sections" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\deps" "-L" "E:\\mkl26\\target\\debug\\deps" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\build\\mkl26-36049ce57ff99828\\out" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\build\\mkl26-36049ce57ff99828\\out" "-L" "E:\\mkl26\\target\\thumbv6m-none-eabi\\debug\\build\\cortex-m-rt-6e1f169148af1ece\\out" "-L" "C:\\Users\\ga29s\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv6m-none-eabi\\lib" "-Bstatic" "C:\\Users\\ga29s\\AppData\\Local\\Temp\\rustcy1mc9U\\libcortex_m_rt-193fc16ad349c2cc.rlib" "C:\\Users\\ga29s\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv6m-none-eabi\\lib\\libcompiler_builtins-41a0f49e919d94c0.rlib" "-Tlink.x" "-Bdynamic"
  = note: rust-lld: error: section .flashconfig file range overlaps with .vector_table
          >>> .flashconfig range is [0x1000, 0x100F]
          >>> .vector_table range is [0x1000, 0x10BF]

          rust-lld: error: section .flashconfig virtual address range overlaps with .vector_table
          >>> .flashconfig range is [0x0, 0xF]
          >>> .vector_table range is [0x0, 0xBF]

          rust-lld: error: section .flashconfig load address range overlaps with .vector_table
          >>> .flashconfig range is [0x0, 0xF]
          >>> .vector_table range is [0x0, 0xBF]


error: aborting due to previous error

error: Could not compile `mkl26`.

To learn more, run the command again with --verbose.

It appears that .flashconfig is not being placed at 0x400 despite what the linker script says. Am I doing something wrong here or is this some sort of bug?

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