// DIE's signature file
// Author: fernandom - menteb.in

init("compiler", "Rust");

function detect(bShowType, bShowVersion, bShowOptions) {
    if (ELF.isStringInTablePresent(".strtab", "rust_panic")) {
        bDetected = 1;
        var nSection = ELF.getSectionNumber(".debug_str");
        var nOffset = ELF.getSectionFileOffset(nSection);
        var nSize = ELF.getSectionFileSize(nSection);

        if (nSize > 0) {
            var nStringOffset = ELF.findString(nOffset, 6, "rustc ");
            if (nStringOffset != -1) {
                sVersion = ELF.getString(nStringOffset);
            }
        }
    }

    _setLang("Rust", bDetected);
    return result(bShowType, bShowVersion, bShowOptions);
}