Skip to content

修复 ARM 机器上编译 RT-Thread 失败的情况 (fixes #10)#11

Open
Chen-Yuanmeng wants to merge 2 commits into
NJU-ProjectN:masterfrom
Chen-Yuanmeng:fix-2
Open

修复 ARM 机器上编译 RT-Thread 失败的情况 (fixes #10)#11
Chen-Yuanmeng wants to merge 2 commits into
NJU-ProjectN:masterfrom
Chen-Yuanmeng:fix-2

Conversation

@Chen-Yuanmeng

Copy link
Copy Markdown

本 PR 修复了 #10 中遇到的两个问题

  1. 修复 native 模式下的 libc 类型冲突

    native 模式直接使用宿主 libc 提供的 POSIX 类型,不再重复定义 useconds_t 等类型;同时兼容 glibc 与 RT-Thread 不同的
    timeval 头文件保护宏,避免 struct timeval 重复定义。

  2. 修复 AArch64 下的 GOT relocation 错误

    集成 AM 应用时,objcopy --prefix-symbols 会错误重命名链接器保留符号 GLOBAL_OFFSET_TABLE。本修复将该符号恢复为原
    名,确保 AArch64 PIE 链接器能够正确处理 GOT 相关重定位。

Copilot AI review requested due to automatic review settings July 21, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 旨在修复 ARM 架构 GNU/Linux 环境下,RT-Thread 在 ARCH=native 场景编译/链接失败的问题(对应 issue #10),分别从 native 模式的 POSIX 类型冲突与 AArch64 GOT 相关重定位错误两方面做了兼容性修正。

Changes:

  • native 模式下避免重复定义 useconds_t/suseconds_t,并通过 _TIMEVAL_DEFINED 兼容 glibc/RT-Thread 对 struct timeval 的头文件保护宏差异。
  • AM 应用集成脚本中将 _GLOBAL_OFFSET_TABLE_ 纳入符号重命名恢复列表,避免 objcopy --prefix-symbols 破坏 AArch64 PIE 链接所需的链接器保留符号。

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
bsp/abstract-machine/include/extra.h native 下改用宿主 libc 类型,并通过 _TIMEVAL_DEFINED 避免 timeval 重复定义。
bsp/abstract-machine/integrate-am-apps.py 防止 _GLOBAL_OFFSET_TABLE_ 被错误加前缀后无法参与 GOT 重定位。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +7
/* glibc uses __timeval_defined, while RT-Thread checks this guard. */
#define _TIMEVAL_DEFINED

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是严谨的

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants