This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Skip target variable tests on Darwin because of chained fixups
ClosedPublic

Authored by JDevlieghere on Aug 11 2022, 5:02 PM.

Details

Summary

When targeting macOS Ventura, ld64 will use authenticated fixups for x86_64 as well as arm64 (where that has always been the case). This results in 4 test failures when using an Xcode 14 toolchain on an Intel mac running macOS Ventura:

Failed Tests (4):
  lldb-api :: commands/target/basic/TestTargetCommand.py
  lldb-api :: functionalities/return-value/TestReturnValue.py
  lldb-api :: lang/c/global_variables/TestGlobalVariables.py
  lldb-api :: lang/cpp/char8_t/TestCxxChar8_t.py

Rather than trying to come up with a sophisticated decorator based off the deployment target, I marked them all as skipped with a comment explaining why.

Diff Detail

Event Timeline

JDevlieghere created this revision.Aug 11 2022, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 5:02 PM
JDevlieghere requested review of this revision.Aug 11 2022, 5:02 PM
JDevlieghere edited the summary of this revision. (Show Details)Aug 11 2022, 5:06 PM

With this patch applied the test suite should be clean on an Intel mac running macOS Ventura beta + Xcode 14 beta.

I don't know if I support bothering with checking ld's version, I think these tests should be skipped on Darwin.

Before macOS 12, if you built these tests arm64e, the address for something like my_global_str in lldb/test/API/commands/target/basic/globals.c would be the file address and an extra high bit set, a flag to dyld at runtime. As of macOS 12 and newer, on arm64 and arm64e, chained fixups are being used and now my_global_str as a file offset (not a file address) and a high bit to indicate the linker needs to fix it.

On Intel, if you use Xcode 13's ld64 and have a deployment target of macOS 13 (macOS Ventura, the one in beta right now), you'll also get chained fixups. Old linker, newer deployment target, and the tests can fail. Using the Xcode 13 ld64 on a macOS 13 system would probably get you chained fixups by default.

We already skip these tests for arm64 & arm64e because of the chained fixups and arm64e fixups before that -- and now we're going to skip them on x86_64 if the deployment target is new enough (that's the right way to do it, not the linker version) -- I say we skip them on Darwin outright. Pre-execution, we can't reliably view global variables, unless we talk with the ld64/dyld folks and see if we can reliably get the file offset out of these fields and work out the file address ourselves.

Check the darwin OS version as a proxy for the deployment target

We already skip these tests for arm64 & arm64e because of the chained fixups and arm64e fixups before that -- and now we're going to skip them on x86_64 if the deployment target is new enough (that's the right way to do it, not the linker version) -- I say we skip them on Darwin outright. Pre-execution, we can't reliably view global variables, unless we talk with the ld64/dyld folks and see if we can reliably get the file offset out of these fields and work out the file address ourselves.

They're XFAILed rather than skipped on Apple Silicon. We can't XFAIL them outright on Intel because the bots are running an older OS/Xcode, but you're totally right that we could skip them. I'd still like to get this working (although I'm not that motivated) once the linker folks finish upstreaming support for chained fixups in llvm. That + the fact that skipped tests bit rot much faster made me stick with XFAIL. WDYT?

We already skip these tests for arm64 & arm64e because of the chained fixups and arm64e fixups before that -- and now we're going to skip them on x86_64 if the deployment target is new enough (that's the right way to do it, not the linker version) -- I say we skip them on Darwin outright. Pre-execution, we can't reliably view global variables, unless we talk with the ld64/dyld folks and see if we can reliably get the file offset out of these fields and work out the file address ourselves.

They're XFAILed rather than skipped on Apple Silicon. We can't XFAIL them outright on Intel because the bots are running an older OS/Xcode, but you're totally right that we could skip them. I'd still like to get this working (although I'm not that motivated) once the linker folks finish upstreaming support for chained fixups in llvm. That + the fact that skipped tests bit rot much faster made me stick with XFAIL. WDYT?

After thinking about it some more, it's a lot easier to skip the test. When using Xcode 13.4 on Ventura, you'll still get the old behavior unless you explicitly raise the deployment target.

JDevlieghere retitled this revision from [lldb] XFAIL target variable tests on Intel/Darwin when using Xcode 14 to [lldb] Skip target variable tests on Darwin because of chained fixups.Aug 12 2022, 8:59 AM
JDevlieghere edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Aug 12 2022, 10:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2022, 10:23 AM