-
Notifications
You must be signed in to change notification settings - Fork 201
Alternative object file backend #761
Comments
That's correct. The abi is always set to |
Changing all the |
Cool! I found this issue on how faerie and object-write relate: philipc/object-write#1 The part about the abstraction being leaky is interesting. Faerie has a more abstract interface to relocations, however Cranelift ends up bypassing it, using I expect that as Cranelift grows in its role as a low-level compiler, it will increasingly need to be aware of how object files are set up, including things like what sections things are in and what kinds of symbols and relocations it's using. So a low-level API seems like it could fit well for Cranelift's needs.
Would it make sense to make Also, here's a random comment on the ELF backend:
This behavior of prepending ".text" to section names that don't start with "." is not familiar to me. The GCC |
Yep, but doing it that way also makes it hard for faerie to get things like m4b/faerie#80 right, since faerie is missing the information it needs to make the decision.
Maybe!
Yeah, this is a bit of a hack to get things working. The MSVC linker seems to have different naming conventions, so I wanted a way to choose the correct name automatically. Probably should do this as a helper method that the caller explicitly uses instead. |
My idea was just that
It's not immediately obvious how |
I do have some minor usage of
Sure, I was just curious if that is a significant advantage, or only a nicety.
Probably not for cranelift's use case, but it may be useful for reading and writing existing files, which is where I am using it. |
I have an initial implementation of COFF object file support currently living in an
object-write
repository. This is an alternative implementation to faerie, and it presents a lower level API than faerie. This API requires the user to define sections, symbols, and relocations, rather than functions and data objects. Currentlyobject-write
also supports writing ELF, but not yet Mach-O.I also have an initial cranelift module
Backend
implementation that usesobject-write
. Compared to the faerie module backend, I think this implementation is still fairly straight forward, and the lower level API is more flexible.I also have investigated changing
rustc_codegen_cranelift
to use this, and it can successfully compile and link a simple program using the MSVC linker. It appears that at least the wrong calling convention is being used though, so it currently segfaults. This can also use the ELF support inobject-write
, and that passes the currentrustc_codegen_cranelift
tests.This is all still in development, but I'm interested in early feedback about the direction this is going. I wrote
object-write
for other purposes, but I think it's a good fit for cranelift too, and may be useful for #511.The text was updated successfully, but these errors were encountered: