[lld] [LLD][COFF] Prevent to emit relocations for discarded weak wrapped symbols (PR #156214)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 31 10:46:02 PDT 2025


jeremyd2019 wrote:

Hmm. How about

LLD:
```console
(gdb) b _cygwin_crt0_common
Breakpoint 2 at 0x7ff6f37e12a0: file /usr/src/debug/cygwin-3.7.0-0.287.g3a03874f73db/winsup/cygwin/lib/_cygwin_crt0_common.cc, line 124.
(gdb) r
Thread 1 hit Breakpoint 2, _cygwin_crt0_common (f=0x7ff6d15b1080 <main()>,
    u=u at entry=0x0)
    at /usr/src/debug/cygwin-3.7.0-0.287.g3a03874f73db/winsup/cygwin/lib/_cygwin_crt0_common.cc:124
124     {
(gdb) p __cygwin_cxx_malloc
$1 = {oper_new = 0x7ff6d15b11d8 <operator new(unsigned long)>,
  oper_new__ = 0x0, oper_delete = 0x0, oper_delete__ = 0x0, oper_new_nt = 0x0,
  oper_new___nt = 0x0, oper_delete_nt = 0x0, oper_delete___nt = 0x0,
  oper_delete_sz = 0x7ff6d15b11e8 <operator delete(void*, unsigned long)>,
  oper_delete___sz = 0x0,
  oper_new_al = 0x7ff6d15b11d0 <operator new(unsigned long, std::align_val_t)>, oper_new___al = 0x0, oper_delete_al = 0x0, oper_delete___al = 0x0,
  oper_delete_sz_al = 0x7ff6d15b11e0 <operator delete(void*, unsigned long, std::align_val_t)>, oper_delete___sz_al = 0x0, oper_new_al_nt = 0x0,
  oper_new___al_nt = 0x0, oper_delete_al_nt = 0x0, oper_delete___al_nt = 0x0}
```

BFD:
```console
(gdb) b _cygwin_crt0_common
Breakpoint 1 at 0x1004012c0: file /usr/src/debug/cygwin-3.7.0-0.287.g3a03874f73db/winsup/cygwin/lib/_cygwin_crt0_common.cc, line 124.
(gdb) r
Thread 1 hit Breakpoint 1, _cygwin_crt0_common (f=0x100401080 <main()>,
    u=u at entry=0x0)
    at /usr/src/debug/cygwin-3.7.0-0.287.g3a03874f73db/winsup/cygwin/lib/_cygwin_crt0_common.cc:124
124     {
(gdb) p __cygwin_cxx_malloc
$1 = {oper_new = 0x0, oper_new__ = 0x0, oper_delete = 0x0,
  oper_delete__ = 0x0, oper_new_nt = 0x0, oper_new___nt = 0x0,
  oper_delete_nt = 0x0, oper_delete___nt = 0x0, oper_delete_sz = 0x0,
  oper_delete___sz = 0x0, oper_new_al = 0x0, oper_new___al = 0x0,
  oper_delete_al = 0x0, oper_delete___al = 0x0, oper_delete_sz_al = 0x0,
  oper_delete___sz_al = 0x0, oper_new_al_nt = 0x0, oper_new___al_nt = 0x0,
  oper_delete_al_nt = 0x0, oper_delete___al_nt = 0x0}
```

Meaning, Cygwin will think the exe is overriding these operators, when in fact they are just the stubs from linking cygstdc++-6.dll

https://github.com/llvm/llvm-project/pull/156214


More information about the llvm-commits mailing list