RT-Thread / RT-Thread/rt-thread

[Bug] 很多bsp对c++的自动构造函数支持有问题

Open
#11,778 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Arch: RISC-V BSP BSP: HPMicro bug
Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

RT-Thread Version

master

Affected area

Board Support Package (BSP)

Hardware/BSP vendor

HPMicro

Architecture

RISC-V

Board and hardware details

hpm

Develop Toolchain

GCC

Describe the bug

cplusplus_system_init 目前只调用[ctors_start, ctors_end),而 GCC(可能是新版特性) 把 ctor 放在 .init_array了。

我拿ci检测了一下:https://github.com/kaidegit/rt-thread/actions/runs/33521591507

解决方案是规范一下链接脚本(把init array也放到[ctors_start, ctors_end)),还是cplusplus_system_init也跑一下init array部分呢?

Other additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cplusplus_system_init and the HPMicro BSP linker scripts, then reproduce the constructor behavior using the linked CI run and GCC toolchain described in the issue. Compare the __ctors range with .init_array handling and verify that all C++ static constructors are executed on the affected RISC-V board without breaking other BSPs.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.