-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Debug info: Fixup value out of range #930
Comments
When excluding
|
This is an LVVM bug. You should create a |
Hmm, not sure at which point this happens. |
Are you running You can actually use |
I've used '-O3', now checking in combination with |
Could this be related to #442? The mentioned LLVM/clang bug seems to be.. |
Yes, seems to be the same bug. |
@kinke File is busted for me, I get: |
Thanks for looking into this too! Line 1484 would still be part of the huge display name extending from the previous line all the way down to line 3963! |
@kinke Thanks! |
@majnemer With an updated LDC and LLVM (git
The interesting location is CodeViewDebug.cpp:277, which limits the length of the display name to a little less than 64K. In our case, it's about 80K... |
BTW: DMD (the reference D compiler) trims CodeView symbol names to 0xffd8, as the linker bails out with larger names anyway: https://github.com/D-Programming-Language/dmd/blob/master/src/backend/cv8.c#L45 |
For the clang/c++ side of things, this is taken care of by an interesting trick: all symbols > 4k get their linkage name md5 hashed. The has is then substituted for the linkage name. I do not like the DMD approach to this because it silently drops the end of the linkage name. Instead, I'd rather have us skip functions with names that are too large instead of pretending to support the behavior. Is there a reason why using a scheme akin to the MSVC one would be undesirable for LDC? |
DMD does similar for the ancient OMF object files: if the (compressed) symbol does not fit into 128(!) characters, it is cut off around 100 and the MD5 hash is appended. I guess we should do something similar for symbols in COFF files.
You mean the compression of symbols with backward references? This should be possible, but the C++ version is rather limited IIRC. OMF symbol compression uses LZW or similar, but generates undecodable symbols in case the name contains non-ASCII characters (D allows any "universal alphas"). The biggest downside to changing the mangling is probably that it has to creep into a number of build tools supporting only the current one. |
A limitation of the MS linker and enforced by LLVM. Fixes issue ldc-developers#930.
A limitation of the MS linker/COFF format and enforced by LLVM. Fixes issue ldc-developers#930.
I'm not closing this yet as I've hit this old assertion just now again with bleeding edge LLVM, for the |
@kinke Could you post the failing IR? |
It's 110 MB last time I checked. ;) |
The size isn't a problem for me, I'd still be more than happy to take a look. |
But compressed it's only 1.4 MB. |
Figured it out. |
I ended up fixing this LLVM r263378. We will perform the truncation regardless of where we got the name, you can probably remove the truncation logic on your side. |
😜
Hmm, has a bad smell to it...
Makes sense imo. Thanks a lot! |
@majnemer I've just used current LLVM head. Your fix works for the latest issue, but I still have to truncate the display name of |
Well the LLVM truncation fix allows to compile the modules, but then the MS linker complains:
|
Thx Rainer, my machine is already building... |
Okay so using 0xffd8 in both locations gets rid of the linker complaints (0xffd9 at the other site was already too high). |
You can't use 0xffd9 for the variable side of things? Also, I don't understand the bit about DISubprogram. Does it crash in LLVM, what is the failure moe? |
Yep, otherwise the MS linker would complain for the 'setops' source (x64 at least, not sure about x86). About |
Can I get IR for the |
It's the 'fixup' one earlier in this thread (#930 (comment)) - I don't think it has changed a lot. If need be I can recreate it after a recompile... |
Thanks, I switched to 0xffd8 and fixed the |
Thanks! I'll check it when I find some time. |
I've tested it with yesterday's LLVM, works perfectly without any truncation from our side. Thx! |
A limitation of the MS linker/COFF format and enforced by LLVM. Fixes issue ldc-developers#930.
Environment: Win64, VS 2015, LDC merge-2.067 (+ my VS15 patches + kinke/druntime@1add4f0), LLVM master (
5de99601367aaf09ba1d17cd51478bde5e1b74fe
).All druntime debug unittests compile fine and all Phobos ones too, except for
std.string
and only when using the-g
switch to generate debug infos. This snippet:yields the following when using the
-g
switch, and otherwise compiles fine:We have a
llvm::MCFixup
of kindFK_Data_2
(16 bits), but its value is bigger (78893 in my case).The text was updated successfully, but these errors were encountered: