-
Notifications
You must be signed in to change notification settings - Fork 347
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
When compiling/decompiling, some external references are lost #659
Comments
please post the ssdt that exhibits this problem. Thanks! |
This is a smaller SSDT that has the same issue (I'll leave it as an attachment below). Apparently, external references to If I try to decompile
I think the following code complies with the ACPI Specification (correct me if I'm wrong):
My suggestion is:
|
@SchmErik any updates on the topic? |
What happens when you remove the ! in the disassembled code so it looks like this?
|
If I remove the logical not operator I get the following error at runtime:
This happens because If I compile and then decompile the SSDT, I still get the "Illegal forward reference" error. The purpose of the SSDT @1alessandro1 is using is to define a Method if it isn't already defined.
in C). I more and more think that my suggestion 1 (keep all external references) is incorrect.
So I think it is an intended behaviour. Regarding my second suggestion, I tried with a few older versions of iasl. Here are the results: With versions >= 20200430: I get the "Illegal forward reference error". I'm not sure if it can be considered a regression. I have a possible solution:
But I don't know if this causes new bugs, so you may have a better solution. |
Sorry, I should have been more clear - if you remove the ! in the disassembly, do you get a compilation error? I know that this will change runtime behavior. I'm only asking about compilation right now. |
Yes, I still get the “Illegal forward reference” compilation error. |
Any updates on the topic? |
@SchmErik What could be causing this issue? |
sorry about the lack of response. The solution is to change the compiler to retain the externals. It would be nice to drop externals that are actually referenced. In other words, code like
should indicate to the compiler that EXT0 is referenced and the EXT0 external declaration should not be tossed during compilation. The code that's removing this is located in aslexternal.c because it's technically not a method invocation, it gets removed. We need to change it to drop externals that are unreferenced rather than dropping external methods that are never invoked. I'll hopefully have this completed today.. |
Fix available here: Let me know if you see any issues |
When #663 is merged this can be closed, awesome job! |
I found an issue with the code in #663 so I'm going to revert it. I need some time to sort out how to solve this issue in a way that simplifies the logic while not breaking existing test cases. I'm going to start by adding changes so that iASL will unconditionally keep external method declarations. This will make things a little more simple... Feel free to use the code in #663 for your purposes right now though... I'll be gone this week but I'll be back next week. |
Hi, since the changes were reverted, I'd like to know if you found a good fix for this weird bug Keep us updated if you can, thanks Ale |
Compiler version was built today, about 10 minutes ago:
Consider this SSDT with the following external references:
When compiling/decompiling, some of them get lost, generating compilation errors when the file gets first decompiled and then recompiled again
(Before compiling/decompiling)
After, when the compiled file is decompiled and recompiled again after 0 changes and 0 removals by the user, but the decompiler lost 4 External references, causing 4 errors
The text was updated successfully, but these errors were encountered: