[PATCH] D110422: [AIX] Enable PGO without LTO

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 12:11:30 PDT 2021


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



More information about the llvm-commits mailing list