HomePhabricator

[llvm-jitlink] Add -harness option to llvm-jitlink.

Authored by lhames on Jul 29 2020, 10:55 PM.

Description

[llvm-jitlink] Add -harness option to llvm-jitlink.

The -harness option enables new testing use-cases for llvm-jitlink. It takes a
list of objects to treat as a test harness for any regular objects passed to
llvm-jitlink.

If any files are passed using the -harness option then the following
transformations are applied to all other files:

(1) Symbols definitions that are referenced by the harness files are promoted
    to default scope. (This enables access to statics from test harness).

(2) Symbols definitions that clash with definitions in the harness files are
    deleted. (This enables interposition by test harness).

(3) All other definitions in regular files are demoted to local scope.
    (This causes untested code to be dead stripped, reducing memory cost and
    eliminating spurious unresolved symbol errors from untested code).

These transformations allow the harness files to reference and interpose
symbols in the regular object files, which can be used to support execution
tests (including fuzz tests) of functions in relocatable objects produced by a
build.

Details

Committed
lhamesJul 30 2020, 3:26 PM
Parents
rG9f1dcdca71c4: [JITLink] Allow JITLinkContext::notifyResolved to return an Error.
Branches
Unknown
Tags
Unknown