For reference, I have attached a patch I created some time ago to solve this issue. My implementation differs in that I created a new type to represent the section offset instead of special casing DIEDelta. When it was originally committed it broke one of the build bots so it was uncommitted. I didn't have the resources to investigate the issue so I have been maintaining the patch on my own build.<div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Nov 19, 2012 at 1:57 AM, Daniel K³obuszewski <span dir="ltr"><<a href="mailto:daniel.klobuszewski@ibs.org.pl" target="_blank">daniel.klobuszewski@ibs.org.pl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">W dniu 2012-10-26 16:55, Daniel K³obuszewski pisze:<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
Recently I found binaries produced with LLVM impossible to debug under<br>
Windows. This was probably related to the following bug:<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=13636" target="_blank">http://llvm.org/bugs/show_bug.<u></u>cgi?id=13636</a><br>
<br>
Asm generated from .ll files revealed that some offsets to debug<br>
information were incorrect: they were absolute instead of relative to<br>
their sections.<br>
<br>
Following patch seemed to have repaired the problem, so I'm just leaving<br>
it here. Hopefully this will help someone.<br>
<br>
Regards,<br>
Daniel<br>
<br>
<br>
diff -r 547972237a05 -r 6ed9378f04a3 lib/MC/MCAsmInfoCOFF.cpp<br>
--- a/lib/MC/MCAsmInfoCOFF.cpp    Wed Oct 10 20:39:45 2012 +0200<br>
+++ b/lib/MC/MCAsmInfoCOFF.cpp    Thu Oct 18 12:41:27 2012 +0200<br>
@@ -38,6 +38,10 @@<br>
    HasMicrosoftFastStdCallManglin<u></u>g = true;<br>
<br>
    SupportsDataRegions = false;<br>
+<br>
+  DwarfUsesLabelOffsetForRanges = false;<br>
+  DwarfRequiresRelocationForSect<u></u>ionOffset = false;<br>
+  DwarfUsesRelocationsForStringP<u></u>ool = false;<br>
  }<br>
<br>
  void MCAsmInfoMicrosoft::anchor() { }<br>
<br>
</blockquote>
<br></div>
Hello again,<br>
<br>
"fix" from my previous message was helpful only for one compilation unit, but was working incorrectly in case when more CUs were linked together.<br>
<br>
Since the bug I've linked seems to still be unresolved, I'm sending my solution to it. Basically all that needed to be done was to emit .secrel32 instructions in few places instead of sections offsets in label difference form.<br>

<br>
Here is how I've been building executable for tests (under MinGW console):<br>
<br>
llc test.bc -filetype=asm -march=x86 -x86-asm-syntax=att -mtriple=i686-pc-mingw32 -disable-fp-elim<br>
llc test_main.bc -filetype=asm -march=x86 -x86-asm-syntax=att -mtriple=i686-pc-mingw32 -disable-fp-elim<br>
gcc -g -c test.s -o test.o<br>
gcc -g -c test_main.s -o test_main.o<br>
gcc -g test_main.o test.o -o test<br>
<br>
Someone more familiar with LLVM code than me should probably review my proposed patch. My source revision was 3.1 LLVM release.<br>
<br>
Regards,<br>
Daniel<br>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>