[all-commits] [llvm/llvm-project] 667e1f: [profile] Use base+vaddr for `__llvm_write_binary_...
Josh Stone via All-commits
all-commits at lists.llvm.org
Thu Nov 21 10:14:50 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 667e1fadcf4376ce41f5cae7cabab9f5ccc77b15
https://github.com/llvm/llvm-project/commit/667e1fadcf4376ce41f5cae7cabab9f5ccc77b15
Author: Josh Stone <jistone at redhat.com>
Date: 2024-11-21 (Thu, 21 Nov 2024)
Changed paths:
M compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
A compiler-rt/test/profile/Linux/binary-id-offset.c
Log Message:
-----------
[profile] Use base+vaddr for `__llvm_write_binary_ids` note pointers (#114907)
This function is always examining its own ELF headers in memory, but it
was trying to use conditions between examining files or memory, and it
wasn't accounting for LOAD offsets at runtime. This is especially bad if
a loaded segment has additional padding that's not in the file offsets.
Now we do a first scan of the program headers to figure out the runtime
base address based on `PT_PHDR` and/or `PT_DYNAMIC` (else assume zero),
similar to libc's `do_start`. Then each `PT_NOTE` pointer is simply the
base plus the segments's `pt_vaddr`, which includes LOAD offsets.
Fixes #114605
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list