This is an archive of the discontinued LLVM Phabricator instance.

Don't test dyld_process_create_for_current_task symbol before calling it in HostInfoMacOSX.mm
ClosedPublic

Authored by jasonmolenda on Oct 27 2022, 4:28 PM.

Details

Summary

In a patch Fred landed a year and a half ago, he checks for a header to be available before enabling a block of code, and within that block of code, tests that a symbol, dyld_process_create_for_current_task(), is actually available before calling it - a trick with darwin weak leaking. This SPI has been present in the system since macOS 10.12 (macOS Sierra, released September 2016). We don't need to test for this symbol; this would only happen if you do have the new API on the build host, and were setting a deployment target of macOS 10.12, but you took that binary and tried to run it on an older system.

It also happens to generate a "always evaluates to true" warning.

Diff Detail

Event Timeline

jasonmolenda created this revision.Oct 27 2022, 4:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2022, 4:28 PM
jasonmolenda requested review of this revision.Oct 27 2022, 4:28 PM

The patch only removes the tests for the deployment target (compile-time) and for the symbol to be defined (runtime); clang-format shifted everything around to make it look like the diff is larger.

JDevlieghere accepted this revision.Oct 27 2022, 4:34 PM

Two less levels of indentation 🥳

LGTM

This revision is now accepted and ready to land.Oct 27 2022, 4:34 PM