https://sourceware.org/bugzilla/show_bug.cgi?id=31954

            Bug ID: 31954
           Summary: [ld] [lto] [clang] using ld and lto, crash while
                    dynamic compile executable
           Product: binutils
           Version: 2.41
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hanwei62 at huawei dot com
  Target Milestone: ---

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

code:
20081125_0.C:
```
#include "20081125.h"

object::object (int x)
{
}


void
object::key_method (void)
{
        return;
}


int
main ()
{
  return 0;
}
```

clang++  -flto  -c -o cp_lto_20081125_0.o 20081125_0.C  

20081125.h:
```
class base
{
 public:
 base() {}
 virtual ~base() {}
 static base *factory (void);
};

class object : public base
{
 public:
 object() {}
 object (int);
 virtual void key_method (void);
};
```

20081125_1.C:
```
#include "20081125.h"

base * base::factory(void)
{
 return new object ();
}
```
clang++  -flto  -c -o cp_lto_20081125_1.o 20081125_1.C  

finally:
```
clang++ cp_lto_20081125_0.o cp_lto_20081125_1.o  -flto -o
g++-dg-lto-200811125.exe -fuse-ld=ld

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.41
```

But if I compile static, it passed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to