This is an archive of the discontinued LLVM Phabricator instance.

On FreeBSD use AT_EXECPATH from ELF auxiliary vectors for getExecutablePath
ClosedPublic

Authored by emaste on Nov 13 2019, 11:50 AM.

Details

Summary

/proc/curproc/file and the KERN_PROC_PATHNAME sysctl may not return the desired path if there are multiple hardlinks to the file.

Unfortunately we do not yet have a standard interface to obtain this in FreeBSD, but one will be added shortly. I will post a followup change to move to that based on FreeBSD version leaving this as a fallback, and eventually we can leave only that one.

Diff Detail

Event Timeline

emaste created this revision.Nov 13 2019, 11:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2019, 11:50 AM
emaste updated this revision to Diff 229186.Nov 13 2019, 2:14 PM

Use elf_aux_info() if we can

emaste added a subscriber: brooks.Nov 13 2019, 2:17 PM
theraven accepted this revision.Nov 14 2019, 2:33 AM
This revision is now accepted and ready to land.Nov 14 2019, 2:33 AM
This revision was automatically updated to reflect the committed changes.