MaskRay added a comment. In D110422#3021283 <https://reviews.llvm.org/D110422#3021283>, @jsji wrote:
>> In other binary formats the first weak definition is selected and other weak >> definitions are discarded. >> Do you mean that AIX ld doesn't pick the first weak definition? > > No. I think this is exactly what is causing problem here. > > eg: if we have two weak symbols (weak_func), and we generate the weak > counter/data as usual: > > __llvm_prf_cnts: > > __profc_weak_func(1): > > __profc_weak_func(2): > > __llvm_prf_data: > > __profd_weak func(1): > > Pos_Rel __profc_weak_func <=== Relocation to calculate the relative pointer > > __profd_weak_func(2): > > Pos_Rel __profc_weak_func <=== Relocation to calculate the relative pointer > > The relative pointer calculation in one of the __profd_weak_fun will be wrong > after linking. Can you elaborate the `Pos_Rel __profc_weak_func` notation? Note: In other binary formats' scheme, it doesn't matter whether non-first weak definitions are discarded or not. After linking, the non-first weak definitions will be unreachable anyway, so their internal references don't really matter. 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