gpt4 book ai didi

linux - gcc 命令在链接 (ld) 操作时崩溃

转载 作者:太空宇宙 更新时间:2023-11-04 03:35:26 24 4
gpt4 key购买 nike

我使用的是 Ubuntu 12.04.1 LTS 系统,内核版本为 3.14。而GCC版本是gcc-4.6

# uname -a
Linux SC-TXT-node1 3.14.18-custom #1 SMP Fri Sep 12 14:03:23 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux

# gcc --version
gcc-4.6.real (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

在编译任何 C 文件时,我遇到段错误。

# gcc test.c
collect2: ld terminated with signal 11 [Segmentation fault]

我发现运行命令 - “ld”也会引发段错误。

“dmesg”给出以下错误,但我无法理解它的含义

#dmesg
[83719.292987] ld.bfd.real[60413]: segfault at 1 ip 0000000000000001 sp 00007fff7bede118 error 14 in ld.bfd.real[7f6f156c2000+3000]
[83719.293192] Core dump to |/usr/share/apport/apport 60413 11 0 pipe failed

Strace for ld 给出以下输出

# strace ld -v
....
readlink("/usr/bin/ld.bfd", "hardened-ld", 4095) = 11
stat("/usr/bin/ld.bfd.real", {st_mode=S_IFREG|0755, st_size=30038, ...}) = 0
rt_sigaction(SIGFPE, {SIG_DFL, [], SA_RESTORER, 0x7f7ae6c06150}, {SIG_IGN, [FPE], SA_RESTORER|SA_RESTART, 0x7f7ae6c06150}, 8) = 0
execve("/usr/bin/ld.bfd.real", ["/usr/bin/ld.bfd.real", "-v"], [/* 20 vars */]) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

从外部看来,ld 引用了一些错误的地址,但我不知道是什么导致了这个问题。

关于这个问题有什么建议吗?

最佳答案

GCC 文件似乎已损坏。重新安装 GCC 有助于纠正此问题。

关于linux - gcc 命令在链接 (ld) 操作时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31756395/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com