Session object: Set OS/ABI
This adapts LLVM's behavior of MCELFObjectTargetWriter::getOSABI [1].
[1]: 8c8a2679a2/llvm/include/llvm/MC/MCELFObjectWriter.h (L72-L86)
This commit is contained in:
parent
f7d12b4eec
commit
21625e5730
3 changed files with 24 additions and 3 deletions
|
@ -41,6 +41,6 @@ rustc_target = { path = "../rustc_target" }
|
|||
rustc_session = { path = "../rustc_session" }
|
||||
|
||||
[dependencies.object]
|
||||
version = "0.28.4"
|
||||
version = "0.29.0"
|
||||
default-features = false
|
||||
features = ["read_core", "elf", "macho", "pe", "unaligned", "archive", "write"]
|
||||
|
|
|
@ -171,7 +171,15 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
|
|||
}
|
||||
_ => 0,
|
||||
};
|
||||
file.flags = FileFlags::Elf { e_flags };
|
||||
// adapted from LLVM's `MCELFObjectTargetWriter::getOSABI`
|
||||
let os_abi = match sess.target.options.os.as_ref() {
|
||||
"hermit" => elf::ELFOSABI_STANDALONE,
|
||||
"freebsd" => elf::ELFOSABI_FREEBSD,
|
||||
"solaris" => elf::ELFOSABI_SOLARIS,
|
||||
_ => elf::ELFOSABI_NONE,
|
||||
};
|
||||
let abi_version = 0;
|
||||
file.flags = FileFlags::Elf { os_abi, abi_version, e_flags };
|
||||
Some(file)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue