mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 02:46:06 +00:00

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
Compiler-RT ================================ This directory and its subdirectories contain source code for the compiler support routines. Compiler-RT is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. ================================