Issue 243371
Summary [JITLink][AArch32] Thumb branch to a section symbol crashes the stub manager ("Edge cannot point to anonymous target")
Labels orcjit, crash
Assignees
Reporter AnantaSrikar
    JITLink's AArch32 backend decides that a Thumb `R_ARM_THM_JUMP24` to the `.text` section symbol needs an interworking stub, and `StubsManager_v7::visitEdge` then asserts that the edge target has a name. A section symbol becomes an anonymous JITLink symbol, so an assertions build aborts and a release build crashes (Ubuntu `llvm-jitlink` 21.1.8 segfaults on the same object).

**Version**: main at c7014922f582 (2026-11-16), built from the Git repository with `-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;PowerPC;WebAssembly"`, on x86_64 Linux.

### Reproducer

```sh
cat > t.s <<'EOF'
.syntax unified
.thumb
.text
.globl main
.type main,%function
.thumb_func
main:
  b.w .+4
  bx lr
.size main, .-main
.reloc main, R_ARM_THM_JUMP24, .text
EOF
llvm-mc -triple=thumbv7-none-linux-gnueabi -arm-add-build-attributes -filetype=obj t.s -o t.o
llvm-jitlink -noexec -phony-externals t.o
```

With `.reloc main, R_ARM_THM_JUMP24, main` instead, the object links (status 0).

### Observed

```
llvm-jitlink: llvm/lib/ExecutionEngine/JITLink/aarch32.cpp:882: bool llvm::jitlink::aarch32::StubsManager_v7::visitEdge(LinkGraph &, Block *, Edge &): Assertion `Target.hasName() && "Edge cannot point to anonymous target"' failed.
```

```
llvm::jitlink::aarch32::StubsManager_v7::visitEdge(llvm::jitlink::LinkGraph&, llvm::jitlink::Block*, llvm::jitlink::Edge&)
void llvm::jitlink::visitExistingEdges<llvm::jitlink::aarch32::StubsManager_v7&>(llvm::jitlink::LinkGraph&, llvm::jitlink::aarch32::StubsManager_v7&)
```

### Expected

Either a stub for the section symbol, or an error from the link.

### Analysis

The v7 stub manager looks the stub up by the target's name:

https://github.com/llvm/llvm-project/blob/c7014922f5829426952a38d079220c21b0a8ebe8/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp#L881-L883

`StubsManager_prev7` does the same:

https://github.com/llvm/llvm-project/blob/c7014922f5829426952a38d079220c21b0a8ebe8/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp#L837-L839

The object is valid ELF: relocations against section symbols are the usual form for local targets. Keying the stub maps by the target `Symbol` instead of its name would handle anonymous targets; at least, `visitEdge` could return an error instead of asserting.

This report was drafted with help from an AI assistant (Claude); I reviewed it and reproduced it myself.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to