This is an archive of the discontinued LLVM Phabricator instance.

[InstrProfiling] Use self-link for counter metadata
AbandonedPublic

Authored by phosek on Feb 3 2021, 1:10 AM.

Details

Reviewers
MaskRay
Summary

We cannot link to the function because if the function gets discarded,
we'll end up with and invalid link which leads to a linker error:

sh_link points to discarded section

Diff Detail

Event Timeline

phosek created this revision.Feb 3 2021, 1:10 AM
phosek requested review of this revision.Feb 3 2021, 1:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2021, 1:10 AM

We cannot link to the function because if the function gets discarded, we'll end up with and invalid link which leads to a linker error:

If the text section .text.foo gets discarded, the __profc_foo section should get discarded, too.

We cannot link to the function because if the function gets discarded, we'll end up with and invalid link which leads to a linker error:

If the text section .text.foo gets discarded, the __profc_foo section should get discarded, too.

Could it be because we discard COMDAT sections early on when reading input files, so later the __profc_foo section doesn't get collected by GC because it's a C identifier and considered a GC root?

COMDAT and GC are orthogonal. COMDAT selection runs before GC. Every section flag except SHF_GROUP should be retained. Do you have an object file to demonstrate the GC issue?

MaskRay resigned from this revision.Feb 22 2021, 5:35 PM

I'll assume that this is now abandoned? :)

phosek abandoned this revision.Feb 22 2021, 5:54 PM