Issue 88001
Summary [LLDB][ELF] LLDB gets confused if there are multiple .text sections in a binary
Labels new issue
Assignees
Reporter al45tair
    I had a Swift PR open (https://github.com/apple/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 `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 call `Swift._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](https://github.com/llvm/llvm-project/files/14906932/lldb-two-text-sections.tar.gz)

(We're tracking this internally as rdar://124467787.)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to