[GH-ISSUE #1] AArch64 环境下全静态链接导致 GNU ld 溢出报错,且运行时启动即报段错误 #1

Open
opened 2026-10-26 09:51:50 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @zerain050424 on GitHub (Oct 10, 2026).
Original GitHub issue: https://github.com/deepseek-ai/clangd-ascend/issues/1


环境信息

  • 架构: AArch64 (ARM64)
  • 操作系统: Linux (Docker 容器环境 / Ubuntu 22.04)
  • 编译器: GCC 11.x
  • 代码版本: 最新 main 分支

问题描述

在 AArch64 架构下运行 ./scripts/build-clangd.sh 构建时,由于脚本启用了全静态链接(-static),会遇到问题:

  1. 默认 GNU ld 链接失败:
    链接器处理静态 GOT 时超出 15 位寻址限制,报 relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 失败退出。

报错日志

1. GNU ld 报错:

/usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(libc-start.o): in function `__libc_start_main_impl':
(.text+0x200): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__rela_iplt_end' defined in .rela.plt section in bin/clangd
/usr/bin/ld: (.text+0x200): warning: too many GOT entries for -fpic, please recompile with -fPIC
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status
Originally created by @zerain050424 on GitHub (Oct 10, 2026). Original GitHub issue: https://github.com/deepseek-ai/clangd-ascend/issues/1 --- ### 环境信息 - **架构**: AArch64 (ARM64) - **操作系统**: Linux (Docker 容器环境 / Ubuntu 22.04) - **编译器**: GCC 11.x - **代码版本**: 最新 main 分支 ### 问题描述 在 AArch64 架构下运行 `./scripts/build-clangd.sh` 构建时,由于脚本启用了全静态链接(`-static`),会遇到问题: 1. **默认 GNU ld 链接失败**: 链接器处理静态 GOT 时超出 15 位寻址限制,报 `relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15` 失败退出。 ### 报错日志 **1. GNU ld 报错:** ```text /usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(libc-start.o): in function `__libc_start_main_impl': (.text+0x200): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__rela_iplt_end' defined in .rela.plt section in bin/clangd /usr/bin/ld: (.text+0x200): warning: too many GOT entries for -fpic, please recompile with -fPIC /usr/bin/ld: final link failed collect2: error: ld returned 1 exit status
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/clangd-ascend#1
No description provided.