This is an archive of the discontinued LLVM Phabricator instance.

Use segment's off and vaddr fields instead of IsSharedObject heuristic
ClosedPublic

Authored by kpdev42 on Feb 27 2023, 1:10 AM.

Details

Summary

This patch unifies the handling of ET_EXEC and ET_DYN ELF files by
clarifying the difference between "offset" of function's code in ELF
file, its "virtual address" that is recorded in the file (according to
ELF specification, it is the "symbol value" written to st_value field in
a symbol table entry in case of executable and shared object ELF files)
and the actual address of function in the address space of a process
after dynamic relocations took place.

Please note that file offset and virtual address are usually the same in
ET_DYN files (such as shared objects and position-independent
executables) but it is not required and this assumption is sometimes
violated in real-life scenarios.

Depends on D144025

Diff Detail

Repository
rLNT LNT

Event Timeline

kpdev42 created this revision.Feb 27 2023, 1:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 1:10 AM
kpdev42 requested review of this revision.Feb 27 2023, 1:10 AM
kpdev42 edited the summary of this revision. (Show Details)Feb 27 2023, 2:39 AM

We don't use cPerf in Apple's testing, so I am not familiar with this part of the code. Hopefully one of the other reviewer is though?

Hi sorry for the delay, haven't forgotten, I'll review tomorrow!

tnfchris accepted this revision.Mar 20 2023, 10:23 PM

thanks! this look really good! just a minor comment

lnt/testing/profile/cPerf.cpp
845–848

why not just update Map before adding it?

This revision is now accepted and ready to land.Mar 20 2023, 10:23 PM