Skip to content

fix: add MIPS-specific compiler flag to avoid GOT overflow#1211

Merged
reddevillg merged 1 commit into
OpenAtom-Linyaps:masterfrom
dengbo11:fix-mips-build
Jun 11, 2025
Merged

fix: add MIPS-specific compiler flag to avoid GOT overflow#1211
reddevillg merged 1 commit into
OpenAtom-Linyaps:masterfrom
dengbo11:fix-mips-build

Conversation

@dengbo11

Copy link
Copy Markdown
Collaborator

MIPS architecture and globally applies the -mxgot flag to compiler settings to address potential GOT overflow issues caused by the architecture's strict limitations on GOT size.

@dengbo11 dengbo11 requested review from ComixHe and reddevillg June 10, 2025 11:29
Comment thread CMakeLists.txt Outdated
# MIPS 处理器在设计上对 GOT的大小有严格的限制,在链接了大量的共享库时,GOT 可能会膨胀,导致
# __cxa_begin_catch(或其他任何需要通过 GOT 访问的符号)超出了 16 位偏移量的可寻址范围。 使用-mxgot选项是解决
# R_MIPS_CALL16 溢出最常用的方法。这个选项会告诉 GCC 为全局符号生成使用 32 位偏移量访问 GOT 的代码,从而解除 16
# 位偏移量的限制。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这段描述不准确,建议移除掉

Comment thread CMakeLists.txt Outdated
"${CMAKE_CXX_FLAGS} -mxgot"
CACHE STRING "C++ compiler flags" FORCE)

set(CMAKE_CXX_FLAGS_RELEASE

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

只需要设置 CMAKE_CXX_FLAGS 就够了

Comment thread CMakeLists.txt Outdated
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -mxgot"
CACHE STRING "C++ compiler flags for Release build" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

同上

MIPS architecture and globally applies the `-mxgot` flag to
compiler settings to address potential GOT overflow issues caused by
the architecture's strict limitations on GOT size.
@dengbo11 dengbo11 requested a review from reddevillg June 11, 2025 01:42
@reddevillg reddevillg merged commit 62baa65 into OpenAtom-Linyaps:master Jun 11, 2025
5 of 13 checks passed
@dengbo11 dengbo11 deleted the fix-mips-build branch July 1, 2026 05:49
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