Skip to content

Conversation

@nikic
Copy link
Contributor

@nikic nikic commented Dec 17, 2025

On ppc64le some sections like .toc get merged into other sections by JITLink. As such, some sections in the object file may not be present in the link graph. Skip those sections.

On ppc64le some sections like .toc get merged into other sections
by JITLink. As such, some sections in the object file may not be
present in the link graph. Skip those sections.
Copy link
Contributor

@lhames lhames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as an interim solution to get the test working.

@nikic -- Do you have access to a ppc64 system to test whether debugging works with this change? (I suspect it does, but have no way to check right now)

In an ideal world we'd identify sections whose address is safe to null out, maybe by parsing the DWARF to identify which sections are used. I don't think we need to do that yet, but it's probably worth adding a TODO for.

@nikic
Copy link
Contributor Author

nikic commented Dec 17, 2025

Do you have access to a ppc64 system to test whether debugging works with this change? (I suspect it does, but have no way to check right now)

I do (I'm using the cfarm120 machine to test). I've only checked that the LLVM/Clang tests pass with this change. What would be a good way to check whether debugging works?

Copy link
Member

@weliveindetail weliveindetail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this and preparing the fix. There was no such report from any of the upstream bots.

What would be a good way to check whether debugging works?

Actual debugging is tested in LLDB, but I am just about to limit these tests to Linux on 64-bit Intel: #172292

@nikic
Copy link
Contributor Author

nikic commented Dec 17, 2025

Thanks for catching this and preparing the fix. There was no such report from any of the upstream bots.

I do see failures on upstream bots as well, e.g. https://lab.llvm.org/buildbot/#/builders/145/builds/11541. Probably they got masked by other failures.

What would be a good way to check whether debugging works?

Actual debugging is tested in LLDB, but I am just about to limit these tests to Linux on 64-bit Intel: #172292

I tried running that test by dropping the REQUIRES and changing the triple. That resulted in an "unsupported 64-bit ELF machine arch" error emitted from:

GetModule()->ReportError("unsupported 64-bit ELF machine arch: {0}", hdr->e_machine);

So to answer the original question: It looks like debugging doesn't work, but the reason is lack of support in lldb. (Though seeing that code, I kind of wonder whether lldb can reuse llvm code, rather than having yet another place that has to know how to apply relocations...)

If I try the same in gdb, it works. So it seems like the ExecutionEngine side of this works fine :)

@nikic nikic merged commit b963def into llvm:main Dec 17, 2025
11 checks passed
@nikic nikic deleted the orc-elf-debug-fix branch December 17, 2025 14:05
@lhames
Copy link
Contributor

lhames commented Dec 18, 2025

Thanks @nikic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants