jacek added a comment.

In D157547#4650643 <https://reviews.llvm.org/D157547#4650643>, @efriedma wrote:

> Seems to be working for simple cases, but I'm not sure this is actually 
> working properly (I'm still seeing LNK1000 crashes).

I don't know if it's related to crashes that you're seeing, but those 
anti-dependency symbols look different than what MSVC produces. With the patch, 
I get:

$ cat extfunc.c
extern void extfunc(void);
void func(void) { extfunc(); }
$ clang -target arm64ec-windows -c extcall.c -o extcall.o
$ llvm-readobj --symbols extcall.o
...

  Symbol {
    Name: #extfunc
    Value: 0
    Section: IMAGE_SYM_UNDEFINED (0)
    BaseType: Null (0x0)
    ComplexType: Null (0x0)
    StorageClass: WeakExternal (0x69)
    AuxSymbolCount: 1
    AuxWeakExternal {
      Linked: .weak.#extfunc.default.#func (40)
      Search: AntiDependency (0x4)
    }
  }

...

  Symbol {
    Name: extfunc
    Value: 0
    Section: IMAGE_SYM_UNDEFINED (0)
    BaseType: Null (0x0)
    ComplexType: Null (0x0)
    StorageClass: WeakExternal (0x69)
    AuxSymbolCount: 1
    AuxWeakExternal {
      Linked: #extfunc$exit_thunk (43)
      Search: AntiDependency (0x4)
    }
  }

While an equivalent object file produced by MSVC has:

  Symbol {
    Name: #extfunc
    Value: 0
    Section: IMAGE_SYM_UNDEFINED (0)
    BaseType: Null (0x0)
    ComplexType: Function (0x2)
    StorageClass: WeakExternal (0x69)
    AuxSymbolCount: 1
    AuxWeakExternal {
      Linked: #extfunc$exit_thunk (14)
      Search: AntiDependency (0x4)
    }
  }
  Symbol {
    Name: extfunc
    Value: 0
    Section: IMAGE_SYM_UNDEFINED (0)
    BaseType: Null (0x0)
    ComplexType: Function (0x2)
    StorageClass: WeakExternal (0x69)
    AuxSymbolCount: 1
    AuxWeakExternal {
      Linked: #extfunc (19)
      Search: AntiDependency (0x4)
    }
  }

It's the mangled symbol that's linked to guest exit thunk, not unmangled one. 
Also there is no .weak.*.default.* involved.

BTW, I hope to get my WIP lld-link branch into usable state very soon and plan 
to publish it then. I'm able to link real-world code now, but it still requires 
a few hacks that I need to fix to make it work out of the box. Hopefully it 
will make testing and debugging such problems easier.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157547/new/

https://reviews.llvm.org/D157547

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to