修复 ARM 机器上编译 RT-Thread 失败的情况 (fixes #10)#11
Open
Chen-Yuanmeng wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
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 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本 PR 修复了 #10 中遇到的两个问题
修复 native 模式下的 libc 类型冲突
native 模式直接使用宿主 libc 提供的 POSIX 类型,不再重复定义 useconds_t 等类型;同时兼容 glibc 与 RT-Thread 不同的
timeval 头文件保护宏,避免 struct timeval 重复定义。
修复 AArch64 下的 GOT relocation 错误
集成 AM 应用时,objcopy --prefix-symbols 会错误重命名链接器保留符号 GLOBAL_OFFSET_TABLE。本修复将该符号恢复为原
名,确保 AArch64 PIE 链接器能够正确处理 GOT 相关重定位。