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.
description of repo status
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
23
Star
30
Fork
165
src-openEuler
/
gcc
Closed
Code
Issues
30
Pull Requests
12
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
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.
gcc-pie-arm64架构和操作手册结果不同
Backlog
#I7B6X5
Bug
lijian1
Opened this issue
2023-06-06 10:11
<!-- #请根据issue的类型在标题右侧下拉框中选择对应的选项(需求、缺陷或CVE等)--> <!-- #请根据issue相关的版本在里程碑中选择对应的节点,若是与版本无关,请选择“不关联里程碑”--> 【标题描述】gcc-10.3.1,在进行pie编译的时候,x86_64架构和arm64架构编译结果不同。 【环境信息】 硬件信息: arm64环境 [root@localhost test]# lscpu 架构: aarch64 CPU 运行模式: 64-bit 字节序: Little Endian CPU: 16 在线 CPU 列表: 0-15 厂商 ID: HiSilicon BIOS Vendor ID: QEMU 型号名称: Kunpeng-920 BIOS Model name: virt-4.1 x86_64环境: [test1@localhost test]$ lscpu 架构: x86_64 CPU 运行模式: 32-bit, 64-bit Address sizes: 40 bits physical, 57 bits virtual 字节序: Little Endian CPU: 12 在线 CPU 列表: 0-11 厂商 ID: GenuineIntel 型号名称: Intel Xeon Processor (Icelake) CPU 系列: 6 型号: 134 每个核的线程数: 1 每个座的核数: 1 座: 12 步进: 0 BogoMIPS: 4800.00 软件信息: 1) OS版本及分支 [test1@localhost test]$ cat /etc/openEuler-release openEuler release 22.03 (LTS-SP2) 2) 内核信息 [test1@localhost test]$ uname -r 5.10.0-146.0.0.75.oe2203sp2.x86_64 3) 发现问题的组件版本信息 gcc-10.3.1-27.oe2203sp2.x86_64 binutils-2.37-15.oe2203sp2.x86_64 【问题复现步骤】 x86_64架构 [test1@localhost test]$ gcc -o test main.c -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld -no-pie -lm /usr/bin/ld: /tmp/ccQLtDcP.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE collect2: 错误:ld 返回 1 arm64架构 [root@localhost test]# gcc -o test main.c -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld -lm [root@localhost test]# file test test: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=eed747246f449dcbd2f65c4ef4a05837968d82be, for GNU/Linux 3.7.0, not stripped 【预期结果】 根据手册,两个架构应该结果一样。 【实际结果】 根据gcc的手册,应该是ld的时候使用-pie,编译的时候组合使用-fpie/-fPIE,但是在arm64架构上并不需要组合。和手册描述不符。参看file结果,此时已经是pie的可执行程序了。 请解答一下原因。
<!-- #请根据issue的类型在标题右侧下拉框中选择对应的选项(需求、缺陷或CVE等)--> <!-- #请根据issue相关的版本在里程碑中选择对应的节点,若是与版本无关,请选择“不关联里程碑”--> 【标题描述】gcc-10.3.1,在进行pie编译的时候,x86_64架构和arm64架构编译结果不同。 【环境信息】 硬件信息: arm64环境 [root@localhost test]# lscpu 架构: aarch64 CPU 运行模式: 64-bit 字节序: Little Endian CPU: 16 在线 CPU 列表: 0-15 厂商 ID: HiSilicon BIOS Vendor ID: QEMU 型号名称: Kunpeng-920 BIOS Model name: virt-4.1 x86_64环境: [test1@localhost test]$ lscpu 架构: x86_64 CPU 运行模式: 32-bit, 64-bit Address sizes: 40 bits physical, 57 bits virtual 字节序: Little Endian CPU: 12 在线 CPU 列表: 0-11 厂商 ID: GenuineIntel 型号名称: Intel Xeon Processor (Icelake) CPU 系列: 6 型号: 134 每个核的线程数: 1 每个座的核数: 1 座: 12 步进: 0 BogoMIPS: 4800.00 软件信息: 1) OS版本及分支 [test1@localhost test]$ cat /etc/openEuler-release openEuler release 22.03 (LTS-SP2) 2) 内核信息 [test1@localhost test]$ uname -r 5.10.0-146.0.0.75.oe2203sp2.x86_64 3) 发现问题的组件版本信息 gcc-10.3.1-27.oe2203sp2.x86_64 binutils-2.37-15.oe2203sp2.x86_64 【问题复现步骤】 x86_64架构 [test1@localhost test]$ gcc -o test main.c -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld -no-pie -lm /usr/bin/ld: /tmp/ccQLtDcP.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE collect2: 错误:ld 返回 1 arm64架构 [root@localhost test]# gcc -o test main.c -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld -lm [root@localhost test]# file test test: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=eed747246f449dcbd2f65c4ef4a05837968d82be, for GNU/Linux 3.7.0, not stripped 【预期结果】 根据手册,两个架构应该结果一样。 【实际结果】 根据gcc的手册,应该是ld的时候使用-pie,编译的时候组合使用-fpie/-fPIE,但是在arm64架构上并不需要组合。和手册描述不符。参看file结果,此时已经是pie的可执行程序了。 请解答一下原因。
Comments (
1
)
Sign in
to comment
Status
Backlog
Backlog
已挂起
Fixing
Confirmed
Done
Accepted
Canceled
Assignees
Not set
Labels
sig/Compiler
Not set
Projects
Unprojected
Unprojected
Milestones
openEuler-22.03-LTS-SP2
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
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)
参与者(2)
1
https://gitee.com/src-openeuler/gcc.git
git@gitee.com:src-openeuler/gcc.git
src-openeuler
gcc
gcc
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
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