Skip to content
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

ExtAPI module cannot handle those functions with name mangling. #1391

Open
DesNevermore opened this issue Mar 4, 2024 · 5 comments
Open

Comments

@DesNevermore
Copy link

On my mac, the fopen() function will be rename to @"\01_fopen" by name mangling mechanism during compilation, which makes the Function Declaration to Definition map construction in "LLVMModule.cpp: void LLVMModuleSet::buildFunToFunMap()" cannot handle this case using exact name comparison.

@yuleisui
Copy link
Collaborator

yuleisui commented Mar 4, 2024

@shuangxiangkan could you take a look at this name matching case? We need to match using general rules?

@yuleisui
Copy link
Collaborator

yuleisui commented Mar 5, 2024

@DesNevermore Did you use the same clang to compile your application code and the extapi.c? If so, they should be the same name either @"fopen" or @"\01_fopen", but not mixed.

@DesNevermore
Copy link
Author

@yuleisui Yes, I use the clang version 14.0.6. The compile command is: clang -w -S -c -emit-llvm -fno-discard-value-names -Xclang -disable-O0-optnone -o ./extapi.bc ./extapi.c for my app code and extapi.c. Just now I retried it, they generated "@fopen" and "@\01_fopen". I don't think there is a guarantee that the compiler will generate the same name using the same clang, since "fopen" in app code is a lib call, while the one in extapi.c is a self-defined function.

@yuleisui
Copy link
Collaborator

yuleisui commented Mar 5, 2024

@shuangxiangkan will fix this shortly.

@shuangxiangkan
Copy link
Contributor

@DesNevermore
This issue has been fixed in #1393.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants