3 # 1. Inject a freshly built object file into a fresh executable.
4 # Both use a dynamically loaded function and global variable.
5 # 2. Detour execution from a function in the executable to a function
6 # originating from the object file.
7 # 3. Check if the new executable prints the expected changed output.
9 source ./boilerplate.sh
11 elfucli --input $BUILDDIR/putsmainsubglobal \
12 --reladd $BUILDDIR/sub_with_global.o \
13 --detour sub,sub_with_global \
14 --output $BUILDDIR/putsmainsubglobal-with-sub-with-global-detour
17 $BUILDDIR/putsmainsubglobal-with-sub-with-global-detour | grep -q "sub_with_global() is returning."