W dniu 2012-10-26 16:55, Daniel Kłobuszewski pisze:
Hello,
Recently I found binaries produced with LLVM impossible to debug under
Windows. This was probably related to the following bug:
http://llvm.org/bugs/show_bug.cgi?id=13636
Asm generated from .ll files revealed that some offsets to debug
information were incorrect: they were absolute instead of relative to
their sections.
Following patch seemed to have repaired the problem, so I'm just leaving
it here. Hopefully this will help someone.
Regards,
Daniel
diff -r 547972237a05 -r 6ed9378f04a3 lib/MC/MCAsmInfoCOFF.cpp
--- a/lib/MC/MCAsmInfoCOFF.cpp Wed Oct 10 20:39:45 2012 +0200
+++ b/lib/MC/MCAsmInfoCOFF.cpp Thu Oct 18 12:41:27 2012 +0200
@@ -38,6 +38,10 @@
HasMicrosoftFastStdCallMangling = true;
SupportsDataRegions = false;
+
+ DwarfUsesLabelOffsetForRanges = false;
+ DwarfRequiresRelocationForSectionOffset = false;
+ DwarfUsesRelocationsForStringPool = false;
}
void MCAsmInfoMicrosoft::anchor() { }
Hello again,
"fix" from my previous message was helpful only for one compilation unit, but was working incorrectly in case when more CUs were linked together.
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.
Here is how I've been building executable for tests (under MinGW console):
llc test.bc -filetype=asm -march=x86 -x86-asm-syntax=att -mtriple=i686-pc-mingw32 -disable-fp-elim
llc test_main.bc -filetype=asm -march=x86 -x86-asm-syntax=att -mtriple=i686-pc-mingw32 -disable-fp-elim
gcc -g -c test.s -o test.o
gcc -g -c test_main.s -o test_main.o
gcc -g test_main.o test.o -o test
Someone more familiar with LLVM code than me should probably review my proposed patch. My source revision was 3.1 LLVM release.
Regards,
Daniel
llvm_patch.diff (3.11 KB)