-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LLDB][ELF] LLDB gets confused if there are multiple .text sections in a binary #88001
Comments
@llvm/issue-subscribers-lldb Author: Alastair Houghton (al45tair)
I had a Swift PR open (https://github.com/swiftlang/swift/pull/72061) that changes how Swift handles the metadata sections (in particular), but as a consequence causes the compiler to set `SHF_GNU_RETAIN` on other sections as well. At time of writing, all of the tests are passing *except* some LLDB API tests, which was very puzzling.
The problem appears to be that, because of the behaviour of older versions of The bug here is that LLDB appears to get confused about the presence of two I've attached a small reproducer, which doesn't need Swift (or anything to do with Swift). (We're tracking this internally as rdar://124467787.) |
I found another fun symptom of the same problem. If you set a breakpoint on This happens because |
Section unification cannot just use names, because it's valid for ELF binaries to have multiple sections with the same name. We should check other section properties too. Fixes #88001. rdar://124467787
I had a Swift PR open (swiftlang/swift#72061) that changes how Swift handles the metadata sections (in particular), but as a consequence causes the compiler to set
SHF_GNU_RETAIN
on other sections as well. At time of writing, all of the tests are passing except some LLDB API tests, which was very puzzling.The problem appears to be that, because of the behaviour of older versions of
ld.gold
(prior to binutils 2.36),libswiftCore.so
ends up with two.text
sections, and then when LLDB tries to print a Swift object, it attempts to callSwift._DebuggerSupport.stringForPrintObject
, but gets mixed up and adds the offset it found for that function to the wrong.text
section, jumps into the end of an entirely unrelated function and (eventually) crashes after triggering an assertion failure.The bug here is that LLDB appears to get confused about the presence of two
.text
sections, which leads to symbol lookups going awry.I've attached a small reproducer, which doesn't need Swift (or anything to do with Swift).
lldb-two-text-sections.tar.gz
(We're tracking this internally as rdar://124467787.)
The text was updated successfully, but these errors were encountered: