-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gdb warns about our llvm6.0 fullaot dwarf data (linux) #8806
gdb warns about our llvm6.0 fullaot dwarf data (linux) #8806
Comments
Hm, indeed, gdb cannot walk stack from System_Xml_Serialization_XmlCustomFormatter_FromEnum_long_string___long___string using LLVM 6.0 fullaot but can from regular mini fullaot. i.e. break System_Xml_Serialization_XmlCustomFormatter_FromEnum_long_string___long___string |
Clarification, it can walk one level, to System_Xml_Serialization_EnumMap_GetXmlName_string_object, and that's it. |
I've been investigating for a while what I think might be the same issue, and I think I may know what the issue is. I've been having issues with Xamarin.Android, where I would like to generate DWARF symbols for our AOT+LLVM application, send the DWARF info to Crashlytics and strip the resulting binary. I can easily do the part with generating the symbols and stripping the binary afterwards. However, the resulting DWARF that I get seems to be broken :
From there, I noticed that the problematic offsets are actually ASCII characters. More specifically, they're the bytes of the What I've noticed afterwards is, when we compile with LLVM, we actually link two assembly files, one from Mono and one from LLVM. So we actually have two
However, what we can notice here is that the Mono assembly abbrev gets linked in the section after the LLVM one. But, in the previous
even though the offset should really be LLVM
Mono
The difference is that LLVM outputs a
i.e. I added manually a label at the start of I've been looking to do a fix for this in |
@lambdageek @vargaz do you have some suggestions for @mathieubourgeois ? |
FYI, I just tried to look for the same signs on the initial issue (Linux, fullaot) by running
and I found the same symptoms in an
Again, the offset is |
From what I read of the DWARF specification, we should still emit a I did do a fix by adding such an ability and it works on linux+fullaot as well. |
When outputting DWARF code to start a compilation unit in .debug_info, the standard expect a 4-byte offset from the .debug_abbrev code. Mono has always output an offset of 0. However, this doesn't work in every cases. When we have linux+fullaot, we link two object files (one from Mono, one from LLVM). Both have their .debug_abbrev section. If we use 0 as an offset, it seems possible that the linker will keep thinking that our offset is 0, no matter the circumstances. Since the offset is always 0, it can be using the wrong abbreviation table (i.e. the one from the LLVM assembly instead of the one from the Mono assembly). The consequence of this is that the linked file is not valid DWARF (dwarfdump and objdump will complain about invalid offsets). At best, some tools will be able to work with a part of what we have, but any program requiring entirely valid DWARF will fail. To fix this, we generate a label for the start of our debug_abbrev section and we instead generate it by generating a long with that label. This matches existing behavior seen in the LLVM generated code, and makes dwarfdump and objdump react properly to the linked product. ## Notes I tested this fix in two ways : - Linux + fullaot - Xamarin.Android (which was my initial issue to begin with) - I didn't test the emission of the label (I didn't want to build Xamarin.Android in full to try the change) - However, I did replicate the change myself on the generated .s file and applied the commands normally done by Xamarin.Android to confirm that the fix worked properly (that's how I found the solution in the first place) I'm not 100% convinced this is the right fix, since the DWARF spec mentions an offset in the debug_abbrev section and I'm not sure if they mean relative to the start of the debug_abbrev section or an address in the file (I would guess that if it's 0, they treat it as relative and absolute otherwise but I'm really not sure). For the emission of the label, there wasn't a functionnality available to do as such, so I added one. I based myself on emit_symbol_diff. ## Fixes Fixes mono/mono#8806
…f 0 (#19770) When outputting DWARF code to start a compilation unit in .debug_info, the standard expect a 4-byte offset from the .debug_abbrev code. Mono has always output an offset of 0. However, this doesn't work in every cases. When we have linux+fullaot, we link two object files (one from Mono, one from LLVM). Both have their .debug_abbrev section. If we use 0 as an offset, it seems possible that the linker will keep thinking that our offset is 0, no matter the circumstances. Since the offset is always 0, it can be using the wrong abbreviation table (i.e. the one from the LLVM assembly instead of the one from the Mono assembly). The consequence of this is that the linked file is not valid DWARF (dwarfdump and objdump will complain about invalid offsets). At best, some tools will be able to work with a part of what we have, but any program requiring entirely valid DWARF will fail. To fix this, we generate a label for the start of our debug_abbrev section and we instead generate it by generating a long with that label. This matches existing behavior seen in the LLVM generated code, and makes dwarfdump and objdump react properly to the linked product. Fixes #8806
…f 0 (#36320) When outputting DWARF code to start a compilation unit in .debug_info, the standard expect a 4-byte offset from the .debug_abbrev code. Mono has always output an offset of 0. However, this doesn't work in every cases. When we have linux+fullaot, we link two object files (one from Mono, one from LLVM). Both have their .debug_abbrev section. If we use 0 as an offset, it seems possible that the linker will keep thinking that our offset is 0, no matter the circumstances. Since the offset is always 0, it can be using the wrong abbreviation table (i.e. the one from the LLVM assembly instead of the one from the Mono assembly). The consequence of this is that the linked file is not valid DWARF (dwarfdump and objdump will complain about invalid offsets). At best, some tools will be able to work with a part of what we have, but any program requiring entirely valid DWARF will fail. To fix this, we generate a label for the start of our debug_abbrev section and we instead generate it by generating a long with that label. This matches existing behavior seen in the LLVM generated code, and makes dwarfdump and objdump react properly to the linked product. Fixes mono/mono#8806 Co-authored-by: mathieubourgeois <mathieubourgeois@users.noreply.github.com>
When outputting DWARF code to start a compilation unit in .debug_info, the standard expect a 4-byte offset from the .debug_abbrev code. Mono has always output an offset of 0. However, this doesn't work in every cases. When we have linux+fullaot, we link two object files (one from Mono, one from LLVM). Both have their .debug_abbrev section. If we use 0 as an offset, it seems possible that the linker will keep thinking that our offset is 0, no matter the circumstances. Since the offset is always 0, it can be using the wrong abbreviation table (i.e. the one from the LLVM assembly instead of the one from the Mono assembly). The consequence of this is that the linked file is not valid DWARF (dwarfdump and objdump will complain about invalid offsets). At best, some tools will be able to work with a part of what we have, but any program requiring entirely valid DWARF will fail. To fix this, we generate a label for the start of our debug_abbrev section and we instead generate it by generating a long with that label. This matches existing behavior seen in the LLVM generated code, and makes dwarfdump and objdump react properly to the linked product. Fixes mono#8806
…f 0 (#19794) When outputting DWARF code to start a compilation unit in .debug_info, the standard expect a 4-byte offset from the .debug_abbrev code. Mono has always output an offset of 0. However, this doesn't work in every cases. When we have linux+fullaot, we link two object files (one from Mono, one from LLVM). Both have their .debug_abbrev section. If we use 0 as an offset, it seems possible that the linker will keep thinking that our offset is 0, no matter the circumstances. Since the offset is always 0, it can be using the wrong abbreviation table (i.e. the one from the LLVM assembly instead of the one from the Mono assembly). The consequence of this is that the linked file is not valid DWARF (dwarfdump and objdump will complain about invalid offsets). At best, some tools will be able to work with a part of what we have, but any program requiring entirely valid DWARF will fail. To fix this, we generate a label for the start of our debug_abbrev section and we instead generate it by generating a long with that label. This matches existing behavior seen in the LLVM generated code, and makes dwarfdump and objdump react properly to the linked product. Fixes #8806 Co-authored-by: Mathieu Bourgeois <mathieu.bourgeois@gameloft.com>
@vargaz Xamarin iOS mtouch tests regressed with what appears to be coming from the fix of this issue with the following warnings:
|
/cc @mathieubourgeois we'll probably need to revert that patch from 2020-02, unless you have a quick idea of what might be up. |
Directly here no I don't have an exact idea. If it's possible to extract one of the problematic |
Hello @mathieubourgeois inside the
|
From running
So the abbrev_offset is 0x00000165, which is the exact offset in the file of the |
…nstead of 0 (#19794)" (#20013) This reverts commit 87ef555. It breaks on iOS: #8806 (comment)
Ok, thanks for looking. I reverted the commit in 2020-02. It's still enabled in master (and dotnet/runtime). |
Also, I just relooked at an equivalent file when I built it in Linux at the time, and the offset into debug_abbrev in the .o file is 0x00000000. So that's definitely an issue (as to the why, that's another story) |
Interesting thing I just noticed : passing the linked files in the opposite order (Mono's .o file before llvm's .o file instead of llvm followed by Mono) to |
I can't completely confirm this information (the zip file only contains the mono built file, not the llvm built assembly and object), but by looking at the llvm source code, I can infer that, based on
The second one is never true, so |
That sounds like a good approach to me, what do you think @vargaz and @dalexsoto ? |
Did a tentative PR based on my suggested idea. |
mono/mono#19794 broke on iOS. Analyzing the result showed that, while the assembly was generated as expected, the linked result was different. Analyzing the LLVM code (which triggered the original fix) seems to imply that, on Apple platforms, they will not generate a label for it, only doing the 0-offset as we were doing before. Therefore, match the LLVM behavior by bringing back our previous logic when targetting Mach, otherwise use the new way of doing things. Fixes mono/mono#8806 (again)
…20031) #19794 broke on iOS. Analyzing the result showed that, while the assembly was generated as expected, the linked result was different. Analyzing the LLVM code (which triggered the original fix) seems to imply that, on Apple platforms, they will not generate a label for it, only doing the 0-offset as we were doing before. Therefore, match the LLVM behavior by bringing back our previous logic when targetting Mach, otherwise use the new way of doing things. Fixes #8806 (again)
…38454) mono/mono#19794 broke on iOS. Analyzing the result showed that, while the assembly was generated as expected, the linked result was different. Analyzing the LLVM code (which triggered the original fix) seems to imply that, on Apple platforms, they will not generate a label for it, only doing the 0-offset as we were doing before. Therefore, match the LLVM behavior by bringing back our previous logic when targetting Mach, otherwise use the new way of doing things. Fixes mono/mono#8806 (again) Co-authored-by: mathieubourgeois <mathieubourgeois@users.noreply.github.com>
…ono#20031) mono#19794 broke on iOS. Analyzing the result showed that, while the assembly was generated as expected, the linked result was different. Analyzing the LLVM code (which triggered the original fix) seems to imply that, on Apple platforms, they will not generate a label for it, only doing the 0-offset as we were doing before. Therefore, match the LLVM behavior by bringing back our previous logic when targetting Mach, otherwise use the new way of doing things. Fixes mono#8806 (again) (cherry picked from commit 51dfcfe)
…#38454) mono/mono#19794 broke on iOS. Analyzing the result showed that, while the assembly was generated as expected, the linked result was different. Analyzing the LLVM code (which triggered the original fix) seems to imply that, on Apple platforms, they will not generate a label for it, only doing the 0-offset as we were doing before. Therefore, match the LLVM behavior by bringing back our previous logic when targetting Mach, otherwise use the new way of doing things. Fixes mono/mono#8806 (again) Co-authored-by: mathieubourgeois <mathieubourgeois@users.noreply.github.com>
…s a label instead of 0" (#20046) * Revert "Revert "Emit DWARF debug_abbrev offset for compile units as a label instead of 0 (#19794)" (#20013)" This reverts commit 83105ba. * Bring back previous debug_abbrev offset behavior on Apple platforms (#20031) #19794 broke on iOS. Analyzing the result showed that, while the assembly was generated as expected, the linked result was different. Analyzing the LLVM code (which triggered the original fix) seems to imply that, on Apple platforms, they will not generate a label for it, only doing the 0-offset as we were doing before. Therefore, match the LLVM behavior by bringing back our previous logic when targetting Mach, otherwise use the new way of doing things. Fixes #8806 (again) (cherry picked from commit 51dfcfe) Co-authored-by: mathieubourgeois <mathieu.bourgeois@gameloft.com>
Context: mono/mono#19860 Context: mono/mono#19964 Context: mono/mono#20138 Context: mono/mono#8806 Context: xamarin/xamarin-macios#9289 Changes: mono/mono@83105ba...66e2b84 * mono/mono@66e2b84002f: [aot] Fix an assert which is hit for generic instances with a lot of arguments. (#20239) * mono/mono@d3daacdaa80: Bump msbuild to latest commit * mono/mono@e59c1cd70f4: Fix Cairo issue on macOS Big Sur (#20154) * mono/mono@648655b86d5: [aot] Avoid a crash in generic sharing for invalid generic instances. (#20158) * mono/mono@ec71e8a7ae3: [2020-02] Reapply "Emit DWARF debug_abbrev offset for compile units as a label instead of 0" (#20046) * mono/mono@20bb4f9a6d3: [mono][mini] Do a non-virtual call for bound delegates (#20039) * mono/mono@9ca6fa646a8: [merp] Remove dead code (#20043) * mono/mono@2ff424be293: [crashing] Improve crash chaining (#20018)
Context: mono/mono#8806 Context: mono/mono#19860 Context: mono/mono#19964 Context: mono/mono#20138 Context: xamarin/xamarin-macios#9289 Changes: mono/mono@83105ba...66e2b84 * mono/mono@66e2b84002f: [aot] Fix an assert which is hit for generic instances with a lot of arguments. (#20239) * mono/mono@d3daacdaa80: Bump msbuild to latest commit * mono/mono@e59c1cd70f4: Fix Cairo issue on macOS Big Sur (#20154) * mono/mono@648655b86d5: [aot] Avoid a crash in generic sharing for invalid generic instances. (#20158) * mono/mono@ec71e8a7ae3: [2020-02] Reapply "Emit DWARF debug_abbrev offset for compile units as a label instead of 0" (#20046) * mono/mono@20bb4f9a6d3: [mono][mini] Do a non-virtual call for bound delegates (#20039) * mono/mono@9ca6fa646a8: [merp] Remove dead code (#20043) * mono/mono@2ff424be293: [crashing] Improve crash chaining (#20018)
Release status update for Xamarin SDKs New Preview versions of the Xamarin.Android and Xamarin.iOS SDKs have now been published that include the fix for this item. The fix is not yet included in Release versions. I will update this item again when Release versions are available that include the fix. Fix included in Xamarin.Android SDK version 11.1.0.15. Fix included on Windows in Visual Studio 2019 version 16.8 Preview 4. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.8 Preview 4. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update for Xamarin SDKs New Release versions of the Xamarin.Android and Xamarin.iOS SDKs have now been published that include the fix for this item. Fix included in Xamarin.Android SDK version 11.1.0.17. Fix included on Windows in Visual Studio 2019 version 16.8. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/. Fix included on macOS in Visual Studio 2019 for Mac version 8.8. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. |
linux
running llvm 6.0 fullaot llvm system.xml tests subset
gdb issues diagnostic/warning:
Presumably, expected, no warnings about our dwarf stuff. But perhaps ok.
The text was updated successfully, but these errors were encountered: