Viola
Viola

Reputation: 23

How can I build object files with Cargo?

To build an UEFI executable, I need to build an object file from my library. I can then link it to the right PE format with pei-x86-64 subsystem 10

Upvotes: 0

Views: 1491

Answers (1)

Shepmaster
Shepmaster

Reputation: 430673

It's probably easier to just configure Cargo to use the linker you need. Create a target file, which is a blob of JSON describing the target architecture. Something like this may work, but I cannot test it:

{
  "linker": "pei-x86-64",
  "pre-link-args": [
    "subsystem",
    "10"
  ]
}

Then, execute Cargo with cargo --target=my-target.json build.

Upvotes: 2

Related Questions