-
Notifications
You must be signed in to change notification settings - Fork 26
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
External linkage + hidden visibility support #61
Comments
Which symbols are annotated how? Can you share the linker errors here ? |
All I only get linker errors with linux. Unfortunately I don't have access to a linux computer today. The linker error is something about a duplicate symbol. |
I read the first link but I didn’t really follow. I’ll probably need to examine some object files. Specifically I’m wondering what machine level linkage the symbols are given? |
I will upload an object file tomorrow. |
Ok if you have a mach-o that'll be helpful too. In meantime I can look at rustc output for a standard main.rs. At some point we should check in a test.rs similar to the test.c, to track feature parity for a rust/cranelift/faerie backend :) |
On macOS if I just use |
Hmmm; I'm not sure precisely what the issue is; at the machine linking level there isn't really a hidden visibility or external linkage afaik, and this isn't how the example
So my guess is that this isn't something that needs to happen at the faerie level (e.g., linker level), but probably in the backend codegen pipeline in cranelift? I'm not sure though, @sunfishcode do you have any insights on what should be done here? |
I can't reproduce the linker error anymore. |
|
I'm working on some changes that will make this possible. According to https://www.uclibc.org/docs/elf-64-gen.pdf page 10, the "symbol binding" property can be local, global, or weak. My plan is to change the I don't know how weak symbols work in macho, so I'll make that case panic in my first pass at this, but I can learn how macho works next and implement that if needed. |
You're right, I was trying to figure out a way to solve both of these and typed my response in the wrong tab. |
For ELF, It looks like Decl would need an additional enum field for visbility - |
Rustc wants to export some symbols to other object files, but keep them hidden from the resulting dynamic library or executable. I currently get linker errors for https://github.com/bjorn3/rustc_codegen_cranelift/blob/d20f54bb1a873a16681c687a58b7946dc6924913/example/alloc_example.rs because of this not being implemented yet.
The text was updated successfully, but these errors were encountered: