[llvm] [BOLT] Account for stubs with symbols in plt (PR #192716)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 14:02:51 PDT 2026
================
@@ -0,0 +1,36 @@
+## Test that BOLT correctly handles mold-style STT_FUNC symbols in PLT
+## sections.
+
+# REQUIRES: system-linux
+
+## Build a shared library from the common stubs.
+# RUN: %clang %cflags %p/../Inputs/stub.c -fPIC -shared -o %t.so
+
+## Build and link the main binary. The linker creates a real PLT entry.
+# RUN: llvm-mc -filetype=obj -triple aarch64-linux %s -o %t.o
+# RUN: ld.lld -pie %t.o %t.so -o %t.exe --emit-relocs
+
+## Inject a mold-style STT_FUNC symbol at the PLT entry for printf.
+## Mold places "printf$plt" directly on the PLT stub; we simulate this
+## with llvm-objcopy. The PLT header is 32 bytes on AArch64, and each
+## entry is 16 bytes. printf is the only entry after the header.
+# RUN: llvm-objcopy --add-symbol "printf\$plt=.plt:32,function,local" \
----------------
maksfb wrote:
Are mold-inserted symbols local or global?
https://github.com/llvm/llvm-project/pull/192716
More information about the llvm-commits
mailing list