Without the synthesized reference to a symbol in the xray_instr_map,
linker section garbage collection will helpfully remove the whole
xray_instr_map section from the final executable (or archive). This will
cause the runtime to not be able to identify the sleds and hot-patch the
calls/jumps into the runtime trampolines.
This change adds a reference from the text section at the end of the
function to keep around the associated xray_instr_map section as well.
We also make sure that we catch this reference in the test.
I don't understand this line, this is the same run as the first line, but for the check-prefix. The intent is not clear.
Note that "CHECK" is the default prefix, used by the first run. But "-LABEL" is a "magic" suffix for FileCheck. So "CHECK-LABEL" is already used by the first check!
See The “CHECK-LABEL:” directive section here: http://llvm.org/docs/CommandGuide/FileCheck.html