[PATCH] D95985: [ELF] Resolve defined symbols before undefined symbols

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 01:30:46 PST 2021


peter.smith added a comment.

> The real world case is reduced from a Fuchsia PGO usage: a.a(a.o) has a constructor within COMDAT group C5
> while a.a(b.o) has a constructor within COMDAT group C2. Because they use
> different group signatures, they are not de-duplicated.



> LLD selects the PGO counter section (__profd_*) from a.a(b.o) and the
> constructor section from a.a(a.o). The __profd_* is a SHF_LINK_ORDER section
> linking to its own non-prevailing constructor section, so LLD errors
> sh_link points to discarded section. This patch fixes the error.

Can you write out the example in full, I'm not sure I got it. I would expect that if C5 and C2 have different signatures they should both be loaded as to the linker they are entirely separate entities. If the __profd_* sections have link order dependencies into group sections are not in the same group I think we have a problem with ELF file and not with the linker. Have I misunderstood the example?

Will need to have a think. I don't have any particular attachment to the way that we resolve undefined symbols today so I'm not going to object if there are other benefits.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95985



More information about the llvm-commits mailing list