diff options
author | John Hodge <tpg@ucc.asn.au> | 2018-02-12 22:40:05 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2018-02-12 22:40:05 +0800 |
commit | 568c2a1cf16efc6f5c991e5de476b8a0ba13e70d (patch) | |
tree | 7feb7c2b798287a0beaf5127f84a13c3cd72bb77 | |
parent | 0f051ed545656f36c866549b943f2d5ef03a5b18 (diff) | |
download | mrust-568c2a1cf16efc6f5c991e5de476b8a0ba13e70d.tar.gz |
Codegen MMIR - Fix compilation error on linux
-rw-r--r-- | src/trans/codegen_mmir.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/trans/codegen_mmir.cpp b/src/trans/codegen_mmir.cpp index eab53d37..3f947b46 100644 --- a/src/trans/codegen_mmir.cpp +++ b/src/trans/codegen_mmir.cpp @@ -613,7 +613,8 @@ namespace case ::HIR::CoreType::F32: { ASSERT_BUG(sp, lit.is_Float(), "not Literal::Float - " << lit); uint32_t v; - memcpy(&v, &double(lit.as_Float()), 4); + float v2 = lit.as_Float(); + memcpy(&v, &v2, 4); putu32(v); } break; case ::HIR::CoreType::F64: { @@ -777,7 +778,12 @@ namespace m_of << "{"; for(const auto& r : relocations) { - // TODO. + m_of << "@" << r.ofs << "+" << r.len << " = "; + if( r.p ) + m_of << *r.p; + else + m_of << "\"" << FmtEscaped(r.bytes) << "\""; + m_of << ","; } m_of << "}"; m_of << ";\n"; @@ -1098,4 +1104,4 @@ namespace ::std::unique_ptr<CodeGenerator> Trans_Codegen_GetGenerator_MonoMir(const ::HIR::Crate& crate, const ::std::string& outfile) { return ::std::unique_ptr<CodeGenerator>(new CodeGenerator_MonoMir(crate, outfile)); -}
\ No newline at end of file +} |