debug_loc for params not used in entry block need to be computed with the section start as the base label.
The attached test will not assemble without the patch as the assembler will complain that we are trying to compute a label difference from 2 different sections.
If the basic block containing the first mention of the param is not in the same section as the entry basic block, we cannot use the CurrentFnBegin label. To fix it, we use the Section begin label instead. Using the Section Label will result in loss of debug loc fidelity as we do not capture the basic blocks before the start of this section.
Right now, LabelsBeforeInsn just stores one label for each insn. We can fix the fidelity problem by storing all the basic block section labels that appear before the insn and generating a difference for each of them. Hence, I have made this as a FIXME.
Is this alright? I am not very familiar with debug_loc, other better suggestions are much appreciated here.