Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
21
Star
51
Fork
182
openEuler
/
llvm-project
Code
Issues
57
Pull Requests
41
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
Support fno-plt like gcc on aarch64
Done
#IBS1SN
Bug
luofeng14
Opened this issue
2025-03-10 11:19
**【缺陷描述】:请补充详细的缺陷问题现象描述** #### Environment - Arch: aarch64 - Clang Version: Clang 19 dev or 17 dev - GCC Version: (e.g., gcc version 10.3) - Compiler Flags: -fno-plt #### Description: I encountered an issue with the -fno-plt option in Clang 19 dev (development version) on aarch64. When compiling code with -fno-plt, Clang still generates PLT (Procedure Linkage Table) entries for function calls, whereas GCC behaves correctly and does not generate PLT entries. This issue affects scenarios where direct GOT-based access is expected, and the presence of PLT entries may lead to unnecessary indirection and performance overhead. Compile the following code with Clang 19 dev and -fno-plt ``` // gcc 1.c -shared -fno-plt -O0 -o libnoplt-clang.so -fPIC // clang 1.c -shared -fno-plt -O0 -o libnoplt-gcc.so -fPIC int bar(int a) { return 10; } int foo(int a) { return bar(a); } ``` The Clang-compiled version generates PLT functions, while the GCC version does not. ``` // libnoplt-clang.so Disassembly of section .plt: 0000000000000440 <.plt>: 440: a9bf7bf0 stp x16, x30, [sp, #-16]! 444: f00000f0 adrp x16, 1f000 <__FRAME_END__+0x1e934> 448: f947fe11 ldr x17, [x16, #4088] 44c: 913fe210 add x16, x16, #0xff8 450: d61f0220 br x17 454: d503201f nop 458: d503201f nop 45c: d503201f nop 0000000000000470 <bar@plt>: 470: 90000110 adrp x16, 20000 <__cxa_finalize@GLIBC_2.17> 474: f9400611 ldr x17, [x16, #8] 478: 91002210 add x16, x16, #0x8 47c: d61f0220 br x17 0000000000000588 <foo>: 588: d10083ff sub sp, sp, #0x20 58c: a9017bfd stp x29, x30, [sp, #16] 590: 910043fd add x29, sp, #0x10 594: b81fc3a0 stur w0, [x29, #-4] 598: b85fc3a0 ldur w0, [x29, #-4] 59c: 97ffffb5 bl 470 <bar@plt> 5a0: a9417bfd ldp x29, x30, [sp, #16] 5a4: 910083ff add sp, sp, #0x20 5a8: d65f03c0 ret ``` ``` // libnoplt-gcc.so 00000000000005c4 <bar>: 5c4: d10043ff sub sp, sp, #0x10 5c8: b9000fe0 str w0, [sp, #12] 5cc: 52800140 mov w0, #0xa // #10 5d0: 910043ff add sp, sp, #0x10 5d4: d65f03c0 ret 00000000000005d8 <foo>: 5d8: a9be7bfd stp x29, x30, [sp, #-32]! 5dc: 910003fd mov x29, sp 5e0: b9001fe0 str w0, [sp, #28] 5e4: b9401fe0 ldr w0, [sp, #28] 5e8: f00000e1 adrp x1, 1f000 <__FRAME_END__+0x1e900> 5ec: f947e821 ldr x1, [x1, #4048] 5f0: d63f0020 blr x1 5f4: a8c27bfd ldp x29, x30, [sp], #32 5f8: d65f03c0 ret ``` Currently, LLVM has only been processed for the x86 and ARM + Mach-O architecture, but there are still problems with the aarch64 architecture. **relevant issue:** [Support fno-plt like gcc](https://github.com/llvm/llvm-project/issues/78275) **relevant pr:** [Implement -fno-plt for SelectionDAG/GlobalISel](https://github.com/llvm/llvm-project/pull/78890) **一、缺陷信息** **【缺陷所属的os版本】(如openEuler-22.03-LTS,参考命令"cat /etc/os-release"结果)** NA **【内核版本】(如kernel-5.10.0-60.138.0.165,参考命令"uname -r"结果)** NA **【缺陷所属软件及版本号】(如kernel-5.10.0-60.138.0.165,参考命令"rpm -q 包名"结果)** dev17/dev19 **【环境信息】** 硬件信息 - 提供跟硬件相关的信息,如架构、cpu和内存规格等 - 虚拟机场景,额外补充宿主机os版本类型 软件信息 - 跟缺陷所属软件相关的其它软件版本信息(如软件包构建失败由gcc引起,请填写gcc的版本号) 网络信息 - 如果有特殊组网,请提供网络拓扑信息以及网络数据走向 **【问题复现步骤】:请描述具体的操作步骤** **【实际结果】**,请描述出问题的结果和影响 **【期望结果】**,请描述出期望的结果和影响 **【其他相关附件信息】** 比如系统message日志/组件日志、dump信息、图片等 **【缺陷详情及分析指导参考链接】**
**【缺陷描述】:请补充详细的缺陷问题现象描述** #### Environment - Arch: aarch64 - Clang Version: Clang 19 dev or 17 dev - GCC Version: (e.g., gcc version 10.3) - Compiler Flags: -fno-plt #### Description: I encountered an issue with the -fno-plt option in Clang 19 dev (development version) on aarch64. When compiling code with -fno-plt, Clang still generates PLT (Procedure Linkage Table) entries for function calls, whereas GCC behaves correctly and does not generate PLT entries. This issue affects scenarios where direct GOT-based access is expected, and the presence of PLT entries may lead to unnecessary indirection and performance overhead. Compile the following code with Clang 19 dev and -fno-plt ``` // gcc 1.c -shared -fno-plt -O0 -o libnoplt-clang.so -fPIC // clang 1.c -shared -fno-plt -O0 -o libnoplt-gcc.so -fPIC int bar(int a) { return 10; } int foo(int a) { return bar(a); } ``` The Clang-compiled version generates PLT functions, while the GCC version does not. ``` // libnoplt-clang.so Disassembly of section .plt: 0000000000000440 <.plt>: 440: a9bf7bf0 stp x16, x30, [sp, #-16]! 444: f00000f0 adrp x16, 1f000 <__FRAME_END__+0x1e934> 448: f947fe11 ldr x17, [x16, #4088] 44c: 913fe210 add x16, x16, #0xff8 450: d61f0220 br x17 454: d503201f nop 458: d503201f nop 45c: d503201f nop 0000000000000470 <bar@plt>: 470: 90000110 adrp x16, 20000 <__cxa_finalize@GLIBC_2.17> 474: f9400611 ldr x17, [x16, #8] 478: 91002210 add x16, x16, #0x8 47c: d61f0220 br x17 0000000000000588 <foo>: 588: d10083ff sub sp, sp, #0x20 58c: a9017bfd stp x29, x30, [sp, #16] 590: 910043fd add x29, sp, #0x10 594: b81fc3a0 stur w0, [x29, #-4] 598: b85fc3a0 ldur w0, [x29, #-4] 59c: 97ffffb5 bl 470 <bar@plt> 5a0: a9417bfd ldp x29, x30, [sp, #16] 5a4: 910083ff add sp, sp, #0x20 5a8: d65f03c0 ret ``` ``` // libnoplt-gcc.so 00000000000005c4 <bar>: 5c4: d10043ff sub sp, sp, #0x10 5c8: b9000fe0 str w0, [sp, #12] 5cc: 52800140 mov w0, #0xa // #10 5d0: 910043ff add sp, sp, #0x10 5d4: d65f03c0 ret 00000000000005d8 <foo>: 5d8: a9be7bfd stp x29, x30, [sp, #-32]! 5dc: 910003fd mov x29, sp 5e0: b9001fe0 str w0, [sp, #28] 5e4: b9401fe0 ldr w0, [sp, #28] 5e8: f00000e1 adrp x1, 1f000 <__FRAME_END__+0x1e900> 5ec: f947e821 ldr x1, [x1, #4048] 5f0: d63f0020 blr x1 5f4: a8c27bfd ldp x29, x30, [sp], #32 5f8: d65f03c0 ret ``` Currently, LLVM has only been processed for the x86 and ARM + Mach-O architecture, but there are still problems with the aarch64 architecture. **relevant issue:** [Support fno-plt like gcc](https://github.com/llvm/llvm-project/issues/78275) **relevant pr:** [Implement -fno-plt for SelectionDAG/GlobalISel](https://github.com/llvm/llvm-project/pull/78890) **一、缺陷信息** **【缺陷所属的os版本】(如openEuler-22.03-LTS,参考命令"cat /etc/os-release"结果)** NA **【内核版本】(如kernel-5.10.0-60.138.0.165,参考命令"uname -r"结果)** NA **【缺陷所属软件及版本号】(如kernel-5.10.0-60.138.0.165,参考命令"rpm -q 包名"结果)** dev17/dev19 **【环境信息】** 硬件信息 - 提供跟硬件相关的信息,如架构、cpu和内存规格等 - 虚拟机场景,额外补充宿主机os版本类型 软件信息 - 跟缺陷所属软件相关的其它软件版本信息(如软件包构建失败由gcc引起,请填写gcc的版本号) 网络信息 - 如果有特殊组网,请提供网络拓扑信息以及网络数据走向 **【问题复现步骤】:请描述具体的操作步骤** **【实际结果】**,请描述出问题的结果和影响 **【期望结果】**,请描述出期望的结果和影响 **【其他相关附件信息】** 比如系统message日志/组件日志、dump信息、图片等 **【缺陷详情及分析指导参考链接】**
Comments (
1
)
Sign in
to comment
Status
Done
Backlog
已挂起
Fixing
Confirmed
Done
Accepted
Canceled
Assignees
Not set
Labels
sig/Compiler
Not set
Projects
Unprojected
Unprojected
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (13)
Tags (37)
dev_17.0.6
dev_19.1.7
dev_16.0.6
open-source-summer-2025
feature-sme-matrix
main
open-source-summer-2024
dev_18.1.8
for-codesize
open-source-summer-2023
dev_15.0.7
release/16.x
release/15.x
llvm-for-oE-19.1.7-2512.0.1
llvm-for-oE-17.0.6-2512.0.1
llvm-for-oE-17.0.6-2509.0.2
llvm-for-oE-17.0.6-2509.0.1
llvm-for-oE-19.1.7-2506.0.2
llvm-for-oE-17.0.6-2506.0.4
llvm-for-oE-17.0.6-2506.0.3
llvm-for-oE-17.0.6-2506.0.2
llvm-for-oE-19.1.7-2506.0.1
llvm-for-oE-17.0.6-2506.0.1
llvm-for-oE-17.0.6-2503.0.2
llvm-for-oE-17.0.6-2503.0.1
llvmorg-16.0.0-rc3
llvmorg-16.0.0-rc2
llvmorg-16.0.0-rc1
llvmorg-17-init
llvmorg-15.0.7
llvmorg-15.0.6
llvmorg-15.0.5
llvmorg-15.0.4
llvmorg-15.0.3
llvmorg-15.0.2
llvmorg-15.0.1
llvmorg-15.0.0
llvmorg-15.0.0-rc3
llvmorg-15.0.0-rc2
llvmorg-15.0.0-rc1
llvmorg-16-init
llvmorg-14.0.6
llvmorg-14.0.5
llvmorg-14.0.4
llvmorg-14.0.3
llvmorg-14.0.2
llvmorg-14.0.1
llvmorg-14.0.0
llvmorg-15-init
llvmorg-14-init
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(1)
1
https://gitee.com/openeuler/llvm-project.git
git@gitee.com:openeuler/llvm-project.git
openeuler
llvm-project
llvm-project
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register