MaskRay added a comment.

Sorry, I still don't understand this response:

> We have 3 sets weak symbols here: weak_func, profc_weak_foo, profd_weak_func. 
> We can't ensure that binder always choose 3 of them from same object.

So this part of the description isn't clear to me:

> However, on AIX, the current binder can NOT discard the weak symbols if we 
> put all of them into the same csect, as binder can NOT discard only part of a 
> csect.
>
> This creates a unique challenge for using those symbols to calculate some 
> relative offset.

Say a.o has a weak `foo, __profc_foo, __profd_foo`. The `__profd_foo` 
references the `__profc_foo`

b.o has another set of weak `foo, __profc_foo, __profd_foo`. The `__profd_foo` 
references the `__profc_foo`.

What's the linker (called binder?) behavior? "We can't ensure that binder 
always choose 3 of them from same object."?
But is that a problem? For linkonce_odr functions, they should have identical 
semantics in a.o and b.o.
(There can be ODR issues if you use advanced PGO techniques like value 
profiling, but I assume that it does not work and will be difficult to make 
work and more importantly, it is also of lower value anyway.)

So the linker picking the a.o `foo` and the b.o `__profc_foo/__profd_foo` isn't 
a poblem.

I understand that PrivateLinkage can avoid the issues but you need to justify 
the complexity in `InstrProfiling.cpp` with the value.
Currently I don't think using weak symbol is a big problem, especially if the 
AIX linker will be fixed anyway in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110422

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

Reply via email to