[Bug lto/115327] New: [ld] [lto] using ld and lto, crash while dynamic compile executable

hanwei62 at huawei dot com gcc-bugzilla@gcc.gnu.org
Mon Jun 3 13:26:20 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115327

            Bug ID: 115327
           Summary: [ld] [lto] using ld and lto, crash while dynamic
                    compile executable
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hanwei62 at huawei dot com
  Target Milestone: ---

using lto and ld in arm,  crash finally dynamic compile executable.

code:
20081204-2_1.C
```
namespace {
class c
{
 public:
 c () {}
 virtual ~c() {}
};
};

void
foo (void)
{
 c x;
}
```
clang++ -fuse-ld=ld -Wno-unused-command-line-argument -Wno-deprecated
-fno-caret-diagnostics -fdiagnostics-color=never -fmessage-length=0 -flto  -c
-o cp_lto_20081204-2_1.o 20081204-2_1.C

20081204-2_0.C
```
extern void foo (void);

int
main ()
{
  foo ();
  return 0;
}
```
clang++ -fuse-ld=ld -Wno-unused-command-line-argument -Wno-deprecated
-fno-caret-diagnostics -fdiagnostics-color=never -fmessage-length=0 -flto  -c
-o cp_lto_20081204-2_0.o 20081204-2_0.C

finally:
```
clang++ cp_lto_20081204-2_0.o cp_lto_20081204-2_1.o -fuse-ld=ld
-Wno-unused-command-line-argument -Wno-deprecated -fno-caret-diagnostics
-fdiagnostics-color=never -fmessage-length=0 -flto  -o
g++-dg-lto-20081204-2-01.exe
clang-15: error: unable to execute command: Segmentation fault (core dumped)
clang-15: error: linker command failed due to signal (use -v to see invocation)
```
```
ld -v
GNU ld 2.42
```
But if I compile static, it passed.


More information about the Gcc-bugs mailing list