Commit 67a940b4 by Ping-Hao Wu Committed by Nicolas Capens

Android's Bionic doesn't support std::sprintf.

Even though the Windows COFF format should not be needed at all on Android, the dependencies on this file are too entangled. Change-Id: I7561a1a037cbc8841a6991b5f3beee3a059ad89d Reviewed-on: https://swiftshader-review.googlesource.com/2663Tested-by: 's avatarGreg Hartman <ghartman@google.com> Reviewed-by: 's avatarGreg Hartman <ghartman@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent c363dab9
...@@ -484,7 +484,13 @@ void WinCOFFObjectWriter::MakeSectionReal(COFFSection &S, size_t Number) { ...@@ -484,7 +484,13 @@ void WinCOFFObjectWriter::MakeSectionReal(COFFSection &S, size_t Number) {
if (StringTableEntry > 999999) if (StringTableEntry > 999999)
report_fatal_error("COFF string table is greater than 999999 bytes."); report_fatal_error("COFF string table is greater than 999999 bytes.");
#if defined(__ANDROID__) || defined(ANDROID)
// bionic defines sprintf as __builtin___sprintf_chk, which is not available
// in std.
sprintf(S.Header.Name, "/%d", unsigned(StringTableEntry));
#else
std::sprintf(S.Header.Name, "/%d", unsigned(StringTableEntry)); std::sprintf(S.Header.Name, "/%d", unsigned(StringTableEntry));
#endif
} else } else
std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size()); std::memcpy(S.Header.Name, S.Name.c_str(), S.Name.size());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment