[all-commits] [llvm/llvm-project] 6a433d: [llvm-jitlink] Allow optional stub-kind filter in ...

Stefan Gränitz via All-commits all-commits at lists.llvm.org
Sat Jan 20 00:57:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a433d77b1f49ddeb03e27394a9b7cbf6e472d1a
      https://github.com/llvm/llvm-project/commit/6a433d77b1f49ddeb03e27394a9b7cbf6e472d1a
  Author: Stefan Gränitz <stefan.graenitz at gmail.com>
  Date:   2024-01-20 (Sat, 20 Jan 2024)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h
    M llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
    M llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h
    M llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp
    M llvm/tools/llvm-jitlink/llvm-jitlink.cpp
    M llvm/tools/llvm-jitlink/llvm-jitlink.h
    M llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp

  Log Message:
  -----------
  [llvm-jitlink] Allow optional stub-kind filter in stub_addr() expressions (#78369)

We use `jitlink-check` lines in LIT tests as the primary tool for
testing JITLink backends. Parsing and evaluation of the expressions is
implemented in `RuntimeDyldChecker`. The `stub_addr(obj, name)`
expression allows to obtain the linker-generated stub for the external
symbol `name` in object file `obj`.

This patch adds support for a filter parameter to select one out of many
stubs. This is necessary for the AArch32 JITLink backend, which must be
able to emit two different kinds of stubs depending on the instruction
set state (Arm/Thumb) of the relocation site. Since the new parameter is
optional, we don't have to update existing tests.

Filters are regular expressions without brackets that match exactly one
existing stub. Given object file `armv7.o` with two stubs for external
function `ext` of kinds `armv7_abs_le` and `thumbv7_abs_le`, we get the
following filter results e.g.:
```
stub_addr(armv7.o, ext, thumb)        thumbv7_abs_le
stub_addr(armv7.o, ext, thumbv7)      thumbv7_abs_le
stub_addr(armv7.o, ext, armv7_abs_le) armv7_abs_le
stub_addr(armv7.o, ext, v7_.*_le)     Error: "ext" has 2 candidate stubs in file "armv7.o". Please refine stub-kind filter "v7_.*_le" for disambiguation (encountered kinds are "thumbv7_abs_le", "armv7_abs_le").
stub_addr(armv7.o, ext, v8)           Error: "ext" has 2 stubs in file "armv7.o", but none of them matches the stub-kind filter "v8" (all encountered kinds are "thumbv7_abs_le", "armv7_abs_le").
```




More information about the All-commits mailing list